Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2009-03-07 22:18:44 +0000
committerDJ Houghton2009-03-07 22:18:44 +0000
commit8cddb2cb8e99cac8105bbf7a1b78d53a37e82feb (patch)
treee145f9964133711aa87a6e5c7d7ca4eadf5dca47
parent25dd184bbe4628b675f4309d638f3bb0ec49eeb9 (diff)
downloadrt.equinox.p2-8cddb2cb8e99cac8105bbf7a1b78d53a37e82feb.tar.gz
rt.equinox.p2-8cddb2cb8e99cac8105bbf7a1b78d53a37e82feb.tar.xz
rt.equinox.p2-8cddb2cb8e99cac8105bbf7a1b78d53a37e82feb.zip
Bug 267518 - [planner] p2 should favor optional pieces installed by the user
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java14
1 files changed, 10 insertions, 4 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 21cf3dff8..46b714e5b 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
@@ -224,14 +224,20 @@ public class Projector {
maxWeight = maxWeight.multiply(POWER);
- BigInteger patchWeight = maxWeight.negate();
+ BigInteger optionalWeight = maxWeight.negate();
+ BigInteger patchWeight = maxWeight.multiply(POWER).multiply(POWER).negate();
if (patches != null) {
IRequiredCapability[] reqs = metaIu.getRequiredCapabilities();
for (int j = 0; j < reqs.length; j++) {
- Collector matches = patches.query(new CapabilityQuery(reqs[j]), new Collector(), null);
+ if (!reqs[j].isOptional())
+ continue;
+ Collector matches = picker.query(new CapabilityQuery(reqs[j]), new Collector(), null);
for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
- IInstallableUnitPatch match = (IInstallableUnitPatch) iterator.next();
- weightedObjects.add(WeightedObject.newWO(match, patchWeight));
+ IInstallableUnit match = (IInstallableUnit) iterator.next();
+ if (match instanceof IInstallableUnitPatch)
+ weightedObjects.add(WeightedObject.newWO(match, patchWeight));
+ else
+ weightedObjects.add(WeightedObject.newWO(match, optionalWeight));
}
}

Back to the top