diff options
author | Katja Marttila <katja.marttila@qt.io> | 2017-05-29 11:12:53 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2017-06-01 06:30:55 +0000 |
commit | 13bbcdda36522ff10a650092fb5682a79edd27e6 (patch) | |
tree | f36bb72bc17f4bf5ef889c25141da2f349741eda /src/libs/installer/packagemanagercore.cpp | |
parent | d7d0974f9cdc2359b6b3ca0e359f2fe05ad437c4 (diff) |
Fix maintenance tool update with silentUpdate
Maintenance tool is an essential update. Essential updates should be
installed before non-essential updates. This change forces essential
updates to be installed first. The behavior is same as when
updating with visible UI.
Task-number: QTIFW-976
Change-Id: I360145821c4e2d1f3384efca641208acb9338d5e
Reviewed-by: Antti Kokko <antti.kokko@qt.io>
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/libs/installer/packagemanagercore.cpp')
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index c4ba5ae4a..7b6842720 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -1816,21 +1816,39 @@ void PackageManagerCore::updateComponentsSilently() setMessageBoxAutomaticAnswer(QLatin1String("installationErrorWithRetry"), QMessageBox::Cancel); fetchRemotePackagesTree(); - //Mark all components to be installed + const QList<QInstaller::Component*> componentList = components( ComponentType::Root | ComponentType::Descendants); if (componentList.count() == 0) { qDebug() << "No updates available."; } else { - foreach (Component *comp, componentList) { - comp->setCheckState(Qt::Checked); + // Check if essential components are available (essential components are disabled). + // If essential components are found, update first essential updates, + // restart installer and install rest of the updates. + bool essentialUpdatesFound = false; + foreach (Component *component, componentList) { + if (component->value(scEssential, scFalse).toLower() == scTrue) + essentialUpdatesFound = true; + } + if (!essentialUpdatesFound) { + //Mark all components to be updated + foreach (Component *comp, componentList) { + comp->setCheckState(Qt::Checked); + } } QString htmlOutput; bool componentsOk = calculateComponents(&htmlOutput); if (componentsOk) { - if (runPackageUpdater()) - qDebug() << "Components updated successfully."; + if (runPackageUpdater()) { + writeMaintenanceTool(); + if (essentialUpdatesFound) { + qDebug() << "Essential components updated successfully."; + } + else { + qDebug() << "Components updated successfully."; + } + } } else { qDebug() << htmlOutput; |