summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/packagemanagercore.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2014-11-18 12:16:17 +0100
committerKai Koehne <kai.koehne@theqtcompany.com>2014-11-18 12:16:17 +0100
commit4fb5d0f0390b1ddc150fe28b191fc3dbbb0ad77c (patch)
tree4ed0fd2aa8f31501ea466e659f623453bd9d1b02 /src/libs/installer/packagemanagercore.cpp
parent778af9e97d5652c84e027b3e3ccad62122fc92b6 (diff)
parent3fb00b56b473bd8c71b5b8a19db4d61fa2279763 (diff)
Merge remote-tracking branch 'origin/1.6'
Conflicts: src/libs/installer/packagemanagercore.cpp src/sdk/installerbase.cpp tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp Change-Id: I807686f154249930d31de80289389f4655c27525
Diffstat (limited to 'src/libs/installer/packagemanagercore.cpp')
-rw-r--r--src/libs/installer/packagemanagercore.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index d97985e46..3c809ded5 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -483,8 +483,8 @@ quint64 PackageManagerCore::requiredDiskSpace() const
{
quint64 result = 0;
- foreach (QInstaller::Component *component, components(ComponentType::Root))
- result += component->updateUncompressedSize();
+ foreach (QInstaller::Component *component, orderedComponentsToInstall())
+ result += size(component, scUncompressedSize);
return result;
}
@@ -691,6 +691,35 @@ PackageManagerCore::PackageManagerCore(qint64 magicmaker, const QList<OperationB
qRegisterMetaType<QInstaller::PackageManagerCore::WizardPage>("QInstaller::PackageManagerCore::WizardPage");
d->initialize(QHash<QString, QString>());
+
+
+ //
+ // Sanity check to detect a broken installations with missing operations.
+ // Every installed package should have at least one MinimalProgress operation.
+ //
+ QSet<QString> installedPackages = d->m_core->localInstalledPackages().keys().toSet();
+ QSet<QString> operationPackages;
+ foreach (QInstaller::Operation *operation, d->m_performedOperationsOld) {
+ if (operation->hasValue(QLatin1String("component")))
+ operationPackages.insert(operation->value(QLatin1String("component")).toString());
+ }
+
+ QSet<QString> packagesWithoutOperation = installedPackages - operationPackages;
+ QSet<QString> orphanedOperations = operationPackages - installedPackages;
+ if (!packagesWithoutOperation.isEmpty() || !orphanedOperations.isEmpty()) {
+ qCritical() << "Operations missing for installed packages" << packagesWithoutOperation.toList();
+ qCritical() << "Orphaned operations" << orphanedOperations.toList();
+ MessageBoxHandler::critical(
+ MessageBoxHandler::currentBestSuitParent(),
+ QLatin1String("Corrupt_Installation_Error"),
+ QCoreApplication::translate("QInstaller", "Corrupt installation"),
+ QCoreApplication::translate("QInstaller",
+ "Your installation seems to be corrupted. "
+ "Please consider re-installing from scratch."
+ ));
+ } else {
+ qDebug() << "Operations sanity check succeeded.";
+ }
}
PackageManagerCore::~PackageManagerCore()