summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/packagemanagercore.cpp65
-rw-r--r--src/libs/installer/packagemanagercore.h19
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp5
-rw-r--r--src/sdk/commandlineinterface.cpp14
4 files changed, 50 insertions, 53 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 920ef0987..07f86647c 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -135,6 +135,9 @@ using namespace QInstaller;
\value Unfinished
Installation was not completed.
\value ForceUpdate
+ Installation has to be updated.
+ \value EssentialUpdated
+ Installation essential components were updated.
*/
/*!
@@ -2255,10 +2258,9 @@ void PackageManagerCore::listInstalledPackages()
/*!
Updates the selected components \a componentsToUpdate without GUI.
If essential components are found, then only those will be updated.
- Returns \c true if components are updated successfully or there are
- no updates to perform, otherwise returns \c false.
+ Returns PackageManagerCore installation status.
*/
-bool PackageManagerCore::updateComponentsSilently(const QStringList &componentsToUpdate)
+PackageManagerCore::Status PackageManagerCore::updateComponentsSilently(const QStringList &componentsToUpdate)
{
if (d->runningProcessesFound())
throw Error(tr("Running processes found."));
@@ -2303,7 +2305,7 @@ bool PackageManagerCore::updateComponentsSilently(const QStringList &componentsT
if (userSelectedComponents && componentsToBeUpdated.isEmpty()) {
qCDebug(QInstaller::lcInstallerInstallLog)
<< "No updates available for selected components.";
- return true;
+ return PackageManagerCore::Success;
}
foreach (Component *componentToUpdate, componentsToBeUpdated) {
const QModelIndex &idx = model->indexFromComponentName(componentToUpdate->name());
@@ -2312,7 +2314,7 @@ bool PackageManagerCore::updateComponentsSilently(const QStringList &componentsT
}
if (!d->calculateComponentsAndRun())
- return false;
+ return status();
if (essentialUpdatesFound) {
qCDebug(QInstaller::lcInstallerInstallLog) << "Essential components updated successfully."
@@ -2321,7 +2323,7 @@ bool PackageManagerCore::updateComponentsSilently(const QStringList &componentsT
qCDebug(QInstaller::lcInstallerInstallLog) << "Components updated successfully.";
}
}
- return true;
+ return status();
}
/*!
@@ -2336,10 +2338,9 @@ void PackageManagerCore::commitSessionOperations()
/*!
Uninstalls the selected components \a components without GUI.
- Returns \c true if components are uninstalled successfully or
- there are no components to uninstall, otherwise returns \c false.
+ Returns PackageManagerCore installation status.
*/
-bool PackageManagerCore::uninstallComponentsSilently(const QStringList& components)
+PackageManagerCore::Status PackageManagerCore::uninstallComponentsSilently(const QStringList& components)
{
if (d->runningProcessesFound())
throw Error(tr("Running processes found."));
@@ -2364,20 +2365,17 @@ bool PackageManagerCore::uninstallComponentsSilently(const QStringList& componen
}
if (uninstallComponentFound) {
- if (!d->calculateComponentsAndRun())
- return false;
-
- qCDebug(QInstaller::lcInstallerInstallLog) << "Components uninstalled successfully";
+ if (d->calculateComponentsAndRun())
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Components uninstalled successfully";
}
- return true;
+ return status();
}
/*!
Uninstalls all installed components without GUI and removes
- the program directory. Returns \c true if components are
- uninstalled successfully, otherwise returns \c false.
+ the program directory. Returns PackageManagerCore installation status.
*/
-bool PackageManagerCore::removeInstallationSilently()
+PackageManagerCore::Status PackageManagerCore::removeInstallationSilently()
{
if (d->runningProcessesFound())
throw Error(tr("Running processes found."));
@@ -2385,20 +2383,22 @@ bool PackageManagerCore::removeInstallationSilently()
qCDebug(QInstaller::lcInstallerInstallLog) << "Complete uninstallation was chosen.";
if (!(d->m_autoConfirmCommand || d->askUserConfirmCommand())) {
qCDebug(QInstaller::lcInstallerInstallLog) << "Uninstallation aborted.";
- return false;
+ return status();
}
setCompleteUninstallation(true);
- return run();
+ if (run())
+ return PackageManagerCore::Success;
+ else
+ return PackageManagerCore::Failure;
}
/*!
Installs the selected components \a components without displaying a user
interface. Virtual components cannot be installed unless made visible with
--show-virtual-components. AutoDependOn nor non-checkable components cannot
- be installed directly. Returns \c true if components are installed or there
- is nothing to install, otherwise returns \c false.
+ be installed directly. Returns PackageManagerCore installation status.
*/
-bool PackageManagerCore::installSelectedComponentsSilently(const QStringList& components)
+PackageManagerCore::Status PackageManagerCore::installSelectedComponentsSilently(const QStringList& components)
{
if (!isInstaller()) {
// Check if there are processes running in the install if maintenancetool is used.
@@ -2413,12 +2413,13 @@ bool PackageManagerCore::installSelectedComponentsSilently(const QStringList& co
helperStrList.removeDuplicates();
if (helperStrList.count() == installedPackages.count()) {
qCDebug(QInstaller::lcInstallerInstallLog) << "Components already installed.";
- return true;
+ return PackageManagerCore::Success;
}
}
ComponentModel *model = defaultComponentModel();
- fetchRemotePackagesTree();
+ if (!fetchRemotePackagesTree())
+ return status();
bool installComponentsFound = false;
foreach (const QString &name, components){
@@ -2447,22 +2448,19 @@ bool PackageManagerCore::installSelectedComponentsSilently(const QStringList& co
}
}
if (installComponentsFound) {
- if (!d->calculateComponentsAndRun())
- return false;
-
- qCDebug(QInstaller::lcInstallerInstallLog) << "Components installed successfully";
+ if (d->calculateComponentsAndRun())
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Components installed successfully";
}
- return true;
+ return status();
}
/*!
Installs components that are checked by default, i.e. those that are set
with <Default> or <ForcedInstallation> and their respective dependencies
without GUI.
- Returns \c true if default components are found and the maintenance tool
- needs to be written, otherwise returns \c false.
+ Returns PackageManagerCore installation status.
*/
-bool PackageManagerCore::installDefaultComponentsSilently()
+PackageManagerCore::Status PackageManagerCore::installDefaultComponentsSilently()
{
d->m_defaultInstall = true;
ComponentModel *model = defaultComponentModel();
@@ -2472,12 +2470,11 @@ bool PackageManagerCore::installDefaultComponentsSilently()
// There are components that are checked by default, we should install them
if (d->calculateComponentsAndRun()) {
qCDebug(QInstaller::lcInstallerInstallLog) << "Components installed successfully.";
- return true;
}
} else {
qCDebug(QInstaller::lcInstallerInstallLog) << "No components available for default installation.";
}
- return false;
+ return status();
}
/*!
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index e02dbeb36..b0feb1a57 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -71,10 +71,11 @@ public:
enum Status {
Success = EXIT_SUCCESS,
Failure = EXIT_FAILURE,
- Running,
- Canceled,
- Unfinished,
- ForceUpdate
+ Running = 2,
+ Canceled = 3,
+ Unfinished = 4,
+ ForceUpdate = 5,
+ EssentialUpdated = 6
};
Status status() const;
QString error() const;
@@ -234,11 +235,11 @@ public:
ComponentModel *updaterComponentModel() const;
void listInstalledPackages();
void listAvailablePackages(const QString &regexp);
- bool updateComponentsSilently(const QStringList &componentsToUpdate);
- bool installSelectedComponentsSilently(const QStringList& components);
- bool installDefaultComponentsSilently();
- bool uninstallComponentsSilently(const QStringList& components);
- bool removeInstallationSilently();
+ PackageManagerCore::Status updateComponentsSilently(const QStringList &componentsToUpdate);
+ PackageManagerCore::Status installSelectedComponentsSilently(const QStringList& components);
+ PackageManagerCore::Status installDefaultComponentsSilently();
+ PackageManagerCore::Status uninstallComponentsSilently(const QStringList& components);
+ PackageManagerCore::Status removeInstallationSilently();
// convenience
Q_INVOKABLE void setInstaller();
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index da6ce66b9..52e732e49 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -1820,7 +1820,10 @@ bool PackageManagerCorePrivate::runPackageUpdater()
if (adminRightsGained)
m_core->dropAdminRights();
- setStatus(PackageManagerCore::Success);
+ if (m_foundEssentialUpdate)
+ setStatus(PackageManagerCore::EssentialUpdated);
+ else
+ setStatus(PackageManagerCore::Success);
emit installationFinished();
} catch (const Error &err) {
if (m_core->status() != PackageManagerCore::Canceled) {
diff --git a/src/sdk/commandlineinterface.cpp b/src/sdk/commandlineinterface.cpp
index 942faaf31..bfb4ea75a 100644
--- a/src/sdk/commandlineinterface.cpp
+++ b/src/sdk/commandlineinterface.cpp
@@ -159,8 +159,7 @@ int CommandLineInterface::updatePackages()
if (!checkLicense())
return EXIT_FAILURE;
try {
- return m_core->updateComponentsSilently(m_positionalArguments)
- ? EXIT_SUCCESS : EXIT_FAILURE;
+ return m_core->updateComponentsSilently(m_positionalArguments);
} catch (const QInstaller::Error &err) {
qCCritical(QInstaller::lcInstallerInstallLog) << err.message();
return EXIT_FAILURE;
@@ -179,12 +178,10 @@ int CommandLineInterface::installPackages()
return EXIT_FAILURE;
}
// No packages provided, install default components
- return m_core->installDefaultComponentsSilently()
- ? EXIT_SUCCESS : EXIT_FAILURE;
+ return m_core->installDefaultComponentsSilently();
}
// Normal installation
- return m_core->installSelectedComponentsSilently(m_positionalArguments)
- ? EXIT_SUCCESS : EXIT_FAILURE;
+ return m_core->installSelectedComponentsSilently(m_positionalArguments);
} catch (const QInstaller::Error &err) {
qCCritical(QInstaller::lcInstallerInstallLog) << err.message();
return EXIT_FAILURE;
@@ -201,8 +198,7 @@ int CommandLineInterface::uninstallPackages()
}
m_core->setPackageManager();
try {
- return m_core->uninstallComponentsSilently(m_positionalArguments)
- ? EXIT_SUCCESS : EXIT_FAILURE;
+ return m_core->uninstallComponentsSilently(m_positionalArguments);
} catch (const QInstaller::Error &err) {
qCCritical(QInstaller::lcInstallerInstallLog) << err.message();
return EXIT_FAILURE;
@@ -219,7 +215,7 @@ int CommandLineInterface::removeInstallation()
}
m_core->setUninstaller();
try {
- return m_core->removeInstallationSilently() ? EXIT_SUCCESS : EXIT_FAILURE;
+ return m_core->removeInstallationSilently();
} catch (const QInstaller::Error &err) {
qCCritical(QInstaller::lcInstallerInstallLog) << err.message();
return EXIT_FAILURE;