diff options
author | kh1 <karsten.heimrich@nokia.com> | 2011-11-17 15:39:36 +0100 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2011-11-17 15:41:32 +0100 |
commit | 56b624689c7e64e698de0c02615492b35df3d1b0 (patch) | |
tree | 93393f474598f72f71ac37eabcdd50b142b55bc4 /installerbuilder/libinstaller/packagemanagercore_p.cpp | |
parent | 7298c19c010127617c4f0d5efacb53d3084de5ac (diff) |
Fix broken undo operation calculation.
Undo operations are now recorded for replaced components as well.
Change-Id: I959e3f61e0ad8620f73738fe7f04afe9e9098f68
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller/packagemanagercore_p.cpp')
-rw-r--r-- | installerbuilder/libinstaller/packagemanagercore_p.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp index f1a6b5690..7e54e88e0 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.cpp +++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp @@ -1320,37 +1320,40 @@ void PackageManagerCorePrivate::runPackageUpdater() Component *component = componentsByName.value(name, 0); if (!component) component = m_core->componentByName(name); - if (component) { + if (component) componentsByName.insert(name, component); - if (isUpdater()) { - // If we have a component scheduled for update, do not break as we need whose operations in - // the undo list to be able to properly update (uninstall -> install). In case we had more - // then one update, others might have been deselected - so we need to keep them to avoid - // uninstalling the component the update was possible for. - if (!component->updateRequested() && !componentsToInstall.contains(component)) { + if (isUpdater()) { + // We found the component, the component is not scheduled for update, the dependency solver + // did not add the component as install dependency and there is no replacement, keep it. + if ((component && !component->updateRequested() && !componentsToInstall.contains(component) + && !m_componentsToReplaceUpdaterMode.contains(name))) { nonRevertedOperations.append(operation); continue; - } - } else { - // If we're _not_ removing everything and this component is still selected, -> next. - if (component->isSelected()) { + } + + // There is a replacement, but the replacement is not scheduled for update, keep it as well. + if (m_componentsToReplaceUpdaterMode.contains(name) + && !m_componentsToReplaceUpdaterMode.value(name).first->updateRequested()) { nonRevertedOperations.append(operation); continue; - } } - } - - // A component (one to replace) might be scheduled for uninstall, but we really don't know if it - // should be uninstalled. To figure this out we need to check the actual replacement if it is - // checked. If so, skip the undo operation. This avoids an update if we actually do a completely - // different component install/ uninstall. - if (componentsToReplace(m_core->runMode()).contains(name)) { - if ((isUpdater() && !m_componentsToReplaceUpdaterMode.value(name).first->updateRequested()) - || isPackageManager() && m_componentsToReplaceAllMode.value(name).first->isSelected()) { + } else if (isPackageManager()) { + // We found the component, the component is still checked and the dependency solver did not + // add the component as install dependency, keep it. + if (component && component->isSelected() && !componentsToInstall.contains(component)) { nonRevertedOperations.append(operation); continue; } + + // There is a replacement, but the replacement is not scheduled for update, keep it as well. + if (m_componentsToReplaceAllMode.contains(name) + && !m_componentsToReplaceAllMode.value(name).first->installationRequested()) { + nonRevertedOperations.append(operation); + continue; + } + } else { + Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid package manager mode!"); } // Filter out the create target dir undo operation, it's only needed for full uninstall. |