diff options
author | Katja Marttila <katja.marttila@qt.io> | 2022-03-07 17:40:01 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2022-03-18 13:01:00 +0200 |
commit | 0486535dc1e2cc8a902ee8625a822384e6c26e1e (patch) | |
tree | 0840714615d86f6709738b4e1655d3ee299e5bbb /src/libs/installer/uninstallercalculator.cpp | |
parent | 1e676ad0eb6e1cf163b77923c7da9815b09e3def (diff) |
Do not uninstall needed virtual dependencies
Virtual dependencies are uninstalled if all dependencies to the
component is removed. Virtual dependencies were calculated using recent
components in repository, which is wrong as the dependencies may have
changed in the repository, causing the dependencies to be uninstalled
although those are still needed. Fixed so that the uninstallable virtual
components are calculated from repository components if the component is
going to be updated, otherwise the dependeny is calculated from the
local installed packages.
Task-number: QTIFW-2573
Change-Id: If9cc59fa7f453d502ec1883f27273ef604128a6e
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/installer/uninstallercalculator.cpp')
-rw-r--r-- | src/libs/installer/uninstallercalculator.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libs/installer/uninstallercalculator.cpp b/src/libs/installer/uninstallercalculator.cpp index fc5620936..7d5ce9e2a 100644 --- a/src/libs/installer/uninstallercalculator.cpp +++ b/src/libs/installer/uninstallercalculator.cpp @@ -127,10 +127,10 @@ void UninstallerCalculator::appendComponentsToUninstall(const QList<Component*> if (!autoDependOnList.isEmpty()) appendComponentsToUninstall(autoDependOnList); else - continueAppendComponentsToUninstall(); + appendVirtualComponentsToUninstall(); } -void UninstallerCalculator::continueAppendComponentsToUninstall() +void UninstallerCalculator::appendVirtualComponentsToUninstall() { QList<Component*> unneededVirtualList; // Check for virtual components without dependees @@ -141,8 +141,9 @@ void UninstallerCalculator::continueAppendComponentsToUninstall() continue; bool required = false; - for (Component *dependee : m_core->dependees(component)) { - if (dependee->isInstalled() && !m_componentsToUninstall.contains(dependee)) { + // Check if installed or about to be updated -packages are dependant on the package + for (Component *dependant : m_core->installDependants(component)) { + if (dependant->isInstalled() && !m_componentsToUninstall.contains(dependant)) { required = true; break; } |