summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp5
-rw-r--r--src/plugins/remotelinux/abstractuploadandinstallpackageservice.h5
-rw-r--r--src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp4
-rw-r--r--src/plugins/remotelinux/maemodeploybymountsteps.cpp2
-rw-r--r--src/plugins/remotelinux/maemoglobal.cpp1
-rw-r--r--src/plugins/remotelinux/maemoglobal.h1
-rw-r--r--src/plugins/remotelinux/maemopackageinstaller.cpp141
-rw-r--r--src/plugins/remotelinux/maemopackageinstaller.h82
-rw-r--r--src/plugins/remotelinux/remotelinux.pro6
-rw-r--r--src/plugins/remotelinux/remotelinuxpackageinstaller.cpp158
-rw-r--r--src/plugins/remotelinux/remotelinuxpackageinstaller.h103
-rw-r--r--src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp8
-rw-r--r--src/plugins/remotelinux/uploadandinstalltarpackagestep.h6
13 files changed, 303 insertions, 219 deletions
diff --git a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp
index 358384b4a3..badc2554af 100644
--- a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp
+++ b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp
@@ -33,9 +33,8 @@
#include "deployablefile.h"
#include "linuxdeviceconfiguration.h"
-#include "maemopackagecreationstep.h"
-#include "maemopackageinstaller.h"
#include "maemopackageuploader.h"
+#include "remotelinuxpackageinstaller.h"
#include <utils/qtcassert.h>
#include <utils/ssh/sshconnection.h>
@@ -163,7 +162,7 @@ void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString
connect(packageInstaller(), SIGNAL(stderrData(QString)), SIGNAL(stdErrData(QString)));
connect(packageInstaller(), SIGNAL(finished(QString)),
SLOT(handleInstallationFinished(QString)));
- packageInstaller()->installPackage(connection(), deviceConfiguration(), remoteFilePath, true);
+ packageInstaller()->installPackage(connection(), remoteFilePath, true);
}
void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QString &errorMsg)
diff --git a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.h b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.h
index 1be8e6aac0..7f193677fa 100644
--- a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.h
+++ b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.h
@@ -36,8 +36,9 @@
#include "remotelinux_export.h"
namespace RemoteLinux {
+class AbstractRemoteLinuxPackageInstaller;
+
namespace Internal {
-class AbstractMaemoPackageInstaller;
class AbstractUploadAndInstallPackageServicePrivate;
}
@@ -59,7 +60,7 @@ private slots:
void handleInstallationFinished(const QString &errorMsg);
private:
- virtual Internal::AbstractMaemoPackageInstaller *packageInstaller() const=0;
+ virtual AbstractRemoteLinuxPackageInstaller *packageInstaller() const=0;
virtual QString uploadDir() const; // Defaults to remote user's home directory.
bool isDeploymentNecessary() const;
diff --git a/src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp b/src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp
index 3f3693aae0..2029202282 100644
--- a/src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp
+++ b/src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp
@@ -94,7 +94,7 @@ public:
{
}
- AbstractMaemoPackageInstaller *packageInstaller() const { return m_installer; }
+ AbstractRemoteLinuxPackageInstaller *packageInstaller() const { return m_installer; }
private:
MaemoDebianPackageInstaller * const m_installer;
@@ -111,7 +111,7 @@ public:
{
}
- AbstractMaemoPackageInstaller *packageInstaller() const { return m_installer; }
+ AbstractRemoteLinuxPackageInstaller *packageInstaller() const { return m_installer; }
private:
MaemoRpmPackageInstaller * const m_installer;
diff --git a/src/plugins/remotelinux/maemodeploybymountsteps.cpp b/src/plugins/remotelinux/maemodeploybymountsteps.cpp
index 70dd46a38b..e7f683ceb3 100644
--- a/src/plugins/remotelinux/maemodeploybymountsteps.cpp
+++ b/src/plugins/remotelinux/maemodeploybymountsteps.cpp
@@ -307,7 +307,7 @@ void MaemoMountAndInstallPackageService::doInstall()
{
const QString remoteFilePath = deployMountPoint() + QLatin1Char('/')
+ QFileInfo(m_packageFilePath).fileName();
- m_installer->installPackage(connection(), deviceConfiguration(), remoteFilePath, false);
+ m_installer->installPackage(connection(), remoteFilePath, false);
}
void MaemoMountAndInstallPackageService::cancelInstallation()
diff --git a/src/plugins/remotelinux/maemoglobal.cpp b/src/plugins/remotelinux/maemoglobal.cpp
index 2b3256e6ff..28ce559468 100644
--- a/src/plugins/remotelinux/maemoglobal.cpp
+++ b/src/plugins/remotelinux/maemoglobal.cpp
@@ -43,7 +43,6 @@
#include <qt4projectmanager/qt4target.h>
#include <utils/environment.h>
-#include <QtCore/QDateTime>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QProcess>
diff --git a/src/plugins/remotelinux/maemoglobal.h b/src/plugins/remotelinux/maemoglobal.h
index 53561f32fb..021857ff93 100644
--- a/src/plugins/remotelinux/maemoglobal.h
+++ b/src/plugins/remotelinux/maemoglobal.h
@@ -50,7 +50,6 @@
MaemoGlobal::assertState<State>(expected, actual, Q_FUNC_INFO)
QT_BEGIN_NAMESPACE
-class QDateTime;
class QProcess;
class QString;
QT_END_NAMESPACE
diff --git a/src/plugins/remotelinux/maemopackageinstaller.cpp b/src/plugins/remotelinux/maemopackageinstaller.cpp
index a6de19bd2c..25964bf51e 100644
--- a/src/plugins/remotelinux/maemopackageinstaller.cpp
+++ b/src/plugins/remotelinux/maemopackageinstaller.cpp
@@ -34,113 +34,13 @@
#include "maemoglobal.h"
-#include <utils/ssh/sshconnection.h>
-#include <utils/ssh/sshremoteprocessrunner.h>
-
-using namespace Utils;
-
namespace RemoteLinux {
namespace Internal {
-AbstractMaemoPackageInstaller::AbstractMaemoPackageInstaller(QObject *parent)
- : QObject(parent), m_isRunning(false)
-{
-}
-
-AbstractMaemoPackageInstaller::~AbstractMaemoPackageInstaller() {}
-
-void AbstractMaemoPackageInstaller::installPackage(const SshConnection::Ptr &connection,
- const LinuxDeviceConfiguration::ConstPtr &devConf, const QString &packageFilePath,
- bool removePackageFile)
-{
- Q_ASSERT(connection && connection->state() == SshConnection::Connected);
- Q_ASSERT(!m_isRunning);
-
- prepareInstallation();
- m_installer = SshRemoteProcessRunner::create(connection);
- connect(m_installer.data(), SIGNAL(connectionError(Utils::SshError)),
- SLOT(handleConnectionError()));
- connect(m_installer.data(), SIGNAL(processOutputAvailable(QByteArray)),
- SLOT(handleInstallerOutput(QByteArray)));
- connect(m_installer.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
- SLOT(handleInstallerErrorOutput(QByteArray)));
- connect(m_installer.data(), SIGNAL(processClosed(int)),
- SLOT(handleInstallationFinished(int)));
-
- const QString space = QLatin1String(" ");
- QString cmdLine = QLatin1String("cd ") + workingDirectory()
- + QLatin1String(" && ")
- + MaemoGlobal::remoteSudo(devConf->osType(),
- m_installer->connection()->connectionParameters().userName)
- + space + installCommand()
- + space + installCommandArguments().join(space) + space
- + packageFilePath;
- if (removePackageFile) {
- cmdLine += QLatin1String(" && (rm ") + packageFilePath
- + QLatin1String(" || :)");
- }
- m_installer->run(cmdLine.toUtf8());
- m_isRunning = true;
-}
-
-void AbstractMaemoPackageInstaller::cancelInstallation()
-{
- Q_ASSERT(m_isRunning);
- const SshRemoteProcessRunner::Ptr killProcess
- = SshRemoteProcessRunner::create(m_installer->connection());
- killProcess->run("pkill " + installCommand().toUtf8());
- setFinished();
-}
-
-void AbstractMaemoPackageInstaller::handleConnectionError()
-{
- if (!m_isRunning)
- return;
- emit finished(tr("Connection failure: %1")
- .arg(m_installer->connection()->errorString()));
- setFinished();
-}
-
-void AbstractMaemoPackageInstaller::handleInstallationFinished(int exitStatus)
-{
- if (!m_isRunning)
- return;
-
- if (exitStatus != SshRemoteProcess::ExitedNormally
- || m_installer->process()->exitCode() != 0) {
- emit finished(tr("Installing package failed."));
- } else if (!errorString().isEmpty()) {
- emit finished(errorString());
- } else {
- emit finished();
- }
-
- setFinished();
-}
-
-void AbstractMaemoPackageInstaller::handleInstallerOutput(const QByteArray &output)
-{
- emit stdoutData(QString::fromUtf8(output));
-}
-
-void AbstractMaemoPackageInstaller::handleInstallerErrorOutput(const QByteArray &output)
-{
- emit stderrData(QString::fromUtf8(output));
-}
-
-void AbstractMaemoPackageInstaller::setFinished()
-{
- disconnect(m_installer.data(), 0, this, 0);
- m_installer.clear();
- m_isRunning = false;
-}
-
-
MaemoDebianPackageInstaller::MaemoDebianPackageInstaller(QObject *parent)
- : AbstractMaemoPackageInstaller(parent)
+ : AbstractRemoteLinuxPackageInstaller(parent)
{
- connect(this, SIGNAL(stderrData(QString)),
- SLOT(handleInstallerErrorOutput(QString)));
+ connect(this, SIGNAL(stderrData(QString)), SLOT(handleInstallerErrorOutput(QString)));
}
void MaemoDebianPackageInstaller::prepareInstallation()
@@ -148,15 +48,15 @@ void MaemoDebianPackageInstaller::prepareInstallation()
m_installerStderr.clear();
}
-QString MaemoDebianPackageInstaller::installCommand() const
+QString MaemoDebianPackageInstaller::installCommandLine(const QString &packageFilePath) const
{
- return QLatin1String("dpkg");
+ return MaemoGlobal::devrootshPath() + QLatin1String(" dpkg -i --no-force-downgrade ")
+ + packageFilePath;
}
-QStringList MaemoDebianPackageInstaller::installCommandArguments() const
+QString MaemoDebianPackageInstaller::cancelInstallationCommandLine() const
{
- return QStringList() << QLatin1String("-i")
- << QLatin1String("--no-force-downgrade");
+ return QLatin1String("pkill dpkg");
}
void MaemoDebianPackageInstaller::handleInstallerErrorOutput(const QString &output)
@@ -176,16 +76,11 @@ QString MaemoDebianPackageInstaller::errorString() const
MaemoRpmPackageInstaller::MaemoRpmPackageInstaller(QObject *parent)
- : AbstractMaemoPackageInstaller(parent)
-{
-}
-
-QString MaemoRpmPackageInstaller::installCommand() const
+ : AbstractRemoteLinuxPackageInstaller(parent)
{
- return QLatin1String("rpm");
}
-QStringList MaemoRpmPackageInstaller::installCommandArguments() const
+QString MaemoRpmPackageInstaller::installCommandLine(const QString &packageFilePath) const
{
// rpm -U does not allow to re-install a package with the same version
// number, so we need --replacepkgs. Even then, it inexplicably reports
@@ -193,23 +88,13 @@ QStringList MaemoRpmPackageInstaller::installCommandArguments() const
// so we need --replacefiles as well.
// TODO: --replacefiles is dangerous. Is there perhaps a way around it
// after all?
- return QStringList() << QLatin1String("-Uhv") << QLatin1String("--replacepkgs") << QLatin1String("--replacefiles");
-}
-
-
-MaemoTarPackageInstaller::MaemoTarPackageInstaller(QObject *parent)
- : AbstractMaemoPackageInstaller(parent)
-{
-}
-
-QString MaemoTarPackageInstaller::installCommand() const
-{
- return QLatin1String("tar");
+ return MaemoGlobal::devrootshPath() + QLatin1String(" rpm -Uhv --replacepkgs --replacefiles ")
+ + packageFilePath;
}
-QStringList MaemoTarPackageInstaller::installCommandArguments() const
+QString MaemoRpmPackageInstaller::cancelInstallationCommandLine() const
{
- return QStringList() << QLatin1String("xvf");
+ return QLatin1String("pkill rpm");
}
} // namespace Internal
diff --git a/src/plugins/remotelinux/maemopackageinstaller.h b/src/plugins/remotelinux/maemopackageinstaller.h
index 83cb1300b3..bd96b965ad 100644
--- a/src/plugins/remotelinux/maemopackageinstaller.h
+++ b/src/plugins/remotelinux/maemopackageinstaller.h
@@ -33,103 +33,41 @@
#ifndef ABSTRACTMAEMOPACKAGEINSTALLER_H
#define ABSTRACTMAEMOPACKAGEINSTALLER_H
-namespace Utils {
-class SshConnection;
-class SshRemoteProcessRunner;
-}
-
-#include <QtCore/QObject>
-#include <QtCore/QSharedPointer>
-#include <QtCore/QString>
-#include <QtCore/QStringList>
+#include <remotelinux/remotelinuxpackageinstaller.h>
namespace RemoteLinux {
-class LinuxDeviceConfiguration;
-
namespace Internal {
-class AbstractMaemoPackageInstaller : public QObject
-{
- Q_OBJECT
-public:
- ~AbstractMaemoPackageInstaller();
-
- void installPackage(const QSharedPointer<Utils::SshConnection> &connection,
- const QSharedPointer<const LinuxDeviceConfiguration> &devConfig,
- const QString &packageFilePath, bool removePackageFile);
- void cancelInstallation();
-
-signals:
- void stdoutData(const QString &output);
- void stderrData(const QString &output);
- void finished(const QString &errorMsg = QString());
-
-protected:
- explicit AbstractMaemoPackageInstaller(QObject *parent = 0);
- bool isRunning() const { return m_isRunning; }
-
-private slots:
- void handleConnectionError();
- void handleInstallationFinished(int exitStatus);
- void handleInstallerOutput(const QByteArray &output);
- void handleInstallerErrorOutput(const QByteArray &output);
-
-private:
- virtual void prepareInstallation() {}
- virtual QString workingDirectory() const { return QLatin1String("/tmp"); }
- virtual QString installCommand() const=0;
- virtual QStringList installCommandArguments() const=0;
- virtual QString errorString() const { return QString(); }
- void setFinished();
-
- bool m_isRunning;
- QSharedPointer<Utils::SshRemoteProcessRunner> m_installer;
-};
-
-
-class MaemoDebianPackageInstaller: public AbstractMaemoPackageInstaller
+class MaemoDebianPackageInstaller: public RemoteLinux::AbstractRemoteLinuxPackageInstaller
{
Q_OBJECT
public:
explicit MaemoDebianPackageInstaller(QObject *parent);
private slots:
- virtual void prepareInstallation();
- virtual QString installCommand() const;
- virtual QStringList installCommandArguments() const;
- virtual QString errorString() const;
void handleInstallerErrorOutput(const QString &output);
private:
+ void prepareInstallation();
+ QString errorString() const;
+ QString installCommandLine(const QString &packageFilePath) const;
+ QString cancelInstallationCommandLine() const;
+
QString m_installerStderr;
};
-class MaemoRpmPackageInstaller : public AbstractMaemoPackageInstaller
+class MaemoRpmPackageInstaller : public RemoteLinux::AbstractRemoteLinuxPackageInstaller
{
Q_OBJECT
public:
MaemoRpmPackageInstaller(QObject *parent);
private:
- virtual QString installCommand() const;
- virtual QStringList installCommandArguments() const;
+ QString installCommandLine(const QString &packageFilePath) const;
+ QString cancelInstallationCommandLine() const;
};
-
-class MaemoTarPackageInstaller : public AbstractMaemoPackageInstaller
-{
- Q_OBJECT
-public:
- MaemoTarPackageInstaller(QObject *parent = 0);
-
-private:
- virtual QString installCommand() const;
- virtual QStringList installCommandArguments() const;
- virtual QString workingDirectory() const { return QLatin1String("/"); }
-};
-
-
} // namespace Internal
} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro
index 4541e95127..3144cc9632 100644
--- a/src/plugins/remotelinux/remotelinux.pro
+++ b/src/plugins/remotelinux/remotelinux.pro
@@ -91,7 +91,8 @@ HEADERS += \
remotelinuxdeployconfigurationfactory.h \
genericremotelinuxdeploystepfactory.h \
abstractpackagingstep.h \
- tarpackagecreationstep.h
+ tarpackagecreationstep.h \
+ remotelinuxpackageinstaller.h
SOURCES += \
remotelinuxplugin.cpp \
@@ -176,7 +177,8 @@ SOURCES += \
remotelinuxdeployconfigurationfactory.cpp \
genericremotelinuxdeploystepfactory.cpp \
abstractpackagingstep.cpp \
- tarpackagecreationstep.cpp
+ tarpackagecreationstep.cpp \
+ remotelinuxpackageinstaller.cpp
FORMS += \
maemoconfigtestdialog.ui \
diff --git a/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp b/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp
new file mode 100644
index 0000000000..b9bc38d9d9
--- /dev/null
+++ b/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp
@@ -0,0 +1,158 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+#include "remotelinuxpackageinstaller.h"
+
+#include <QtCore/QByteArray>
+
+#include <utils/qtcassert.h>
+#include <utils/ssh/sshconnection.h>
+#include <utils/ssh/sshremoteprocessrunner.h>
+
+using namespace Utils;
+
+namespace RemoteLinux {
+namespace Internal {
+
+class AbstractRemoteLinuxPackageInstallerPrivate
+{
+public:
+ AbstractRemoteLinuxPackageInstallerPrivate() : isRunning(false) {}
+
+ bool isRunning;
+ Utils::SshRemoteProcessRunner::Ptr installer;
+};
+
+} // namespace Internal
+
+AbstractRemoteLinuxPackageInstaller::AbstractRemoteLinuxPackageInstaller(QObject *parent)
+ : QObject(parent), m_d(new Internal::AbstractRemoteLinuxPackageInstallerPrivate)
+{
+}
+
+AbstractRemoteLinuxPackageInstaller::~AbstractRemoteLinuxPackageInstaller()
+{
+ delete m_d;
+}
+
+void AbstractRemoteLinuxPackageInstaller::installPackage(const SshConnection::Ptr &connection,
+ const QString &packageFilePath, bool removePackageFile)
+{
+ QTC_ASSERT(connection && connection->state() == SshConnection::Connected
+ && !m_d->isRunning, return);
+
+ prepareInstallation();
+ m_d->installer = SshRemoteProcessRunner::create(connection);
+ connect(m_d->installer.data(), SIGNAL(connectionError(Utils::SshError)),
+ SLOT(handleConnectionError()));
+ connect(m_d->installer.data(), SIGNAL(processOutputAvailable(QByteArray)),
+ SLOT(handleInstallerOutput(QByteArray)));
+ connect(m_d->installer.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
+ SLOT(handleInstallerErrorOutput(QByteArray)));
+ connect(m_d->installer.data(), SIGNAL(processClosed(int)), SLOT(handleInstallationFinished(int)));
+
+ QString cmdLine = installCommandLine(packageFilePath);
+ if (removePackageFile)
+ cmdLine += QLatin1String(" && (rm ") + packageFilePath + QLatin1String(" || :)");
+ m_d->installer->run(cmdLine.toUtf8());
+ m_d->isRunning = true;
+}
+
+void AbstractRemoteLinuxPackageInstaller::cancelInstallation()
+{
+ QTC_ASSERT(m_d->installer && m_d->installer->connection()->state() == SshConnection::Connected
+ && m_d->isRunning, return);
+
+ const SshRemoteProcessRunner::Ptr killProcess
+ = SshRemoteProcessRunner::create(m_d->installer->connection());
+ killProcess->run(cancelInstallationCommandLine().toUtf8());
+ setFinished();
+}
+
+void AbstractRemoteLinuxPackageInstaller::handleConnectionError()
+{
+ if (!m_d->isRunning)
+ return;
+ emit finished(tr("Connection failure: %1").arg(m_d->installer->connection()->errorString()));
+ setFinished();
+}
+
+void AbstractRemoteLinuxPackageInstaller::handleInstallationFinished(int exitStatus)
+{
+ if (!m_d->isRunning)
+ return;
+
+ if (exitStatus != SshRemoteProcess::ExitedNormally
+ || m_d->installer->process()->exitCode() != 0) {
+ emit finished(tr("Installing package failed."));
+ } else if (!errorString().isEmpty()) {
+ emit finished(errorString());
+ } else {
+ emit finished();
+ }
+
+ setFinished();
+}
+
+void AbstractRemoteLinuxPackageInstaller::handleInstallerOutput(const QByteArray &output)
+{
+ emit stdoutData(QString::fromUtf8(output));
+}
+
+void AbstractRemoteLinuxPackageInstaller::handleInstallerErrorOutput(const QByteArray &output)
+{
+ emit stderrData(QString::fromUtf8(output));
+}
+
+void AbstractRemoteLinuxPackageInstaller::setFinished()
+{
+ disconnect(m_d->installer.data(), 0, this, 0);
+ m_d->installer.clear();
+ m_d->isRunning = false;
+}
+
+
+RemoteLinuxTarPackageInstaller::RemoteLinuxTarPackageInstaller(QObject *parent)
+ : AbstractRemoteLinuxPackageInstaller(parent)
+{
+}
+
+QString RemoteLinuxTarPackageInstaller::installCommandLine(const QString &packageFilePath) const
+{
+ return QLatin1String("cd / && tar xvf ") + packageFilePath;
+}
+
+QString RemoteLinuxTarPackageInstaller::cancelInstallationCommandLine() const
+{
+ return QLatin1String("pkill tar");
+}
+
+} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxpackageinstaller.h b/src/plugins/remotelinux/remotelinuxpackageinstaller.h
new file mode 100644
index 0000000000..8f8e33aadf
--- /dev/null
+++ b/src/plugins/remotelinux/remotelinuxpackageinstaller.h
@@ -0,0 +1,103 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+#ifndef REMOTELINUXPACKAGEINSTALLER_H
+#define REMOTELINUXPACKAGEINSTALLER_H
+
+#include "remotelinux_export.h"
+
+#include <QtCore/QObject>
+
+#include <QtCore/QSharedPointer>
+#include <QtCore/QString>
+
+namespace Utils {
+class SshConnection;
+}
+
+namespace RemoteLinux {
+namespace Internal {
+class AbstractRemoteLinuxPackageInstallerPrivate;
+} // namespace Internal
+
+class REMOTELINUX_EXPORT AbstractRemoteLinuxPackageInstaller : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(AbstractRemoteLinuxPackageInstaller)
+public:
+ ~AbstractRemoteLinuxPackageInstaller();
+
+ void installPackage(const QSharedPointer<Utils::SshConnection> &connection,
+ const QString &packageFilePath, bool removePackageFile);
+ void cancelInstallation();
+
+signals:
+ void stdoutData(const QString &output);
+ void stderrData(const QString &output);
+ void finished(const QString &errorMsg = QString());
+
+protected:
+ explicit AbstractRemoteLinuxPackageInstaller(QObject *parent = 0);
+
+private slots:
+ void handleConnectionError();
+ void handleInstallationFinished(int exitStatus);
+ void handleInstallerOutput(const QByteArray &output);
+ void handleInstallerErrorOutput(const QByteArray &output);
+
+private:
+ virtual QString installCommandLine(const QString &packageFilePath) const=0;
+ virtual QString cancelInstallationCommandLine() const=0;
+
+ virtual void prepareInstallation() {}
+ virtual QString errorString() const { return QString(); }
+
+ void setFinished();
+
+ Internal::AbstractRemoteLinuxPackageInstallerPrivate * const m_d;
+};
+
+
+class REMOTELINUX_EXPORT RemoteLinuxTarPackageInstaller : public AbstractRemoteLinuxPackageInstaller
+{
+ Q_OBJECT
+public:
+ RemoteLinuxTarPackageInstaller(QObject *parent = 0);
+
+private:
+ QString installCommandLine(const QString &packageFilePath) const;
+ QString cancelInstallationCommandLine() const;
+};
+
+
+} // namespace RemoteLinux
+
+#endif // REMOTELINUXPACKAGEINSTALLER_H
diff --git a/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp b/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp
index 70f2f8e7bd..c5113b2936 100644
--- a/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp
+++ b/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp
@@ -32,8 +32,8 @@
#include "uploadandinstalltarpackagestep.h"
#include "maemoglobal.h"
-#include "maemopackageinstaller.h"
#include "remotelinuxdeployconfiguration.h"
+#include "remotelinuxpackageinstaller.h"
#include "tarpackagecreationstep.h"
#include <projectexplorer/buildsteplist.h>
@@ -45,10 +45,10 @@ namespace Internal {
class UploadAndInstallTarPackageActionPrivate
{
public:
- UploadAndInstallTarPackageActionPrivate() : installer(new MaemoTarPackageInstaller) { }
+ UploadAndInstallTarPackageActionPrivate() : installer(new RemoteLinuxTarPackageInstaller) { }
~UploadAndInstallTarPackageActionPrivate() { delete installer; }
- MaemoTarPackageInstaller * const installer;
+ RemoteLinuxTarPackageInstaller * const installer;
};
} // namespace Internal
@@ -65,7 +65,7 @@ UploadAndInstallTarPackageService::~UploadAndInstallTarPackageService()
delete m_d;
}
-AbstractMaemoPackageInstaller *UploadAndInstallTarPackageService::packageInstaller() const
+AbstractRemoteLinuxPackageInstaller *UploadAndInstallTarPackageService::packageInstaller() const
{
return m_d->installer;
}
diff --git a/src/plugins/remotelinux/uploadandinstalltarpackagestep.h b/src/plugins/remotelinux/uploadandinstalltarpackagestep.h
index 82c6bfd210..1da5bbcf16 100644
--- a/src/plugins/remotelinux/uploadandinstalltarpackagestep.h
+++ b/src/plugins/remotelinux/uploadandinstalltarpackagestep.h
@@ -36,9 +36,9 @@
#include "abstractremotelinuxdeploystep.h"
namespace RemoteLinux {
+class AbstractRemoteLinuxPackageInstaller;
+
namespace Internal {
-class AbstractMaemoPackageCreationStep;
-class AbstractMaemoPackageInstaller;
class UploadAndInstallTarPackageActionPrivate;
}
@@ -51,7 +51,7 @@ public:
~UploadAndInstallTarPackageService();
private:
- Internal::AbstractMaemoPackageInstaller *packageInstaller() const;
+ AbstractRemoteLinuxPackageInstaller *packageInstaller() const;
Internal::UploadAndInstallTarPackageActionPrivate *m_d;
};