diff options
author | kh1 <karsten.heimrich@nokia.com> | 2011-08-23 17:01:53 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2011-08-23 17:04:24 +0200 |
commit | 1255de2b9d0f09c3bcb8943ef2cfec5fa2404c42 (patch) | |
tree | 4d73fb2a1c5839ef229d4ae376180fd33b0c317d /installerbuilder | |
parent | d4617904c91cb25ac69aa84888d6caf77dd4b1b2 (diff) |
Fail if a component is a dependency but should be uninstalled.
Change-Id: Ie4fd05a46993a67d76c2b359db6483247be2d724
Reviewed-on: http://codereview.qt.nokia.com/3417
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder')
-rw-r--r-- | installerbuilder/libinstaller/packagemanagercore_p.cpp | 4 | ||||
-rw-r--r-- | installerbuilder/libinstaller/packagemanagergui.cpp | 23 |
2 files changed, 13 insertions, 14 deletions
diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp index c3dd72139..09de17361 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.cpp +++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp @@ -360,7 +360,7 @@ bool PackageManagerCorePrivate::appendComponentToInstall(Component *component) foreach (const QString &dependencyComponentName, component->dependencies()) { //componentByName return 0 if dependencyComponentName contains a version which is not available Component *dependencyComponent = m_core->componentByName(dependencyComponentName); - if (dependencyComponent == 0) { + if (dependencyComponent == 0 || dependencyComponent->uninstallationRequested()) { const QString errorMessage = QString::fromLatin1("Can't find missing dependency(%1) for %2.") .arg(dependencyComponentName, component->name()); verbose() << qPrintable(errorMessage) << std::endl; @@ -1140,7 +1140,7 @@ void PackageManagerCorePrivate::runInstaller() ProgressCoordinator::instance()->emitLabelAndDetailTextChanged(tr("Preparing the installation...")); const QList<Component*> componentsToInstall = m_core->orderedComponentsToInstall(); - verbose() << "Install size: " << m_core->orderedComponentsToInstall().size() << " components" << std::endl; + verbose() << "Install size: " << componentsToInstall.size() << " components" << std::endl; if (!adminRightsGained) { foreach (Component *component, m_core->orderedComponentsToInstall()) { diff --git a/installerbuilder/libinstaller/packagemanagergui.cpp b/installerbuilder/libinstaller/packagemanagergui.cpp index 9b41372dc..d93c729fb 100644 --- a/installerbuilder/libinstaller/packagemanagergui.cpp +++ b/installerbuilder/libinstaller/packagemanagergui.cpp @@ -1549,22 +1549,21 @@ void ReadyForInstallationPage::refreshTaskDetailsBrowser() { QString htmlOutput; QString lastInstallReason; - if (!packageManagerCore()->calculateComponentsToInstall()) { - htmlOutput.append(QString::fromLatin1("<h2><font color=\"red\">%1</font><br></h2>").arg(tr("Can't " - "resolve all dependencies."))); - if (!m_taskDetailsBrowser->isVisible()) - toggleDetails(); - setCommitPage(false); + if (!packageManagerCore()->calculateComponentsToUninstall() || + !packageManagerCore()->calculateComponentsToInstall()) { + htmlOutput.append(QString::fromLatin1("<h2><font color=\"red\">%1</font><br></h2>") + .arg(tr("Can not resolve all dependencies. Some components might be scheduled for uninstall " + "while others require them for installation!"))); + m_taskDetailsBrowser->setHtml(htmlOutput); + if (!m_taskDetailsBrowser->isVisible()) + toggleDetails(); + setCommitPage(false); + return; } // In case of updater mode we don't uninstall components. if (!packageManagerCore()->isUpdater()) { - QList<Component*> componentsToRemove; - foreach (Component *component, packageManagerCore()->availableComponents()) { - if (component->uninstallationRequested()) - componentsToRemove.append(component); - } - + QList<Component*> componentsToRemove = packageManagerCore()->componentsToUninstall(); if (!componentsToRemove.isEmpty()) { htmlOutput.append(QString::fromLatin1("<h3>%1</h3><ul>").arg(tr("Components about to be removed."))); foreach (Component *component, componentsToRemove) |