forked from qt-creator/qt-creator
Maemo: Deploy and install packages instead of raw executables.
Reviewed-by: kh1
This commit is contained in:
@@ -134,7 +134,7 @@ bool MaemoPackageCreationStep::createPackage()
|
|||||||
|
|
||||||
if (!QFileInfo(projectDir + QLatin1String("/debian")).exists()) {
|
if (!QFileInfo(projectDir + QLatin1String("/debian")).exists()) {
|
||||||
const QString command = QLatin1String("dh_make -s -n -p ")
|
const QString command = QLatin1String("dh_make -s -n -p ")
|
||||||
% executableFileName() % versionString();
|
% executableFileName().toLower() % versionString();
|
||||||
if (!runCommand(buildProc, command))
|
if (!runCommand(buildProc, command))
|
||||||
return false;
|
return false;
|
||||||
QFile rulesFile(projectDir + QLatin1String("/debian/rules"));
|
QFile rulesFile(projectDir + QLatin1String("/debian/rules"));
|
||||||
@@ -157,8 +157,7 @@ bool MaemoPackageCreationStep::createPackage()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QString targetFile(projectDir % QLatin1String("/debian/")
|
const QString targetFile(projectDir % QLatin1String("/debian/")
|
||||||
% executableFileName().toLower() % QLatin1String("/usr/bin/")
|
% executableFileName().toLower() % executableFilePathOnTarget());
|
||||||
% executableFileName());
|
|
||||||
if (QFile::exists(targetFile)) {
|
if (QFile::exists(targetFile)) {
|
||||||
if (!QFile::remove(targetFile)) {
|
if (!QFile::remove(targetFile)) {
|
||||||
qDebug("Error: Could not remove '%s'", qPrintable(targetFile));
|
qDebug("Error: Could not remove '%s'", qPrintable(targetFile));
|
||||||
@@ -245,27 +244,30 @@ QString MaemoPackageCreationStep::targetRoot() const
|
|||||||
|
|
||||||
bool MaemoPackageCreationStep::packagingNeeded() const
|
bool MaemoPackageCreationStep::packagingNeeded() const
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
// TODO: When the package contents get user-modifiable, we need
|
// TODO: When the package contents get user-modifiable, we need
|
||||||
// to check whether files have been added and/or removed and whether
|
// to check whether files have been added and/or removed and whether
|
||||||
// the newest one is newer than the package.
|
// the newest one is newer than the package.
|
||||||
// For the first check, we should have a switch that the widget sets
|
// For the first check, we should have a switch that the widget sets
|
||||||
// to true when the user has changed the package contents and which
|
// to true when the user has changed the package contents and which
|
||||||
// we set to false after a successful package creation.
|
// we set to false after a successful package creation.
|
||||||
QFileInfo packageInfo(packageFilePath(executable()));
|
QFileInfo packageInfo(packageFilePath());
|
||||||
return !packageInfo.exists()
|
return !packageInfo.exists()
|
||||||
|| packageInfo.lastModified() <= QFileInfo(executable()).lastModified();
|
|| packageInfo.lastModified() <= QFileInfo(executable()).lastModified();
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoPackageCreationStep::packageFilePath(const QString &executableFilePath)
|
QString MaemoPackageCreationStep::packageFilePath() const
|
||||||
{
|
{
|
||||||
return executableFilePath % versionString() % QLatin1String("_armel.deb");
|
QFileInfo execInfo(executable());
|
||||||
|
return execInfo.path() % QDir::separator() % execInfo.fileName().toLower()
|
||||||
|
% versionString() % QLatin1String("_armel.deb");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoPackageCreationStep::versionString()
|
QString MaemoPackageCreationStep::executableFilePathOnTarget() const
|
||||||
|
{
|
||||||
|
return QLatin1String("/usr/bin/") % executableFileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MaemoPackageCreationStep::versionString() const
|
||||||
{
|
{
|
||||||
return QLatin1String("_0.1");
|
return QLatin1String("_0.1");
|
||||||
}
|
}
|
||||||
|
@@ -56,11 +56,13 @@ class Qt4BuildConfiguration;
|
|||||||
|
|
||||||
class MaemoPackageCreationStep : public ProjectExplorer::BuildStep
|
class MaemoPackageCreationStep : public ProjectExplorer::BuildStep
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
friend class MaemoPackageCreationFactory;
|
friend class MaemoPackageCreationFactory;
|
||||||
public:
|
public:
|
||||||
MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig);
|
MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig);
|
||||||
|
|
||||||
static QString packageFilePath(const QString &executableFilePath);
|
QString packageFilePath() const;
|
||||||
|
QString executableFilePathOnTarget() const;
|
||||||
private:
|
private:
|
||||||
MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig,
|
MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig,
|
||||||
MaemoPackageCreationStep *other);
|
MaemoPackageCreationStep *other);
|
||||||
@@ -80,7 +82,7 @@ private:
|
|||||||
QString targetRoot() const;
|
QString targetRoot() const;
|
||||||
bool packagingNeeded() const;
|
bool packagingNeeded() const;
|
||||||
|
|
||||||
static QString versionString();
|
QString versionString() const;
|
||||||
|
|
||||||
static const QLatin1String CreatePackageId;
|
static const QLatin1String CreatePackageId;
|
||||||
};
|
};
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "maemoconstants.h"
|
#include "maemoconstants.h"
|
||||||
#include "maemomanager.h"
|
#include "maemomanager.h"
|
||||||
|
#include "maemopackagecreationstep.h"
|
||||||
#include "maemorunconfigurationwidget.h"
|
#include "maemorunconfigurationwidget.h"
|
||||||
#include "maemotoolchain.h"
|
#include "maemotoolchain.h"
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
|
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||||
#include <qt4projectmanager/qt4project.h>
|
#include <qt4projectmanager/qt4project.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -211,7 +213,8 @@ void MaemoRunConfiguration::getDeployTimesFromMap(const QString &key,
|
|||||||
|
|
||||||
bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host) const
|
bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host) const
|
||||||
{
|
{
|
||||||
return fileNeedsDeployment(executable(), m_lastDeployed.value(host));
|
return fileNeedsDeployment(packageStep()->packageFilePath(),
|
||||||
|
m_lastDeployed.value(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::wasDeployed(const QString &host)
|
void MaemoRunConfiguration::wasDeployed(const QString &host)
|
||||||
@@ -293,6 +296,20 @@ const QString MaemoRunConfiguration::gdbCmd() const
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MaemoPackageCreationStep *MaemoRunConfiguration::packageStep() const
|
||||||
|
{
|
||||||
|
const QList<ProjectExplorer::BuildStep *> &buildSteps
|
||||||
|
= activeQt4BuildConfiguration()->steps(ProjectExplorer::Build);
|
||||||
|
for (int i = buildSteps.count() - 1; i >= 0; --i) {
|
||||||
|
const MaemoPackageCreationStep * const pStep
|
||||||
|
= qobject_cast<MaemoPackageCreationStep *>(buildSteps.at(i));
|
||||||
|
if (pStep)
|
||||||
|
return pStep;
|
||||||
|
}
|
||||||
|
Q_ASSERT(!"Impossible: Maemo run configuration without packaging step.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
QString MaemoRunConfiguration::maddeRoot() const
|
QString MaemoRunConfiguration::maddeRoot() const
|
||||||
{
|
{
|
||||||
if (const MaemoToolChain *tc = toolchain())
|
if (const MaemoToolChain *tc = toolchain())
|
||||||
|
@@ -52,6 +52,7 @@ class Qt4BuildConfiguration;
|
|||||||
class Qt4ProFileNode;
|
class Qt4ProFileNode;
|
||||||
class Qt4Target;
|
class Qt4Target;
|
||||||
|
|
||||||
|
class MaemoPackageCreationStep;
|
||||||
class MaemoRunConfigurationFactory;
|
class MaemoRunConfigurationFactory;
|
||||||
|
|
||||||
class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration
|
class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||||
@@ -75,6 +76,8 @@ public:
|
|||||||
bool debuggingHelpersNeedDeployment(const QString &host) const;
|
bool debuggingHelpersNeedDeployment(const QString &host) const;
|
||||||
void debuggingHelpersDeployed(const QString &host);
|
void debuggingHelpersDeployed(const QString &host);
|
||||||
|
|
||||||
|
const MaemoPackageCreationStep *packageStep() const;
|
||||||
|
|
||||||
QString maddeRoot() const;
|
QString maddeRoot() const;
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
const QString sysRoot() const;
|
const QString sysRoot() const;
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "maemoruncontrol.h"
|
#include "maemoruncontrol.h"
|
||||||
|
|
||||||
|
#include "maemopackagecreationstep.h"
|
||||||
#include "maemosshthread.h"
|
#include "maemosshthread.h"
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
|
|
||||||
@@ -122,7 +124,7 @@ void AbstractMaemoRunControl::startDeployment(bool forDebugging)
|
|||||||
} else {
|
} else {
|
||||||
m_deployables.clear();
|
m_deployables.clear();
|
||||||
if (m_runConfig->currentlyNeedsDeployment(m_devConfig.host)) {
|
if (m_runConfig->currentlyNeedsDeployment(m_devConfig.host)) {
|
||||||
m_deployables.append(Deployable(executableFileName(),
|
m_deployables.append(Deployable(packageFileName(),
|
||||||
QFileInfo(executableOnHost()).canonicalPath(),
|
QFileInfo(executableOnHost()).canonicalPath(),
|
||||||
&MaemoRunConfiguration::wasDeployed));
|
&MaemoRunConfiguration::wasDeployed));
|
||||||
}
|
}
|
||||||
@@ -181,6 +183,21 @@ bool AbstractMaemoRunControl::isDeploying() const
|
|||||||
return m_sshDeployer && m_sshDeployer->isRunning();
|
return m_sshDeployer && m_sshDeployer->isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AbstractMaemoRunControl::packageFileName() const
|
||||||
|
{
|
||||||
|
return QFileInfo(packageFilePath()).fileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AbstractMaemoRunControl::packageFilePath() const
|
||||||
|
{
|
||||||
|
return m_runConfig->packageStep()->packageFilePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AbstractMaemoRunControl::executableFilePathOnTarget() const
|
||||||
|
{
|
||||||
|
return m_runConfig->packageStep()->executableFilePathOnTarget();
|
||||||
|
}
|
||||||
|
|
||||||
bool AbstractMaemoRunControl::isCleaning() const
|
bool AbstractMaemoRunControl::isCleaning() const
|
||||||
{
|
{
|
||||||
return m_initialCleaner && m_initialCleaner->isRunning();
|
return m_initialCleaner && m_initialCleaner->isRunning();
|
||||||
@@ -277,13 +294,6 @@ const QString AbstractMaemoRunControl::executableOnHost() const
|
|||||||
return m_runConfig->executable();
|
return m_runConfig->executable();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString AbstractMaemoRunControl::sshPort() const
|
|
||||||
{
|
|
||||||
return m_devConfig.type == MaemoDeviceConfig::Physical
|
|
||||||
? QString::number(m_devConfig.sshPort)
|
|
||||||
: m_runConfig->simulatorSshPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString AbstractMaemoRunControl::executableFileName() const
|
const QString AbstractMaemoRunControl::executableFileName() const
|
||||||
{
|
{
|
||||||
return QFileInfo(executableOnHost()).fileName();
|
return QFileInfo(executableOnHost()).fileName();
|
||||||
@@ -294,34 +304,27 @@ const QString AbstractMaemoRunControl::remoteDir() const
|
|||||||
return homeDirOnDevice(m_devConfig.uname);
|
return homeDirOnDevice(m_devConfig.uname);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList AbstractMaemoRunControl::options() const
|
QString AbstractMaemoRunControl::remoteSudo() const
|
||||||
{
|
{
|
||||||
const bool usePassword
|
return QLatin1String("/usr/lib/mad-developer/devrootsh");
|
||||||
= m_devConfig.authentication == MaemoDeviceConfig::Password;
|
|
||||||
const QLatin1String opt("-o");
|
|
||||||
QStringList optionList;
|
|
||||||
if (!usePassword)
|
|
||||||
optionList << QLatin1String("-i") << m_devConfig.keyFile;
|
|
||||||
return optionList << opt
|
|
||||||
<< QString::fromLatin1("PasswordAuthentication=%1").
|
|
||||||
arg(usePassword ? "yes" : "no") << opt
|
|
||||||
<< QString::fromLatin1("PubkeyAuthentication=%1").
|
|
||||||
arg(usePassword ? "no" : "yes") << opt
|
|
||||||
<< QString::fromLatin1("ConnectTimeout=%1").arg(m_devConfig.timeout)
|
|
||||||
<< opt << QLatin1String("CheckHostIP=no")
|
|
||||||
<< opt << QLatin1String("StrictHostKeyChecking=no");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString AbstractMaemoRunControl::executableOnTarget() const
|
QString AbstractMaemoRunControl::remoteInstallCommand() const
|
||||||
{
|
{
|
||||||
return QString::fromLocal8Bit("%1/%2").arg(remoteDir()).
|
return QString::fromLocal8Bit("%1 dpkg -i %2").arg(remoteSudo())
|
||||||
arg(executableFileName());
|
.arg(packageFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString AbstractMaemoRunControl::targetCmdLinePrefix() const
|
const QString AbstractMaemoRunControl::targetCmdLinePrefix() const
|
||||||
{
|
{
|
||||||
return QString::fromLocal8Bit("chmod u+x %1; source /etc/profile; ").
|
return QString::fromLocal8Bit("%1 && %2 chmod u+x %3 && source /etc/profile && ")
|
||||||
arg(executableOnTarget());
|
.arg(remoteInstallCommand()).arg(remoteSudo())
|
||||||
|
.arg(executableFilePathOnTarget());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AbstractMaemoRunControl::targetCmdLineSuffix() const
|
||||||
|
{
|
||||||
|
return m_runConfig->arguments().join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractMaemoRunControl::handleError(const QString &errString)
|
void AbstractMaemoRunControl::handleError(const QString &errString)
|
||||||
@@ -348,9 +351,8 @@ void MaemoRunControl::startInternal()
|
|||||||
|
|
||||||
QString MaemoRunControl::remoteCall() const
|
QString MaemoRunControl::remoteCall() const
|
||||||
{
|
{
|
||||||
return QString::fromLocal8Bit("%1 %2 %3")
|
return QString::fromLocal8Bit("%1 %2 %3").arg(targetCmdLinePrefix())
|
||||||
.arg(targetCmdLinePrefix()).arg(executableOnTarget())
|
.arg(executableFilePathOnTarget()).arg(targetCmdLineSuffix());
|
||||||
.arg(m_runConfig->arguments().join(" "));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunControl::stopInternal()
|
void MaemoRunControl::stopInternal()
|
||||||
@@ -407,7 +409,7 @@ QString MaemoDebugRunControl::remoteCall() const
|
|||||||
{
|
{
|
||||||
return QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4")
|
return QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4")
|
||||||
.arg(targetCmdLinePrefix()).arg(gdbServerPort())
|
.arg(targetCmdLinePrefix()).arg(gdbServerPort())
|
||||||
.arg(executableOnTarget()).arg(m_runConfig->arguments().join(" "));
|
.arg(executableFilePathOnTarget()).arg(targetCmdLineSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDebugRunControl::handleRemoteOutput(const QString &output)
|
void MaemoDebugRunControl::handleRemoteOutput(const QString &output)
|
||||||
|
@@ -77,12 +77,14 @@ protected:
|
|||||||
void startExecution();
|
void startExecution();
|
||||||
void handleError(const QString &errString);
|
void handleError(const QString &errString);
|
||||||
const QString executableOnHost() const;
|
const QString executableOnHost() const;
|
||||||
const QString executableOnTarget() const;
|
|
||||||
const QString executableFileName() const;
|
const QString executableFileName() const;
|
||||||
const QString sshPort() const;
|
|
||||||
const QString targetCmdLinePrefix() const;
|
const QString targetCmdLinePrefix() const;
|
||||||
|
QString targetCmdLineSuffix() const;
|
||||||
const QString remoteDir() const;
|
const QString remoteDir() const;
|
||||||
const QStringList options() const;
|
QString packageFileName() const;
|
||||||
|
QString packageFilePath() const;
|
||||||
|
QString executableFilePathOnTarget() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
virtual void handleRemoteOutput(const QString &output)=0;
|
virtual void handleRemoteOutput(const QString &output)=0;
|
||||||
void handleInitialCleanupFinished();
|
void handleInitialCleanupFinished();
|
||||||
@@ -98,10 +100,13 @@ private:
|
|||||||
virtual void startInternal()=0;
|
virtual void startInternal()=0;
|
||||||
virtual void stopInternal()=0;
|
virtual void stopInternal()=0;
|
||||||
virtual QString remoteCall() const=0;
|
virtual QString remoteCall() const=0;
|
||||||
|
|
||||||
void startInitialCleanup();
|
void startInitialCleanup();
|
||||||
void killRemoteProcesses(const QStringList &apps, bool initialCleanup);
|
void killRemoteProcesses(const QStringList &apps, bool initialCleanup);
|
||||||
bool isCleaning() const;
|
bool isCleaning() const;
|
||||||
bool isDeploying() const;
|
bool isDeploying() const;
|
||||||
|
QString remoteSudo() const;
|
||||||
|
QString remoteInstallCommand() const;
|
||||||
|
|
||||||
QFutureInterface<void> m_progress;
|
QFutureInterface<void> m_progress;
|
||||||
QScopedPointer<MaemoSshDeployer> m_sshDeployer;
|
QScopedPointer<MaemoSshDeployer> m_sshDeployer;
|
||||||
|
Reference in New Issue
Block a user