summaryrefslogtreecommitdiffstats
path: root/installerbuilder
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2011-08-23 16:29:56 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2011-08-23 16:43:24 +0200
commitd4617904c91cb25ac69aa84888d6caf77dd4b1b2 (patch)
tree22efb72d0b3a67d0f2e0f7a873169a9cabdc1534 /installerbuilder
parent4fa9047a8d51bd58c568509500d38cc4f3fd8bde (diff)
Add a working version that resolves auto dependencies.
Still script values are not evaluated yet. Change-Id: Id0bfc87030e74d99c4a531f27774f8b0d2335dda Reviewed-on: http://codereview.qt.nokia.com/3416 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.cpp1
-rw-r--r--installerbuilder/libinstaller/packagemanagercore_p.cpp39
-rw-r--r--installerbuilder/libinstaller/packagemanagercore_p.h1
3 files changed, 33 insertions, 8 deletions
diff --git a/installerbuilder/libinstaller/packagemanagercore.cpp b/installerbuilder/libinstaller/packagemanagercore.cpp
index e10edf823..e4980b705 100644
--- a/installerbuilder/libinstaller/packagemanagercore.cpp
+++ b/installerbuilder/libinstaller/packagemanagercore.cpp
@@ -922,7 +922,6 @@ bool PackageManagerCore::calculateComponentsToUninstall() const
components.append(component);
}
d->m_componentsToUninstall.clear();
- d->m_componentsToUninstallIds.clear();
return d->appendComponentsToUninstall(components);
}
diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp
index a9a2123bd..c3dd72139 100644
--- a/installerbuilder/libinstaller/packagemanagercore_p.cpp
+++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp
@@ -1861,7 +1861,6 @@ bool PackageManagerCorePrivate::appendComponentToUninstall(Component *component)
if (dependees.isEmpty()) {
setCheckedState(component, Qt::Unchecked);
m_componentsToUninstall.insert(component);
- m_componentsToUninstallIds.insert(component->name());
return true;
}
@@ -1871,7 +1870,6 @@ bool PackageManagerCorePrivate::appendComponentToUninstall(Component *component)
// keep them as already resolved
setCheckedState(dependee, Qt::Unchecked);
m_componentsToUninstall.insert(dependee);
- m_componentsToUninstallIds.insert(dependee->name());
// gather possible dependees, keep them to resolve it later
dependeesToResolve.unite(m_core->dependees(dependee).toSet());
}
@@ -1896,20 +1894,49 @@ bool PackageManagerCorePrivate::appendComponentsToUninstall(const QList<Componen
if (component->isInstalled()) {
setCheckedState(component, Qt::Unchecked);
m_componentsToUninstall.insert(component);
- m_componentsToUninstallIds.insert(component->name());
allResolved &= appendComponentToUninstall(component);
}
}
+ QSet<Component*> installedComponents;
+ foreach (const QString &name, localInstalledPackages().keys()) {
+ if (Component *component = m_core->componentByName(name)) {
+ if (!component->uninstallationRequested())
+ installedComponents.insert(component);
+ }
+ }
+
QList<Component*> autoDependOnList;
if (allResolved) {
// All regular dependees are resolved. Now we are looking for auto depend on components.
foreach (Component *component, m_core->availableComponents()) {
// If a components is installed and not yet scheduled for un-installation, check for auto depend.
if (component->isInstalled() && !m_componentsToUninstall.contains(component)) {
- // If we figure out a component requested auto installation, keep it to resolve their deps as
- // well.
- if (component->isAutoDependOn(m_componentsToUninstallIds))
+ QStringList autoDependencies = component->autoDependencies();
+ if (autoDependencies.isEmpty())
+ continue;
+
+ // This code needs to be enabled once the scripts use isInstalled, installationRequested and
+ // uninstallationRequested...
+ if (autoDependencies.first().compare(QLatin1String("script"), Qt::CaseInsensitive) == 0) {
+ //QScriptValue valueFromScript;
+ //try {
+ // valueFromScript = callScriptMethod(QLatin1String("isAutoDependOn"));
+ //} catch (const Error &error) {
+ // // keep the component, should do no harm
+ // continue;
+ //}
+
+ //if (valueFromScript.isValid() && !valueFromScript.toBool())
+ // autoDependOnList.append(component);
+ continue;
+ }
+
+ foreach (Component *c, installedComponents)
+ autoDependencies.removeAll(c->name());
+
+ // A component requested auto installation, keep it to resolve their dependencies as well.
+ if (!autoDependencies.isEmpty())
autoDependOnList.append(component);
}
}
diff --git a/installerbuilder/libinstaller/packagemanagercore_p.h b/installerbuilder/libinstaller/packagemanagercore_p.h
index e688331b3..63c35314e 100644
--- a/installerbuilder/libinstaller/packagemanagercore_p.h
+++ b/installerbuilder/libinstaller/packagemanagercore_p.h
@@ -148,7 +148,6 @@ public:
bool adminRightsGained = false);
QSet<Component*> m_componentsToUninstall;
- QSet<QString> m_componentsToUninstallIds;
bool appendComponentToUninstall(Component *component);
bool appendComponentsToUninstall(const QList<Component*> &components);