diff options
author | Tim Jenssen <tim.jenssen@nokia.com> | 2011-07-29 13:06:52 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2011-07-29 13:06:52 +0200 |
commit | 7696e1637e1a5d96758bb49e6ac0cdcc850179c4 (patch) | |
tree | 4b19cf68355bd5981387ddfedf2eb830af726226 /installerbuilder | |
parent | 68ce78e1ba3f97769fc3736446621c216c03498c (diff) |
now autodepend is recursive and works
Diffstat (limited to 'installerbuilder')
-rw-r--r-- | installerbuilder/libinstaller/component.cpp | 17 | ||||
-rw-r--r-- | installerbuilder/libinstaller/component.h | 2 | ||||
-rw-r--r-- | installerbuilder/libinstaller/packagemanagercore_p.cpp | 8 |
3 files changed, 18 insertions, 9 deletions
diff --git a/installerbuilder/libinstaller/component.cpp b/installerbuilder/libinstaller/component.cpp index e58a40af1..1529fec15 100644 --- a/installerbuilder/libinstaller/component.cpp +++ b/installerbuilder/libinstaller/component.cpp @@ -919,7 +919,7 @@ void Component::setInstalled() /*! Determines if the component comes as an auto dependency. */ -bool Component::isAutoDependOn() const +bool Component::isAutoDependOn(const QSet<QString> &toInstallComponentIds) const { // the script can override this method if (value(scAutoDependOn).compare(QLatin1String("script"), Qt::CaseInsensitive) == 0) { @@ -935,10 +935,17 @@ bool Component::isAutoDependOn() const if (autoDependOnDependencyList.isEmpty()) return false; - QList<Component*> components = d->m_core->availableComponents(); - foreach (Component *component, components) { - if (autoDependOnDependencyList.contains(component->name())) { - autoDependOnDependencyList.removeAll(component->name()); + QSet<QString> installedComponentIds; + foreach (const Component *component, d->m_core->availableComponents()) { + if (component->isInstalled()) { + installedComponentIds.insert(component->name()); + } + } + installedComponentIds.unite(toInstallComponentIds); + //if we found all autodependons we know that this one wants to be installed + foreach (QString componentName, installedComponentIds) { + if (autoDependOnDependencyList.contains(componentName)) { + autoDependOnDependencyList.removeAll(componentName); //found all "when"-components if (autoDependOnDependencyList.isEmpty()) return true; diff --git a/installerbuilder/libinstaller/component.h b/installerbuilder/libinstaller/component.h index 980746daf..7d7bf7d4d 100644 --- a/installerbuilder/libinstaller/component.h +++ b/installerbuilder/libinstaller/component.h @@ -175,7 +175,7 @@ public: Q_INVOKABLE void setInstalled(); Q_INVOKABLE bool isDefault() const; - Q_INVOKABLE bool isAutoDependOn() const; + Q_INVOKABLE bool isAutoDependOn(const QSet<QString> &toInstallComponentIds) const; Q_INVOKABLE bool isInstalled() const; Q_INVOKABLE bool installationRequested() const; diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp index 34e3f2daf..0d1ce0825 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.cpp +++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp @@ -332,19 +332,22 @@ bool PackageManagerCorePrivate::appendComponentsToInstall(const QList<Component* foreach (Component* currentComponent, notAppendedComponents) { allComponentsAdded &= appendComponentToInstall(currentComponent); } + QList<Component*> foundAutoDependOnList; if (allComponentsAdded) { //this means notAppendedComponents are empty, so all regular dependencies are resolved //now we are looking for auto depend on components foreach (Component* currentComponent, m_core->availableComponents()) { if (!currentComponent->isInstalled() && !m_toInstallComponentIds.contains(currentComponent->name()) - && currentComponent->isAutoDependOn()) { + && currentComponent->isAutoDependOn(m_toInstallComponentIds)) { insertInstallReason(currentComponent, QString( tr("component(s) with activated auto depend on "))); - appendComponentToInstall(currentComponent); + foundAutoDependOnList.append(currentComponent); } } } + if (!foundAutoDependOnList.isEmpty()) + return appendComponentsToInstall(foundAutoDependOnList); return allComponentsAdded; } @@ -1831,7 +1834,6 @@ void PackageManagerCorePrivate::realAppendToInstallComponents(Component *compone { m_orderedToInstallComponents.append(component); m_toInstallComponentIds.insert(component->name()); - verbose() << "ADDED: " << component->name() <<" DEPENDENCIES: " << component->dependencies() << std::endl; } void PackageManagerCorePrivate::insertInstallReason(Component *component, const QString &reason) { //keep the first reason |