Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java9
2 files changed, 16 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
index db4520848..64623eb24 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
@@ -294,14 +294,16 @@ public class Projector {
}
Collections.sort(conflictingEntries, Collections.reverseOrder());
BigInteger weight = POWER;
- boolean installedIuMet = false;
- boolean rootedMet = false;
+ // have we already found a version that is already installed?
+ boolean foundInstalled = false;
+ // have we already found a version that is in the new roots?
+ boolean foundRoot = false;
for (IInstallableUnit iu : conflictingEntries) {
- if (!rootedMet && isInstalled(iu) && !transitiveClosure.contains(iu)) {
- installedIuMet = true;
+ if (!foundRoot && isInstalled(iu) && !transitiveClosure.contains(iu)) {
+ foundInstalled = true;
weightedObjects.add(WeightedObject.newWO(iu, BigInteger.ONE));
- } else if (!installedIuMet && !rootedMet && isRoot(iu, newRoots)) {
- rootedMet = true;
+ } else if (!foundInstalled && !foundRoot && isRoot(iu, newRoots)) {
+ foundRoot = true;
weightedObjects.add(WeightedObject.newWO(iu, BigInteger.ONE));
} else {
weightedObjects.add(WeightedObject.newWO(iu, weight));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java
index 71fe40b99..5a09fc590 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java
@@ -54,14 +54,19 @@ public class Bug362692 extends AbstractPlannerTest {
Set<IInstallableUnit> toAdd = new HashSet<IInstallableUnit>();
IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
// we don't want to re-install units which are already installed in the profile so remove them. (this is what the reconciler does)
+ boolean already = false;
for (Iterator<IInstallableUnit> iter = allIUs.iterator(); iter.hasNext();) {
IInstallableUnit iu = iter.next();
queryResult = getProfile().query(QueryUtil.createIUQuery(iu.getId(), iu.getVersion()), new NullProgressMonitor());
if (queryResult.isEmpty())
toAdd.add(iu);
- else
+ else {
System.out.println("Already installed: " + iu.getId() + " " + iu.getVersion());
+ already = true;
+ }
}
+ if (!already)
+ System.out.println("Already installed: None!");
validate(expected, toAdd);
// set the metadata repositories on the provisioning context. one for the dropins and one for the shared area
@@ -73,6 +78,8 @@ public class Bug362692 extends AbstractPlannerTest {
IProfileChangeRequest actualChangeRequest = createProfileChangeRequest(toAdd, null, null);
IProvisioningPlan plan = planner.getProvisioningPlan(actualChangeRequest, context, new NullProgressMonitor());
Collection compressedPlan = compress(plan);
+ if (compressedPlan.isEmpty())
+ System.out.println("Plan: ...is empty!");
for (Iterator iter = compressedPlan.iterator(); iter.hasNext();) {
System.out.println("Plan: " + iter.next());
}

Back to the top