Maemo: Deploy to sysroot.

This commit is contained in:
Christian Kandeler
2010-08-20 12:50:10 +02:00
parent 8e170c97bf
commit 6bf5f7340f
7 changed files with 211 additions and 89 deletions

View File

@@ -65,6 +65,7 @@ static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts");
static const QLatin1String LastDeployedFilesKey(PREFIX ".LastDeployedFiles"); static const QLatin1String LastDeployedFilesKey(PREFIX ".LastDeployedFiles");
static const QLatin1String LastDeployedRemotePathsKey(PREFIX ".LastDeployedRemotePaths"); static const QLatin1String LastDeployedRemotePathsKey(PREFIX ".LastDeployedRemotePaths");
static const QLatin1String LastDeployedTimesKey(PREFIX ".LastDeployedTimes"); static const QLatin1String LastDeployedTimesKey(PREFIX ".LastDeployedTimes");
static const QLatin1String DeployToSysrootKey(PREFIX ".DeployToSysroot");
static const QLatin1String ProFileKey(PREFIX ".ProFile"); static const QLatin1String ProFileKey(PREFIX ".ProFile");
static const QLatin1String ExportedLocalDirsKey(PREFIX ".ExportedLocalDirs"); static const QLatin1String ExportedLocalDirsKey(PREFIX ".ExportedLocalDirs");
static const QLatin1String RemoteMountPointsKey(PREFIX ".RemoteMountPoints"); static const QLatin1String RemoteMountPointsKey(PREFIX ".RemoteMountPoints");

View File

