Maemo: Improve clean-up behaviour on remote hosts.

We now remove files we have created on the device because they are
temporarily needed. This includes package files, mount points and pipes.

Task-number: QTCREATORBUG-2709
This commit is contained in:
Christian Kandeler
2010-10-29 11:41:39 +02:00
parent 2a569ce073
commit 946cce3706
4 changed files with 11 additions and 7 deletions

View File

@@ -99,7 +99,8 @@ void RemoteGdbProcess::handleFifoCreationFinished(int exitStatus)
if (exitStatus != SshRemoteProcess::ExitedNormally) { if (exitStatus != SshRemoteProcess::ExitedNormally) {
emitErrorExit(tr("Could not create FIFO.")); emitErrorExit(tr("Could not create FIFO."));
} else { } else {
m_appOutputReader = m_conn->createRemoteProcess("cat " + AppOutputFile); m_appOutputReader = m_conn->createRemoteProcess("cat " + AppOutputFile
+ " && rm -f " + AppOutputFile);
connect(m_appOutputReader.data(), SIGNAL(started()), this, connect(m_appOutputReader.data(), SIGNAL(started()), this,
SLOT(handleAppOutputReaderStarted())); SLOT(handleAppOutputReaderStarted()));
connect(m_appOutputReader.data(), SIGNAL(closed(int)), this, connect(m_appOutputReader.data(), SIGNAL(closed(int)), this,

View File

@@ -387,7 +387,7 @@ void MaemoDeployStep::handleSftpJobFinished(Core::SftpJobId,
.arg(filePathNative)); .arg(filePathNative));
const QString remoteFilePath const QString remoteFilePath
= uploadDir() + QLatin1Char('/') + QFileInfo(filePathNative).fileName(); = uploadDir() + QLatin1Char('/') + QFileInfo(filePathNative).fileName();
runDpkg(remoteFilePath); runDpkg(remoteFilePath, true);
} }
void MaemoDeployStep::handleMounted() void MaemoDeployStep::handleMounted()
@@ -400,7 +400,7 @@ void MaemoDeployStep::handleMounted()
if (m_needsInstall) { if (m_needsInstall) {
const QString remoteFilePath = deployMountPoint() + QLatin1Char('/') const QString remoteFilePath = deployMountPoint() + QLatin1Char('/')
+ QFileInfo(packagingStep()->packageFilePath()).fileName(); + QFileInfo(packagingStep()->packageFilePath()).fileName();
runDpkg(remoteFilePath); runDpkg(remoteFilePath, false);
} else { } else {
copyNextFileToDevice(); copyNextFileToDevice();
} }
@@ -605,11 +605,14 @@ void MaemoDeployStep::unmountOldDirs()
m_mounter->unmount(); m_mounter->unmount();
} }
void MaemoDeployStep::runDpkg(const QString &packageFilePath) void MaemoDeployStep::runDpkg(const QString &packageFilePath,
bool removeAfterInstall)
{ {
writeOutput(tr("Installing package to device...")); writeOutput(tr("Installing package to device..."));
const QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + " dpkg -i " QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + " dpkg -i "
+ packageFilePath.toUtf8(); + packageFilePath.toUtf8();
if (removeAfterInstall)
cmd += " && rm " + packageFilePath.toUtf8() + " || :";
m_deviceInstaller = m_connection->createRemoteProcess(cmd); m_deviceInstaller = m_connection->createRemoteProcess(cmd);
connect(m_deviceInstaller.data(), SIGNAL(closed(int)), this, connect(m_deviceInstaller.data(), SIGNAL(closed(int)), this,
SLOT(handleInstallationFinished(int))); SLOT(handleInstallationFinished(int)));

View File

@@ -134,7 +134,7 @@ private:
void unmountOldDirs(); void unmountOldDirs();
void setupMount(); void setupMount();
void prepareSftpConnection(); void prepareSftpConnection();
void runDpkg(const QString &packageFilePath); void runDpkg(const QString &packageFilePath, bool removeAfterInstall);
static const QLatin1String Id; static const QLatin1String Id;

View File

@@ -113,7 +113,7 @@ void MaemoRemoteMounter::unmount()
QString remoteCall; QString remoteCall;
for (int i = 0; i < m_mountSpecs.count(); ++i) { for (int i = 0; i < m_mountSpecs.count(); ++i) {
remoteCall += QString::fromLocal8Bit("%1 umount %2;") remoteCall += QString::fromLocal8Bit("%1 umount %2 && %1 rmdir %2;")
.arg(MaemoGlobal::remoteSudo(), .arg(MaemoGlobal::remoteSudo(),
m_mountSpecs.at(i).mountSpec.remoteMountPoint); m_mountSpecs.at(i).mountSpec.remoteMountPoint);
} }