Maemo: Don't allow to downgrade packages on the device.

Task-number: QTCREATORBUG-3642
This commit is contained in:
Christian Kandeler
2011-02-03 10:12:43 +01:00
parent a84106dfd4
commit 82a338524d
2 changed files with 8 additions and 2 deletions

View File

@@ -340,6 +340,7 @@ void MaemoDeployStep::start()
Q_ASSERT(!m_currentDeviceDeployAction); Q_ASSERT(!m_currentDeviceDeployAction);
Q_ASSERT(!m_needsInstall); Q_ASSERT(!m_needsInstall);
Q_ASSERT(m_filesToCopy.isEmpty()); Q_ASSERT(m_filesToCopy.isEmpty());
m_installerStderr.clear();
const MaemoPackageCreationStep * const pStep = packagingStep(); const MaemoPackageCreationStep * const pStep = packagingStep();
const QString hostName = m_cachedDeviceConfig->sshParameters().host; const QString hostName = m_cachedDeviceConfig->sshParameters().host;
if (pStep->isPackagingEnabled()) { if (pStep->isPackagingEnabled()) {
@@ -711,8 +712,8 @@ void MaemoDeployStep::runPackageInstaller(const QString &packageFilePath)
setState(InstallingToDevice); setState(InstallingToDevice);
writeOutput(tr("Installing package to device...")); writeOutput(tr("Installing package to device..."));
const QByteArray installCommand const QByteArray installCommand = packagingStep()->debBasedMaemoTarget()
= packagingStep()->debBasedMaemoTarget() ? "dpkg -i" : "rpm -Uhv"; ? "dpkg -i --no-force-downgrade" : "rpm -Uhv";
QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + ' ' QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + ' '
+ installCommand + ' ' + packageFilePath.toUtf8(); + installCommand + ' ' + packageFilePath.toUtf8();
if (removeAfterInstall) if (removeAfterInstall)
@@ -876,6 +877,9 @@ void MaemoDeployStep::handleInstallationFinished(int exitStatus)
if (exitStatus != SshRemoteProcess::ExitedNormally if (exitStatus != SshRemoteProcess::ExitedNormally
|| m_deviceInstaller->exitCode() != 0) { || m_deviceInstaller->exitCode() != 0) {
raiseError(tr("Installing package failed.")); raiseError(tr("Installing package failed."));
} else if (m_installerStderr.contains("Will not downgrade")) {
raiseError(tr("Installation failed: "
"You tried to downgrade a package, which is not allowed."));
} else { } else {
m_needsInstall = false; m_needsInstall = false;
setDeployed(m_connection->connectionParameters().host, setDeployed(m_connection->connectionParameters().host,
@@ -967,6 +971,7 @@ void MaemoDeployStep::handleDeviceInstallerErrorOutput(const QByteArray &output)
switch (m_state) { switch (m_state) {
case InstallingToDevice: case InstallingToDevice:
case StopRequested: case StopRequested:
m_installerStderr += output;
writeOutput(QString::fromUtf8(output), ErrorOutput); writeOutput(QString::fromUtf8(output), ErrorOutput);
break; break;
default: default:

View File

@@ -176,6 +176,7 @@ private:
QSharedPointer<const MaemoDeviceConfig> m_cachedDeviceConfig; QSharedPointer<const MaemoDeviceConfig> m_cachedDeviceConfig;
MaemoUsedPortsGatherer *m_portsGatherer; MaemoUsedPortsGatherer *m_portsGatherer;
MaemoPortList m_freePorts; MaemoPortList m_freePorts;
QByteArray m_installerStderr;
State m_state; State m_state;
}; };