@@ -93,6 +93,13 @@ void MaemoDeployStep::ctor()
m_deviceConfigModel = new MaemoDeviceConfigListModel(this); m_deviceConfigModel = new MaemoDeviceConfigListModel(this);
#ifdef DEPLOY_VIA_MOUNT #ifdef DEPLOY_VIA_MOUNT
m_canStart = true; m_canStart = true;
m_sysrootInstaller = new QProcess(this);
connect(m_sysrootInstaller, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(handleSysrootInstallerFinished()));
connect(m_sysrootInstaller, SIGNAL(readyReadStandardOutput()), this,
SLOT(handleSysrootInstallerOutput()));
connect(m_sysrootInstaller, SIGNAL(readyReadStandardError()), this,
SLOT(handleSysrootInstallerErrorOutput()));
m_cleanupTimer = new QTimer(this); m_cleanupTimer = new QTimer(this);
m_cleanupTimer->setSingleShot(true); m_cleanupTimer->setSingleShot(true);
connect(m_cleanupTimer, SIGNAL(timeout()), this, connect(m_cleanupTimer, SIGNAL(timeout()), this,
@@ -134,6 +141,9 @@ QVariantMap MaemoDeployStep::toMap() const
{ {
QVariantMap map(BuildStep::toMap()); QVariantMap map(BuildStep::toMap());
addDeployTimesToMap(map); addDeployTimesToMap(map);
#ifdef DEPLOY_VIA_MOUNT
map.insert(DeployToSysrootKey, m_deployToSysroot);
#endif
map.unite(m_deviceConfigModel->toMap()); map.unite(m_deviceConfigModel->toMap());
return map; return map;
} }
@@ -163,6 +173,9 @@ bool MaemoDeployStep::fromMap(const QVariantMap &map)
return false; return false;
getDeployTimesFromMap(map); getDeployTimesFromMap(map);
m_deviceConfigModel->fromMap(map); m_deviceConfigModel->fromMap(map);
#ifdef DEPLOY_VIA_MOUNT
m_deployToSysroot = map.value(DeployToSysrootKey, true).toBool();
#endif
return true; return true;
} }
@@ -201,8 +214,7 @@ void MaemoDeployStep::raiseError(const QString &errorString)
emit error(); emit error();
} }
void MaemoDeployStep::writeOutput(const QString &text, void MaemoDeployStep::writeOutput(const QString &text, OutputFormat format)
BuildStep::OutputFormat format)
{ {
emit addOutput(text, format); emit addOutput(text, format);
} }
@@ -214,10 +226,10 @@ void MaemoDeployStep::stop()
return; return;
if (m_connecting || m_needsInstall || !m_filesToCopy.isEmpty() if (m_connecting || m_needsInstall || !m_filesToCopy.isEmpty()
|| (m_installer && m_installer->isRunning()) || (m_deviceInstaller && m_deviceInstaller->isRunning())
|| m_currentDeployAction) { || m_currentDeployAction) {
if (m_connection && m_connection->state() == SshConnection::Connected if (m_connection && m_connection->state() == SshConnection::Connected
&& ((m_installer && m_installer->isRunning()) && ((m_deviceInstaller && m_deviceInstaller->isRunning())
|| m_currentDeployAction)) { || m_currentDeployAction)) {
const QByteArray programToKill const QByteArray programToKill
= m_currentDeployAction ? "cp" : "dpkg"; = m_currentDeployAction ? "cp" : "dpkg";
@@ -228,17 +240,21 @@ void MaemoDeployStep::stop()
killProc->start(); killProc->start();
} }
m_stopped = true; m_stopped = true;
m_unmountState = CurrentMountsUnmount;
m_canStart = false; m_canStart = false;
m_needsInstall = false; m_needsInstall = false;
m_filesToCopy.clear(); m_filesToCopy.clear();
m_connecting = false; m_connecting = false;
m_sysrootInstaller->terminate();
m_sysrootInstaller->waitForFinished(500);
m_sysrootInstaller->kill();
m_cleanupTimer->start(5000); m_cleanupTimer->start(5000);
m_mounter->stop(); m_mounter->stop();
} }
#else #else
m_stopped = true; m_stopped = true;
if (m_installer && m_installer->isRunning()) { if (m_deviceInstaller && m_deviceInstaller->isRunning()) {
disconnect(m_installer.data(), 0, this, 0); disconnect(m_deviceInstaller.data(), 0, this, 0);
} }
else if (!m_uploadsInProgress.isEmpty() || !m_linksInProgress.isEmpty()) { else if (!m_uploadsInProgress.isEmpty() || !m_linksInProgress.isEmpty()) {
m_uploadsInProgress.clear(); m_uploadsInProgress.clear();
@@ -348,6 +364,7 @@ void MaemoDeployStep::handleConnected()
} }
if (m_needsInstall || !m_filesToCopy.isEmpty()) { if (m_needsInstall || !m_filesToCopy.isEmpty()) {
m_unmountState = OldDirsUnmount;
m_mounter->setConnection(m_connection); m_mounter->setConnection(m_connection);
m_mounter->unmount(); // Clean up potential remains. m_mounter->unmount(); // Clean up potential remains.
} else { } else {
@@ -513,15 +530,15 @@ void MaemoDeployStep::handleLinkProcessFinished(int exitStatus)
= QFileInfo(packagingStep()->packageFilePath()).fileName(); = QFileInfo(packagingStep()->packageFilePath()).fileName();
const QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() const QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8()
+ " dpkg -i " + packageFileName.toUtf8(); + " dpkg -i " + packageFileName.toUtf8();
m_installer = m_connection->createRemoteProcess(cmd); m_deviceInstaller = m_connection->createRemoteProcess(cmd);
connect(m_installer.data(), SIGNAL(closed(int)), this, connect(m_deviceInstaller.data(), SIGNAL(closed(int)), this,
SLOT(handleInstallationFinished(int))); SLOT(handleInstallationFinished(int)));
connect(m_installer.data(), SIGNAL(outputAvailable(QByteArray)), connect(m_deviceInstaller.data(), SIGNAL(outputAvailable(QByteArray)),
this, SLOT(handleInstallerOutput(QByteArray))); this, SLOT(handleDeviceInstallerOutput(QByteArray)));
connect(m_installer.data(), connect(m_deviceInstaller.data(),
SIGNAL(errorOutputAvailable(QByteArray)), this, SIGNAL(errorOutputAvailable(QByteArray)), this,
SLOT(handleInstallerErrorOutput(QByteArray))); SLOT(handleDeviceInstallerErrorOutput(QByteArray)));
m_installer->start(); m_deviceInstaller->start();
} else { } else {
emit done(); emit done();
} }
@@ -538,20 +555,10 @@ void MaemoDeployStep::handleMounted()
} }
if (m_needsInstall) { if (m_needsInstall) {
writeOutput(tr("Installing package ...")); if (m_deployToSysroot)
const QString packageFileName installToSysroot();
= QFileInfo(packagingStep()->packageFilePath()).fileName(); else
const QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + " dpkg -i " installToDevice();
+ deployMountPoint().toUtf8() + '/' + packageFileName.toUtf8();
m_installer = m_connection->createRemoteProcess(cmd);
connect(m_installer.data(), SIGNAL(closed(int)), this,
SLOT(handleInstallationFinished(int)));
connect(m_installer.data(), SIGNAL(outputAvailable(QByteArray)),
this, SLOT(handleInstallerOutput(QByteArray)));
connect(m_installer.data(),
SIGNAL(errorOutputAvailable(QByteArray)), this,
SLOT(handleInstallerErrorOutput(QByteArray)));
m_installer->start();
} else { } else {
deployNextFile(); deployNextFile();
} }
@@ -559,58 +566,66 @@ void MaemoDeployStep::handleMounted()
void MaemoDeployStep::handleUnmounted() void MaemoDeployStep::handleUnmounted()
{ {
m_mounter->resetMountSpecifications();
if (m_stopped) { if (m_stopped) {
m_mounter->resetMountSpecifications();
m_canStart = true; m_canStart = true;
return; return;
} }
if (m_needsInstall || !m_filesToCopy.isEmpty()) { if (m_unmountState == CurrentDirsUnmount) {
m_mounter->setPortList(deviceConfig().freePorts());
if (m_needsInstall) {
const QString localDir = QFileInfo(packagingStep()->packageFilePath())
.absolutePath();
const MaemoMountSpecification mountSpec(localDir,
deployMountPoint());
if (!addMountSpecification(mountSpec))
return;
} else {
#ifdef Q_OS_WIN
bool drivesToMount[26];
for (int i = 0; i < sizeof drivesToMount / sizeof drivesToMount[0]; ++i)
drivesToMount[i] = false;
for (int i = 0; i < m_filesToCopy.count(); ++i) {
const QString localDir = QFileInfo(m_filesToCopy.at(i).localFilePath)
.canonicalPath();
const char driveLetter = localDir.at(0).toLower().toLatin1();
if (driveLetter < 'a' || driveLetter > 'z') {
qWarning("Weird: drive letter is '%c'.", driveLetter);
continue;
}
const int index = driveLetter - 'a';
if (drivesToMount[index])
continue;
const QString mountPoint = deployMountPoint()
+ QLatin1Char('/') + QLatin1Char(driveLetter);
const MaemoMountSpecification mountSpec(localDir.left(3),
mountPoint);
if (!addMountSpecification(mountSpec))
return;
drivesToMount[index] = true;
}
#else
if (!addMountSpecification(MaemoMountSpecification(QLatin1String("/"),
deployMountPoint())))
return;
#endif
}
m_mounter->mount(); m_mounter->mount();
} else { return;
}
if (m_unmountState == CurrentMountsUnmount) {
writeOutput(tr("Deployment finished.")); writeOutput(tr("Deployment finished."));
emit done(); emit done();
return;
} }
Q_ASSERT(m_needsInstall || !m_filesToCopy.isEmpty());
m_mounter->resetMountSpecifications();
m_mounter->setPortList(deviceConfig().freePorts());
if (m_needsInstall) {
const QString localDir
= QFileInfo(packagingStep()->packageFilePath()).absolutePath();
const MaemoMountSpecification mountSpec(localDir, deployMountPoint());
if (!addMountSpecification(mountSpec))
return;
} else {
#ifdef Q_OS_WIN
bool drivesToMount[26];
for (int i = 0; i < sizeof drivesToMount / sizeof drivesToMount[0]; ++i)
drivesToMount[i] = false;
for (int i = 0; i < m_filesToCopy.count(); ++i) {
const QString localDir
= QFileInfo(m_filesToCopy.at(i).localFilePath).canonicalPath();
const char driveLetter = localDir.at(0).toLower().toLatin1();
if (driveLetter < 'a' || driveLetter > 'z') {
qWarning("Weird: drive letter is '%c'.", driveLetter);
continue;
}
const int index = driveLetter - 'a';
if (drivesToMount[index])
continue;
const QString mountPoint = deployMountPoint() + QLatin1Char('/')
+ QLatin1Char(driveLetter);
const MaemoMountSpecification mountSpec(localDir.left(3),
mountPoint);
if (!addMountSpecification(mountSpec))
return;
drivesToMount[index] = true;
}
#else
if (!addMountSpecification(MaemoMountSpecification(QLatin1String("/"),
deployMountPoint())))
return;
#endif
}
m_unmountState = CurrentDirsUnmount;
m_mounter->unmount();
} }
void MaemoDeployStep::handleMountError(const QString &errorMsg) void MaemoDeployStep::handleMountError(const QString &errorMsg)
@@ -621,6 +636,49 @@ void MaemoDeployStep::handleMountError(const QString &errorMsg)
raiseError(errorMsg); raiseError(errorMsg);
} }
void MaemoDeployStep::installToSysroot()
{
writeOutput(tr("Installing package to sysroot ..."));
const MaemoToolChain * const tc = toolChain();
const QStringList args = QStringList() << QLatin1String("-t")
<< tc->targetName() << QLatin1String("xdpkg") << QLatin1String("-i")
<< packagingStep()->packageFilePath();
m_sysrootInstaller->start(tc->madAdminCommand(), args);
if (!m_sysrootInstaller->waitForStarted()) {
writeOutput(tr("Installation to sysroot failed, continuing anyway."),
ErrorMessageOutput);
installToDevice();
}
}
void MaemoDeployStep::handleSysrootInstallerFinished()
{
if (m_sysrootInstaller->error() != QProcess::UnknownError
|| m_sysrootInstaller->exitCode() != 0) {
writeOutput(tr("Installation to sysroot failed, continuing anyway."),
ErrorMessageOutput);
}
installToDevice();
}
void MaemoDeployStep::installToDevice()
{
writeOutput(tr("Installing package to device..."));
const QString packageFileName
= QFileInfo(packagingStep()->packageFilePath()).fileName();
const QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + " dpkg -i "
+ deployMountPoint().toUtf8() + '/' + packageFileName.toUtf8();
m_deviceInstaller = m_connection->createRemoteProcess(cmd);
connect(m_deviceInstaller.data(), SIGNAL(closed(int)), this,
SLOT(handleInstallationFinished(int)));
connect(m_deviceInstaller.data(), SIGNAL(outputAvailable(QByteArray)),
this, SLOT(handleDeviceInstallerOutput(QByteArray)));
connect(m_deviceInstaller.data(),
SIGNAL(errorOutputAvailable(QByteArray)), this,
SLOT(handleDeviceInstallerErrorOutput(QByteArray)));
m_deviceInstaller->start();
}
void MaemoDeployStep::handleProgressReport(const QString &progressMsg) void MaemoDeployStep::handleProgressReport(const QString &progressMsg)
{ {
writeOutput(progressMsg); writeOutput(progressMsg);
@@ -640,13 +698,15 @@ void MaemoDeployStep::deployNextFile()
sourceFilePath += d.localFilePath; sourceFilePath += d.localFilePath;
#endif #endif
// TODO: Copy file to sysroot
QString command = QString::fromLatin1("%1 cp -r %2 %3") QString command = QString::fromLatin1("%1 cp -r %2 %3")
.arg(MaemoGlobal::remoteSudo(), sourceFilePath, .arg(MaemoGlobal::remoteSudo(), sourceFilePath,
d.remoteDir + QLatin1Char('/')); d.remoteDir + QLatin1Char('/'));
SshRemoteProcess::Ptr copyProcess SshRemoteProcess::Ptr copyProcess
= m_connection->createRemoteProcess(command.toUtf8()); = m_connection->createRemoteProcess(command.toUtf8());
connect(copyProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)), connect(copyProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)),
this, SLOT(handleInstallerErrorOutput(QByteArray))); this, SLOT(handleDeviceInstallerErrorOutput(QByteArray)));
connect(copyProcess.data(), SIGNAL(closed(int)), this, connect(copyProcess.data(), SIGNAL(closed(int)), this,
SLOT(handleCopyProcessFinished(int))); SLOT(handleCopyProcessFinished(int)));
m_currentDeployAction.reset(new DeployAction(d, copyProcess)); m_currentDeployAction.reset(new DeployAction(d, copyProcess));
@@ -685,6 +745,7 @@ void MaemoDeployStep::handleCopyProcessFinished(int exitStatus)
m_currentDeployAction.reset(0); m_currentDeployAction.reset(0);
if (m_filesToCopy.isEmpty()) { if (m_filesToCopy.isEmpty()) {
writeOutput(tr("All files copied.")); writeOutput(tr("All files copied."));
m_unmountState = CurrentMountsUnmount;
m_mounter->unmount(); m_mounter->unmount();
} else { } else {
deployNextFile(); deployNextFile();
@@ -699,8 +760,8 @@ void MaemoDeployStep::handleCleanupTimeout()
"explicitly enabling re-start.", Q_FUNC_INFO); "explicitly enabling re-start.", Q_FUNC_INFO);
m_canStart = true; m_canStart = true;
disconnect(m_connection.data(), 0, this, 0); disconnect(m_connection.data(), 0, this, 0);
if (m_installer) if (m_deviceInstaller)
disconnect(m_installer.data(), 0, this, 0); disconnect(m_deviceInstaller.data(), 0, this, 0);
if (m_currentDeployAction) if (m_currentDeployAction)
disconnect(m_currentDeployAction->second.data(), 0, this, 0); disconnect(m_currentDeployAction->second.data(), 0, this, 0);
} }
@@ -711,6 +772,29 @@ QString MaemoDeployStep::deployMountPoint() const
return MaemoGlobal::homeDirOnDevice(deviceConfig().server.uname) return MaemoGlobal::homeDirOnDevice(deviceConfig().server.uname)
+ QLatin1String("/deployMountPoint"); + QLatin1String("/deployMountPoint");
} }
const MaemoToolChain *MaemoDeployStep::toolChain() const
{
const Qt4BuildConfiguration * const bc
= static_cast<Qt4BuildConfiguration *>(buildConfiguration());
return static_cast<MaemoToolChain *>(bc->toolChain());
}
void MaemoDeployStep::handleSysrootInstallerOutput()
{
if (!m_stopped) {
writeOutput(QString::fromLocal8Bit(m_sysrootInstaller->readAllStandardOutput()),
NormalOutput);
}
}
void MaemoDeployStep::handleSysrootInstallerErrorOutput()
{
if (!m_stopped) {
writeOutput(QString::fromLocal8Bit(m_sysrootInstaller->readAllStandardError()),
BuildStep::ErrorOutput);
}
}
#endif #endif
void MaemoDeployStep::handleInstallationFinished(int exitStatus) void MaemoDeployStep::handleInstallationFinished(int exitStatus)
@@ -722,7 +806,7 @@ void MaemoDeployStep::handleInstallationFinished(int exitStatus)
} }
if (exitStatus != SshRemoteProcess::ExitedNormally if (exitStatus != SshRemoteProcess::ExitedNormally
|| m_installer->exitCode() != 0) { || m_deviceInstaller->exitCode() != 0) {
raiseError(tr("Installing package failed.")); raiseError(tr("Installing package failed."));
} else { } else {
m_needsInstall = false; m_needsInstall = false;
@@ -730,13 +814,14 @@ void MaemoDeployStep::handleInstallationFinished(int exitStatus)
MaemoDeployable(packagingStep()->packageFilePath(), QString())); MaemoDeployable(packagingStep()->packageFilePath(), QString()));
writeOutput(tr("Package installed.")); writeOutput(tr("Package installed."));
} }
m_unmountState = CurrentMountsUnmount;
m_mounter->unmount(); m_mounter->unmount();
#else #else
if (m_stopped) if (m_stopped)
return; return;
if (exitStatus != SshRemoteProcess::ExitedNormally if (exitStatus != SshRemoteProcess::ExitedNormally
|| m_installer->exitCode() != 0) { || m_deviceInstaller->exitCode() != 0) {
raiseError(tr("Installing package failed.")); raiseError(tr("Installing package failed."));
} else { } else {
writeOutput(tr("Package installation finished.")); writeOutput(tr("Package installation finished."));
@@ -745,17 +830,16 @@ void MaemoDeployStep::handleInstallationFinished(int exitStatus)
#endif #endif
} }
void MaemoDeployStep::handleInstallerOutput(const QByteArray &output) void MaemoDeployStep::handleDeviceInstallerOutput(const QByteArray &output)
{ {
writeOutput(QString::fromUtf8(output)); writeOutput(QString::fromUtf8(output), NormalOutput);
} }
void MaemoDeployStep::handleInstallerErrorOutput(const QByteArray &output) void MaemoDeployStep::handleDeviceInstallerErrorOutput(const QByteArray &output)
{ {
writeOutput(output, BuildStep::ErrorOutput); writeOutput(QString::fromUtf8(output), ErrorOutput);
} }
MaemoDeployEventHandler::MaemoDeployEventHandler(MaemoDeployStep *deployStep, MaemoDeployEventHandler::MaemoDeployEventHandler(MaemoDeployStep *deployStep,
QFutureInterface<bool> &future) QFutureInterface<bool> &future)
: m_deployStep(deployStep), m_future(future), m_eventLoop(new QEventLoop) : m_deployStep(deployStep), m_future(future), m_eventLoop(new QEventLoop)

