diff options
Diffstat (limited to 'src/libs/installer/packagemanagercore.cpp')
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index fc1ecff02..09e1a5094 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -545,11 +545,12 @@ quint64 PackageManagerCore::requiredDiskSpace() const */ quint64 PackageManagerCore::requiredTemporaryDiskSpace() const { - quint64 result = 0; + if (isOfflineOnly()) + return 0; + quint64 result = 0; foreach (QInstaller::Component *component, orderedComponentsToInstall()) result += size(component, scCompressedSize); - return result; } @@ -648,6 +649,19 @@ void PackageManagerCore::rollBackInstallation() const bool becameAdmin = !d->m_FSEngineClientHandler->isActive() && operation->value(QLatin1String("admin")).toBool() && gainAdminRights(); + if (operation->hasValue(QLatin1String("uninstall-only"))) { + // We know the mkdir operation which is creating the target path. If we do a + // full uninstall, prevent a forced remove of the full install path including the + // target , instead try to remove the target only and only if it is empty, + // otherwise fail silently. Note: we will ever experience this only -if- + // RemoveTargetDir is set, otherwise the operation does not exist at all. + const bool isMkDir = (operation->name() == QLatin1String("Mkdir")); + const bool removeTargetDir = QVariant(value(scRemoveTargetDir)).toBool(); + const bool uninstallOnly = operation->value(QLatin1String("uninstall-only")).toBool(); + if (isMkDir && uninstallOnly && removeTargetDir) + operation->setValue(QLatin1String("forceremoval"), false); + } + PackageManagerCorePrivate::performOperationThreaded(operation, PackageManagerCorePrivate::Undo); const QString componentName = operation->value(QLatin1String("component")).toString(); @@ -886,8 +900,8 @@ bool PackageManagerCore::fetchRemotePackagesTree() return false; } - if (!ProductKeyCheck::instance(this)->hasValidKey()) { - d->setStatus(Failure, ProductKeyCheck::instance(this)->lastErrorString()); + if (!ProductKeyCheck::instance()->hasValidKey()) { + d->setStatus(Failure, ProductKeyCheck::instance()->lastErrorString()); return false; } @@ -1681,15 +1695,23 @@ QString PackageManagerCore::findLibrary(const QString &name, const QStringList & #if defined(Q_OS_WIN) return findPath(QString::fromLatin1("%1.lib").arg(name), findPaths); #else +#if defined(Q_OS_MAC) if (findPaths.isEmpty()) { findPaths.push_back(QLatin1String("/lib")); findPaths.push_back(QLatin1String("/usr/lib")); findPaths.push_back(QLatin1String("/usr/local/lib")); findPaths.push_back(QLatin1String("/opt/local/lib")); } -#if defined(Q_OS_MAC) const QString dynamic = findPath(QString::fromLatin1("lib%1.dylib").arg(name), findPaths); #else + if (findPaths.isEmpty()) { + findPaths.push_back(QLatin1String("/lib")); + findPaths.push_back(QLatin1String("/usr/lib")); + findPaths.push_back(QLatin1String("/usr/local/lib")); + findPaths.push_back(QLatin1String("/lib64")); + findPaths.push_back(QLatin1String("/usr/lib64")); + findPaths.push_back(QLatin1String("/usr/local/lib64")); + } const QString dynamic = findPath(QString::fromLatin1("lib%1.so*").arg(name), findPaths); #endif if (!dynamic.isEmpty()) |