summaryrefslogtreecommitdiffstats
path: root/src/libs/installer
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@theqtcompany.com>2015-03-11 16:02:32 +0100
committerJarek Kobus <jaroslaw.kobus@theqtcompany.com>2015-03-13 12:26:09 +0000
commit7c5724bb5fdc94c3a9474b2b3a79a33dab64277c (patch)
tree6e96e33591be343f4d017571964fc9c63ffc3beb /src/libs/installer
parent878109b5c49fd641a2509e4c6fdcf4374d876aec (diff)
Inform about superfluous dependencies.
In case B depends on A and B auto depends on A, the first dependency is superfluous. Change-Id: I01a97e0777089fafd43d36b8f9675d7089099885 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Diffstat (limited to 'src/libs/installer')
-rw-r--r--src/libs/installer/componentchecker.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libs/installer/componentchecker.cpp b/src/libs/installer/componentchecker.cpp
index 6b2487668..949ae00cf 100644
--- a/src/libs/installer/componentchecker.cpp
+++ b/src/libs/installer/componentchecker.cpp
@@ -47,7 +47,8 @@ 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;
- if (!component->autoDependencies().isEmpty()) {
+ const QStringList autoDependencies = component->autoDependencies();
+ if (!autoDependencies.isEmpty()) {
if (component->forcedInstallation()) {
checkResult << QString::fromLatin1("Component %1 specifies \"ForcedInstallation\" property "
"together with \"AutoDependOn\" list. This combination of states may not work properly.")
@@ -68,6 +69,17 @@ QStringList ComponentChecker::checkComponent(Component *component)
"component %1. This may not work properly.")
.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);
+ if (autoDependencies.contains(dependencyComponent->name())) {
+ checkResult << QString::fromLatin1("Component %1 specifies both dependency "
+ "and auto dependency on component %2. The dependency might be superfluous.")
+ .arg(component->name(), dependencyComponent->name());
+ }
+ }
}
if (component->packageManagerCore()->isInstaller()) {
if (component->isTristate()) {