summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/componentchecker.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-04-30 15:49:40 +0200
committerKai Koehne <kai.koehne@theqtcompany.com>2015-04-30 15:49:54 +0200
commitbe481e3af7c302f70e1d83406de40203218deef2 (patch)
tree5a10568c2c1d0ee7a0070f928c5437db80c2266c /src/libs/installer/componentchecker.cpp
parenta1418fbffd4c786b5de8200e05a9ff26d8b90c3c (diff)
parentef48a0c26c0771c9bfa86130f00be8fa00330289 (diff)
Merge remote-tracking branch 'origin/2.0'
Diffstat (limited to 'src/libs/installer/componentchecker.cpp')
-rw-r--r--src/libs/installer/componentchecker.cpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/libs/installer/componentchecker.cpp b/src/libs/installer/componentchecker.cpp
index c3bf79cb5..4e2260165 100644
--- a/src/libs/installer/componentchecker.cpp
+++ b/src/libs/installer/componentchecker.cpp
@@ -37,6 +37,7 @@
#include "component.h"
#include "constants.h"
#include "packagemanagercore.h"
+#include "globals.h"
namespace QInstaller {
@@ -59,6 +60,7 @@ QStringList ComponentChecker::checkComponent(Component *component)
const bool defaultPropertyScriptValue = component->variables().value(scDefault).compare(scScript, Qt::CaseInsensitive) == 0;
const bool defaultPropertyValue = component->variables().value(scDefault).compare(scTrue, Qt::CaseInsensitive) == 0;
const QStringList autoDependencies = component->autoDependencies();
+ const QList<Component *> allComponents = core->components(PackageManagerCore::ComponentType::All);
if (!autoDependencies.isEmpty()) {
if (component->forcedInstallation()) {
checkResult << QString::fromLatin1("Component %1 specifies \"ForcedInstallation\" property "
@@ -81,7 +83,6 @@ QStringList ComponentChecker::checkComponent(Component *component)
.arg(component->name());
}
const QStringList dependencies = component->dependencies();
- const QList<Component *> allComponents = core->components(PackageManagerCore::ComponentType::All);
foreach (const QString &dependency, dependencies) {
Component *dependencyComponent = PackageManagerCore::componentByName(
dependency, allComponents);
@@ -118,16 +119,25 @@ QStringList ComponentChecker::checkComponent(Component *component)
}
}
if (component->childCount()) {
- const QStringList autoDependencies = component->autoDependencies();
if (!autoDependencies.isEmpty()) {
+ /* Use case:
+
+ A (depends on C)
+ A.B
+ C
+
+ Let's say we installed everything.
+ Running maintenance tool and unselecting C will mark A for uninstallation too,
+ while A.B stays marked as installed.
+ After running maintenance tool again, it will check A automatically
+ (since its child is selected), this will also mark C for installation (dependecy).
+ Moreover, the "Next" button will be disabled.
+ */
checkResult << QString::fromLatin1("Component %1 auto depends on other components "
"while having child components. This will not work properly.")
.arg(component->name());
}
- // TODO: search also for components which autodepend on "component"
- // (something like core->autodependees(component))
-
if (!component->dependencies().isEmpty()) {
checkResult << QString::fromLatin1("Component %1 depends on other components "
"while having child components. This will not work properly.")
@@ -135,11 +145,34 @@ QStringList ComponentChecker::checkComponent(Component *component)
}
if (!core->dependees(component).isEmpty()) {
+ /*
+ Use case:
+
+ A
+ A.B
+ C (depends on A)
+
+ Selecting C marks A for installation too, A.B is not marked for installation.
+ So after installation, A and C are installed, while A.B is not.
+ Maintenance tool will uncheck A automatically
+ (since none of its children are installed) this will also mark C
+ for uninstallation (dependency).
+ Moreover, the "Next" button will be disabled.
+ */
checkResult << QString::fromLatin1("Other components depend on component %1 "
"which has child components. This will not work properly.")
.arg(component->name());
}
}
+ foreach (const QString &autoDependency, autoDependencies) {
+ Component *autoDependencyComponent = PackageManagerCore::componentByName(
+ autoDependency, allComponents);
+ if (autoDependencyComponent && autoDependencyComponent->childCount()) {
+ checkResult << QString::fromLatin1("Component %1 auto depends on component %2 "
+ "which has children components. This will not work properly.")
+ .arg(component->name(), autoDependencyComponent->name());
+ }
+ }
}
return checkResult;