diff options
-rw-r--r-- | bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF | 2 | ||||
-rw-r--r-- | bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java | 28 |
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) { |