diff options
author | Katja Marttila <katja.marttila@qt.io> | 2020-11-24 06:20:07 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-11-24 06:20:07 +0200 |
commit | 79011733f7a00da988d482dde443418c9df38784 (patch) | |
tree | aae5e8dbdd254cb2538e66e4649b1c86d39191ae /src/libs/installer | |
parent | d863c8abcf29e971e0adb8dcb2fc12971a4e98f1 (diff) | |
parent | 13c9e1111d89d1a2a06954c00bb3d3c33d4ecfa3 (diff) |
Merge remote-tracking branch 'origin/4.0' into master
Change-Id: If5205ff6ef2c8989520e24d41595c04d5920d207
Diffstat (limited to 'src/libs/installer')
-rw-r--r-- | src/libs/installer/commandlineparser.cpp | 15 | ||||
-rw-r--r-- | src/libs/installer/extractarchiveoperation.cpp | 8 | ||||
-rw-r--r-- | src/libs/installer/licenseoperation.cpp | 4 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore_p.cpp | 17 | ||||
-rw-r--r-- | src/libs/installer/progresscoordinator.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/scriptengine.cpp | 2 |
7 files changed, 35 insertions, 15 deletions
diff --git a/src/libs/installer/commandlineparser.cpp b/src/libs/installer/commandlineparser.cpp index 4fc295f48..3ffbdb9b5 100644 --- a/src/libs/installer/commandlineparser.cpp +++ b/src/libs/installer/commandlineparser.cpp @@ -42,23 +42,24 @@ static const QLatin1String scInstallerValue("InstallerValue"); CommandLineParser::CommandLineParser() : d(new CommandLineParserPrivate()) { + static const QLatin1String indent(" "); static const QString preformatted = QLatin1String("\nQt Installer Framework supports both GUI and " "headless mode. The installation operations can be invoked with the following commands and " "options. Note that the options marked with \"CLI\" are available in the headless mode only.\n") + QLatin1String("\nCommands:\n") - + QString::fromLatin1("\t%1, %2 - install default or selected packages - <pkg1 pkg2 pkg3...>\n") + + indent + QString::fromLatin1("%1, %2 - install default or selected packages - <pkg ...>\n") .arg(CommandLineOptions::scInstallShort, CommandLineOptions::scInstallLong) - + QString::fromLatin1("\t%1, %2 - show available updates information on maintenance tool\n") + + indent + QString::fromLatin1("%1, %2 - show available updates information on maintenance tool\n") .arg(CommandLineOptions::scCheckUpdatesShort, CommandLineOptions::scCheckUpdatesLong) - + QString::fromLatin1("\t%1, %2 - update all or selected packages - <pkg1 pkg2 pkg3...>\n") + + indent + QString::fromLatin1("%1, %2 - update all or selected packages - <pkg ...>\n") .arg(CommandLineOptions::scUpdateShort, CommandLineOptions::scUpdateLong) - + QString::fromLatin1("\t%1, %2 - uninstall packages and their child components - <pkg1 pkg2 pkg3...>\n") + + indent + QString::fromLatin1("%1, %2 - uninstall packages and their child components - <pkg ...>\n") .arg(CommandLineOptions::scRemoveShort, CommandLineOptions::scRemoveLong) - + QString::fromLatin1("\t%1, %2 - list currently installed packages - <regexp>\n") + + indent + QString::fromLatin1("%1, %2 - list currently installed packages - <regexp>\n") .arg(CommandLineOptions::scListShort, CommandLineOptions::scListLong) - + QString::fromLatin1("\t%1, %2 - search available packages - <regexp>\n") + + indent + QString::fromLatin1("%1, %2 - search available packages - <regexp>\n") .arg(CommandLineOptions::scSearchShort, CommandLineOptions::scSearchLong) - + QString::fromLatin1("\t%1, %2 - uninstall all packages and remove entire program directory") + + indent + QString::fromLatin1("%1, %2 - uninstall all packages and remove entire program directory") .arg(CommandLineOptions::scPurgeShort, CommandLineOptions::scPurgeLong); m_parser.setApplicationDescription(preformatted); diff --git a/src/libs/installer/extractarchiveoperation.cpp b/src/libs/installer/extractarchiveoperation.cpp index 63e560e79..99dd88a7e 100644 --- a/src/libs/installer/extractarchiveoperation.cpp +++ b/src/libs/installer/extractarchiveoperation.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -122,7 +122,8 @@ bool ExtractArchiveOperation::performOperation() QStringList files = callback.extractedFiles(); - QString fileDirectory = targetDir + QLatin1String("/installerResources/") + + const QString resourcesPath = targetDir + QLatin1Char('/') + QLatin1String("installerResources"); + QString fileDirectory = resourcesPath + QLatin1Char('/') + archivePath.section(QLatin1Char('/'), 1, 1, QString::SectionSkipEmpty) + QLatin1Char('/'); QString archiveFileName = archivePath.section(QLatin1Char('/'), 2, 2, QString::SectionSkipEmpty); QFileInfo fileInfo2(archiveFileName); @@ -136,6 +137,9 @@ bool ExtractArchiveOperation::performOperation() if (!dir.exists()) { dir.mkpath(targetDirectoryInfo.absolutePath()); } + setDefaultFilePermissions(resourcesPath, DefaultFilePermissions::Executable); + setDefaultFilePermissions(targetDirectoryInfo.absolutePath(), DefaultFilePermissions::Executable); + QFile file(targetDirectoryInfo.absolutePath() + QLatin1Char('/') + fileName); if (file.open(QIODevice::WriteOnly)) { setDefaultFilePermissions(file.fileName(), DefaultFilePermissions::NonExecutable); diff --git a/src/libs/installer/licenseoperation.cpp b/src/libs/installer/licenseoperation.cpp index 7296c6606..a5a61c71f 100644 --- a/src/libs/installer/licenseoperation.cpp +++ b/src/libs/installer/licenseoperation.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -30,6 +30,7 @@ #include "packagemanagercore.h" #include "settings.h" +#include "fileutils.h" #include <QtCore/QDir> #include <QtCore/QFile> @@ -74,6 +75,7 @@ bool LicenseOperation::performOperation() QDir dir; dir.mkpath(targetDir); + setDefaultFilePermissions(targetDir, DefaultFilePermissions::Executable); setArguments(QStringList(targetDir)); for (QVariantMap::const_iterator it = licenses.constBegin(); it != licenses.constEnd(); ++it) { diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index d188c178a..a921884b2 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -2424,6 +2424,7 @@ PackageManagerCore::Status PackageManagerCore::uninstallComponentsSilently(const */ PackageManagerCore::Status PackageManagerCore::removeInstallationSilently() { + setCompleteUninstallation(true); if (d->runningProcessesFound()) throw Error(tr("Running processes found.")); @@ -2432,7 +2433,6 @@ PackageManagerCore::Status PackageManagerCore::removeInstallationSilently() qCDebug(QInstaller::lcInstallerInstallLog) << "Uninstallation aborted."; return status(); } - setCompleteUninstallation(true); if (run()) return PackageManagerCore::Success; else diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index f6897d692..edc2d6fca 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -208,10 +208,18 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core) : m_updateFinder(nullptr) , m_compressedFinder(nullptr) , m_localPackageHub(std::make_shared<LocalPackageHub>()) + , m_status(PackageManagerCore::Unfinished) + , m_needsHardRestart(false) + , m_testChecksum(false) + , m_launchedAsRoot(AdminAuthorization::hasAdminRights()) + , m_completeUninstall(false) + , m_needToWriteMaintenanceTool(false) + , m_dependsOnLocalInstallerBinary(false) , m_core(core) , m_updates(false) , m_repoFetched(false) , m_updateSourcesAdded(false) + , m_magicBinaryMarker(0) // initialize with pseudo marker , m_componentsToInstallCalculated(false) , m_componentScriptEngine(nullptr) , m_controlScriptEngine(nullptr) @@ -2030,10 +2038,15 @@ bool PackageManagerCorePrivate::runningProcessesFound() //Check if there are processes running in the install QStringList excludeFiles = m_allowedRunningProcesses; excludeFiles.append(maintenanceToolName()); + + const QString performModeWarning = m_completeUninstall + ? QLatin1String("Unable to remove components.") + : QLatin1String("Unable to update components."); + QStringList runningProcesses = runningInstallerProcesses(excludeFiles); if (!runningProcesses.isEmpty()) { - qCWarning(QInstaller::lcInstallerInstallLog).noquote() << "Unable to update components. Please stop these processes: " - << runningProcesses << " and try again."; + qCWarning(QInstaller::lcInstallerInstallLog).noquote().nospace() << performModeWarning + << " Please stop these processes: " << runningProcesses << " and try again."; return true; } return false; diff --git a/src/libs/installer/progresscoordinator.cpp b/src/libs/installer/progresscoordinator.cpp index 91fa9671e..7af24cb77 100644 --- a/src/libs/installer/progresscoordinator.cpp +++ b/src/libs/installer/progresscoordinator.cpp @@ -329,5 +329,5 @@ void ProgressCoordinator::printProgressPercentage(int progress) void ProgressCoordinator::printProgressMessage(const QString &message) { - qCDebug(QInstaller::lcInstallerInstallLog) << message; + qCDebug(QInstaller::lcInstallerInstallLog).nospace().noquote() << message; } diff --git a/src/libs/installer/scriptengine.cpp b/src/libs/installer/scriptengine.cpp index 630829725..4d062c9cb 100644 --- a/src/libs/installer/scriptengine.cpp +++ b/src/libs/installer/scriptengine.cpp @@ -511,7 +511,7 @@ QJSValue ScriptEngine::loadInContext(const QString &context, const QString &file // replacements of %1, %2 or %3 inside the javascript code. const QString scriptContent = QLatin1String("(function() {") + scriptInjection + QString::fromUtf8(file.readAll()) - + QString::fromLatin1(";" + + QString::fromLatin1("\n" " if (typeof %1 != \"undefined\")" " return new %1;" " else" |