Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2009-03-09 17:55:03 +0000
committerDJ Houghton2009-03-09 17:55:03 +0000
commit8c3e05ec7649c9025357c65f25575f3b5370069a (patch)
treee516e5197504d9874703096e5b574a7e4fe1e876
parentc45ee29e9703cd8fdaf4c83dbe23e450fa53692a (diff)
downloadrt.equinox.p2-8c3e05ec7649c9025357c65f25575f3b5370069a.tar.gz
rt.equinox.p2-8c3e05ec7649c9025357c65f25575f3b5370069a.tar.xz
rt.equinox.p2-8c3e05ec7649c9025357c65f25575f3b5370069a.zip
Bug 267518 - [planner] p2 should favor optional pieces installed by the userv20090309-1353
-rw-r--r--bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java28
2 files changed, 21 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
index 489efcd98..9c0675f3e 100644
--- a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.director;singleton:=true
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Bundle-Version: 1.0.4.qualifier
+Bundle-Version: 1.0.5.qualifier
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.provisional.p2.core,
org.eclipse.equinox.internal.provisional.p2.core.eventbus,
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 4352a8954..6999ccf65 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
@@ -165,21 +165,33 @@ public class Projector {
}
}
- protected StringBuffer getPatchesWeight(IInstallableUnit ius[], long weight) {
- StringBuffer patchesWeight = new StringBuffer();
- if (patches == null)
- return patchesWeight;
+ protected StringBuffer getPatchesWeight(IInstallableUnit ius[], long optionalWeight) {
+ StringBuffer weights = new StringBuffer();
+ List requestedPatches = new ArrayList(ius.length);
+ int optionalCount = 1;
for (int i = 0; i < ius.length; i++) {
RequiredCapability[] reqs = ius[i].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();
- patchesWeight.append('-').append(weight).append(' ').append(getVariable(match)).append(' ');
+ IInstallableUnit match = (IInstallableUnit) iterator.next();
+ if (match instanceof IInstallableUnitPatch)
+ requestedPatches.add(match);
+ else {
+ weights.append('-').append(optionalWeight).append(' ').append(getVariable(match)).append(' ');
+ optionalCount++;
+ }
}
}
}
- return patchesWeight;
+ long patchesWeight = optionalWeight * 2 * optionalCount;
+ for (Iterator iterator = requestedPatches.iterator(); iterator.hasNext();) {
+ weights.append('-').append(patchesWeight).append(' ').append(getVariable((IInstallableUnit) iterator.next())).append(' ');
+ }
+ return weights;
}
private void createMustHaves(IInstallableUnit iu) {

Back to the top