View File

@@ -48,6 +48,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QEventLoop; class QEventLoop;
#ifdef DEPLOY_VIA_MOUNT #ifdef DEPLOY_VIA_MOUNT
class QProcess;
class QTimer; class QTimer;
#endif #endif
QT_END_NAMESPACE QT_END_NAMESPACE
@@ -68,6 +69,7 @@ class MaemoRemoteMounter;
class MaemoDeployables; class MaemoDeployables;
class MaemoDeviceConfigListModel; class MaemoDeviceConfigListModel;
class MaemoPackageCreationStep; class MaemoPackageCreationStep;
class MaemoToolChain;
class MaemoDeployStep : public ProjectExplorer::BuildStep class MaemoDeployStep : public ProjectExplorer::BuildStep
{ {
@@ -85,6 +87,11 @@ public:
MaemoDeployables *deployables() const { return m_deployables; } MaemoDeployables *deployables() const { return m_deployables; }
QSharedPointer<Core::SshConnection> sshConnection() const { return m_connection; } QSharedPointer<Core::SshConnection> sshConnection() const { return m_connection; }
#ifdef DEPLOY_VIA_MOUNT
bool deployToSysroot() const { return m_deployToSysroot; }
void setDeployToSysroot(bool deploy) { m_deployToSysroot = deploy; }
#endif
signals: signals:
void done(); void done();
void error(); void error();
@@ -101,6 +108,9 @@ private slots:
void handleProgressReport(const QString &progressMsg); void handleProgressReport(const QString &progressMsg);
void handleCopyProcessFinished(int exitStatus); void handleCopyProcessFinished(int exitStatus);
void handleCleanupTimeout(); void handleCleanupTimeout();
void handleSysrootInstallerFinished();
void handleSysrootInstallerOutput();
void handleSysrootInstallerErrorOutput();
#else #else
void handleSftpChannelInitialized(); void handleSftpChannelInitialized();
void handleSftpChannelInitializationFailed(const QString &error); void handleSftpChannelInitializationFailed(const QString &error);
@@ -108,8 +118,8 @@ private slots:
void handleLinkProcessFinished(int exitStatus); void handleLinkProcessFinished(int exitStatus);
#endif #endif
void handleInstallationFinished(int exitStatus); void handleInstallationFinished(int exitStatus);
void handleInstallerOutput(const QByteArray &output); void handleDeviceInstallerOutput(const QByteArray &output);
void handleInstallerErrorOutput(const QByteArray &output); void handleDeviceInstallerErrorOutput(const QByteArray &output);
private: private:
MaemoDeployStep(ProjectExplorer::BuildStepList *bc, MaemoDeployStep(ProjectExplorer::BuildStepList *bc,
@@ -123,19 +133,19 @@ private:
void ctor(); void ctor();
void raiseError(const QString &error); void raiseError(const QString &error);
void writeOutput(const QString &text, ProjectExplorer::BuildStep::OutputFormat = BuildStep::NormalOutput); void writeOutput(const QString &text, OutputFormat = MessageOutput);
void addDeployTimesToMap(QVariantMap &map) const; void addDeployTimesToMap(QVariantMap &map) const;
void getDeployTimesFromMap(const QVariantMap &map); void getDeployTimesFromMap(const QVariantMap &map);
const MaemoPackageCreationStep *packagingStep() const; const MaemoPackageCreationStep *packagingStep() const;
#ifdef DEPLOY_VIA_MOUNT #ifdef DEPLOY_VIA_MOUNT
QString deployMountPoint() const; QString deployMountPoint() const;
const MaemoToolChain *toolChain() const;
void deployNextFile(); void deployNextFile();
bool addMountSpecification(const MaemoMountSpecification &mountSpec); bool addMountSpecification(const MaemoMountSpecification &mountSpec);
void installToSysroot();
void installToDevice();
#else #else
bool deploy(const MaemoDeployable &deployable); bool deploy(const MaemoDeployable &deployable);
#endif
#ifndef DEPLOY_VIA_MOUNT
QString uploadDir() const; QString uploadDir() const;
#endif #endif
@@ -144,19 +154,23 @@ private:
MaemoDeployables * const m_deployables; MaemoDeployables * const m_deployables;
QSharedPointer<Core::SshConnection> m_connection; QSharedPointer<Core::SshConnection> m_connection;
#ifdef DEPLOY_VIA_MOUNT #ifdef DEPLOY_VIA_MOUNT
QProcess *m_sysrootInstaller;
typedef QPair<MaemoDeployable, QSharedPointer<Core::SshRemoteProcess> > DeployAction; typedef QPair<MaemoDeployable, QSharedPointer<Core::SshRemoteProcess> > DeployAction;
QScopedPointer<DeployAction> m_currentDeployAction; QScopedPointer<DeployAction> m_currentDeployAction;
QList<MaemoDeployable> m_filesToCopy; QList<MaemoDeployable> m_filesToCopy;
MaemoRemoteMounter *m_mounter; MaemoRemoteMounter *m_mounter;
QTimer *m_cleanupTimer; QTimer *m_cleanupTimer;
bool m_canStart; bool m_canStart;
bool m_deployToSysroot;
enum UnmountState { OldDirsUnmount, CurrentDirsUnmount, CurrentMountsUnmount };
UnmountState m_unmountState;
#else #else
QSharedPointer<Core::SftpChannel> m_uploader; QSharedPointer<Core::SftpChannel> m_uploader;
typedef QPair<MaemoDeployable, QString> DeployInfo; typedef QPair<MaemoDeployable, QString> DeployInfo;
QMap<Core::SftpJobId, DeployInfo> m_uploadsInProgress; QMap<Core::SftpJobId, DeployInfo> m_uploadsInProgress;
QMap<QSharedPointer<Core::SshRemoteProcess>, MaemoDeployable> m_linksInProgress; QMap<QSharedPointer<Core::SshRemoteProcess>, MaemoDeployable> m_linksInProgress;
#endif #endif
QSharedPointer<Core::SshRemoteProcess> m_installer; QSharedPointer<Core::SshRemoteProcess> m_deviceInstaller;
bool m_stopped; bool m_stopped;
bool m_needsInstall; bool m_needsInstall;

View File

@@ -39,6 +39,13 @@ void MaemoDeployStepWidget::init()
this, SLOT(handleDeviceConfigModelChanged())); this, SLOT(handleDeviceConfigModelChanged()));
connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this, connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
SLOT(setCurrentDeviceConfig(int))); SLOT(setCurrentDeviceConfig(int)));
#ifdef DEPLOY_VIA_MOUNT
ui->deployToSysrootCheckBox->setChecked(m_step->deployToSysroot());
connect(ui->deployToSysrootCheckBox, SIGNAL(toggled(bool)), this,
SLOT(setDeployToSysroot(bool)));
#else
ui->deployToSysrootCheckBox->hide();
#endif
handleDeviceConfigModelChanged(); handleDeviceConfigModelChanged();
} }
@@ -91,5 +98,14 @@ void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
m_step->deviceConfigModel()->setCurrentIndex(index); m_step->deviceConfigModel()->setCurrentIndex(index);
} }
void MaemoDeployStepWidget::setDeployToSysroot(bool doDeploy)
{
#ifdef DEPLOY_VIA_MOUNT
m_step->setDeployToSysroot(doDeploy);
#else
Q_UNUSED(doDeploy)
#endif
}
} // namespace Internal } // namespace Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -26,6 +26,7 @@ private:
Q_SLOT void handleModelsCreated(); Q_SLOT void handleModelsCreated();
Q_SLOT void handleDeviceConfigModelChanged(); Q_SLOT void handleDeviceConfigModelChanged();
Q_SLOT void setCurrentDeviceConfig(int index); Q_SLOT void setCurrentDeviceConfig(int index);
Q_SLOT void setDeployToSysroot(bool doDeloy);
virtual void init(); virtual void init();
virtual QString summaryText() const; virtual QString summaryText() const;

View File

@@ -46,6 +46,13 @@
<item row="1" column="1"> <item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2"/> <layout class="QHBoxLayout" name="horizontalLayout_2"/>
</item> </item>
<item row="1" column="0">
<widget class="QCheckBox" name="deployToSysrootCheckBox">
<property name="text">
<string>Also deploy to sysroot</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@@ -49,7 +49,6 @@ MaemoRemoteMounter::MaemoRemoteMounter(QObject *parent,
m_utfsServerTimer(new QTimer(this)), m_uploadJobId(SftpInvalidJob), m_utfsServerTimer(new QTimer(this)), m_uploadJobId(SftpInvalidJob),
m_stop(false) m_stop(false)
{ {
m_utfsServerTimer->setSingleShot(true);
connect(m_utfsServerTimer, SIGNAL(timeout()), this, connect(m_utfsServerTimer, SIGNAL(timeout()), this,
SLOT(handleUtfsServerTimeout())); SLOT(handleUtfsServerTimeout()));
} }
@@ -236,7 +235,7 @@ void MaemoRemoteMounter::startUtfsClients()
const QString chmod = QString::fromLocal8Bit("%1 chmod a+r+w+x %2") const QString chmod = QString::fromLocal8Bit("%1 chmod a+r+w+x %2")
.arg(MaemoGlobal::remoteSudo(), mountSpec.remoteMountPoint); .arg(MaemoGlobal::remoteSudo(), mountSpec.remoteMountPoint);
QString utfsClient QString utfsClient
= QString::fromLocal8Bit("%1 -l %2 -r %2 -b %2 %4") = QString::fromLocal8Bit("%1 -l %2 -r %2 -b %2 %4 -o nonempty")
.arg(utfsClientOnDevice()).arg(mountInfo.remotePort) .arg(utfsClientOnDevice()).arg(mountInfo.remotePort)
.arg(mountSpec.remoteMountPoint); .arg(mountSpec.remoteMountPoint);
if (mountInfo.mountAsRoot) if (mountInfo.mountAsRoot)