Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel LeBerre2010-04-30 04:11:59 -0400
committerDaniel LeBerre2010-04-30 04:11:59 -0400
commitbbb6f2fd5bade92d6102a206ee7289f0e0c80fa8 (patch)
treec5da5cf8e4d97c744d29aed74f0c0172a625b9e3
parent9a812ae852eb2b703dcd232a584041ebdbeb83ce (diff)
downloadrt.equinox.p2-bbb6f2fd5bade92d6102a206ee7289f0e0c80fa8.tar.gz
rt.equinox.p2-bbb6f2fd5bade92d6102a206ee7289f0e0c80fa8.tar.xz
rt.equinox.p2-bbb6f2fd5bade92d6102a206ee7289f0e0c80fa8.zip
Bug 270668 - [planner] Improve explanation when the installed element has a non matching filter
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties2
6 files changed, 45 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java
index a1a168541..77cc6c1e4 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java
@@ -116,13 +116,35 @@ public abstract class Explanation implements Comparable<Explanation> {
}
}
+ public static class NotInstallableRoot extends Explanation {
+ public final IRequirement req;
+
+ public NotInstallableRoot(IRequirement req) {
+ this.req = req;
+ }
+
+ public String toString() {
+ return NLS.bind(Messages.Explanation_missingRootFilter, req);
+ }
+
+ public IStatus toStatus() {
+ return new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.Explanation_missingRootFilter, req));
+ }
+
+ protected int orderValue() {
+ return 2;
+ }
+ }
+
public static class MissingIU extends Explanation {
public final IInstallableUnit iu;
public final IRequirement req;
+ public boolean isEntryPoint;
- public MissingIU(IInstallableUnit iu, IRequirement req) {
+ public MissingIU(IInstallableUnit iu, IRequirement req, boolean isEntryPoint) {
this.iu = iu;
this.req = req;
+ this.isEntryPoint = isEntryPoint;
}
public int orderValue() {
@@ -134,6 +156,9 @@ public abstract class Explanation implements Comparable<Explanation> {
}
public String toString() {
+ if (isEntryPoint) {
+ return NLS.bind(Messages.Explanation_missingRootRequired, req);
+ }
if (req.getFilter() == null) {
return NLS.bind(Messages.Explanation_missingRequired, iu, req);
}
@@ -141,6 +166,9 @@ public abstract class Explanation implements Comparable<Explanation> {
}
public IStatus toStatus() {
+ if (isEntryPoint) {
+ return new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.Explanation_missingRootRequired, req));
+ }
if (req.getFilter() == null) {
return new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.Explanation_missingRequired, getUserReadableName(iu), req));
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java
index 72b9e11b5..7e04e0648 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java
@@ -39,8 +39,10 @@ public class Messages extends NLS {
public static String Explanation_hardDependency;
public static String Explanation_patchedHardDependency;
public static String Explanation_missingRequired;
+ public static String Explanation_missingRootRequired;
public static String Explanation_missingNonGreedyRequired;
public static String Explanation_missingRequiredFilter;
+ public static String Explanation_missingRootFilter;
public static String Explanation_optionalDependency;
public static String Explanation_rootMissing;
public static String Explanation_rootSingleton;
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 764200c64..e04c66a5f 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
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
+import org.eclipse.equinox.internal.p2.director.Explanation.NotInstallableRoot;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
import org.eclipse.equinox.p2.metadata.*;
@@ -368,7 +369,7 @@ public class Projector {
if (DEBUG) {
Tracing.debug(iu + "=0"); //$NON-NLS-1$
}
- dependencyHelper.setFalse(iu, new Explanation.MissingIU(iu, req));
+ dependencyHelper.setFalse(iu, new Explanation.MissingIU(iu, req, iu == this.entryPoint));
}
// Check whether the requirement is applicable
@@ -416,7 +417,11 @@ public class Projector {
}
if (req.getMin() > 0) {
if (matches.isEmpty()) {
- missingRequirement(iu, req);
+ if (iu == entryPoint && emptyBecauseFiltered) {
+ dependencyHelper.setFalse(iu, new NotInstallableRoot(req));
+ } else {
+ missingRequirement(iu, req);
+ }
} else {
if (req.isGreedy()) {
IInstallableUnit reqIu = matches.get(0);
@@ -853,6 +858,8 @@ public class Projector {
createNegation(iu, req);
}
+ private boolean emptyBecauseFiltered;
+
/**
* @param req
* @return a list of mandatory requirements if any, an empty list if req.isOptional().
@@ -866,6 +873,7 @@ public class Projector {
target.add(match);
}
}
+ emptyBecauseFiltered = !matches.isEmpty() && target.isEmpty();
return target;
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
index 7fea137f2..43e65dc70 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
@@ -317,12 +317,12 @@ public class SimplePlanner implements IPlanner {
Slicer slicer = new Slicer(new QueryableArray(availableIUs), newSelectionContext, satisfyMetaRequirements(profileChangeRequest.getProfileProperties()));
IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {(IInstallableUnit) updatedPlan[0]}, sub.newChild(ExpandWork / 4));
- slicer.getNonGreedyIUs();
if (slice == null) {
IProvisioningPlan plan = engine.createPlan(profile, context);
plan.setStatus(slicer.getStatus());
return plan;
}
+ slice = new CompoundQueryable<IInstallableUnit>(new IQueryable[] {slice, new QueryableArray(profileChangeRequest.getAdditions().toArray(new IInstallableUnit[profileChangeRequest.getAdditions().size()]))});
Projector projector = new Projector(slice, newSelectionContext, slicer.getNonGreedyIUs(), satisfyMetaRequirements(profileChangeRequest.getProfileProperties()));
projector.encode((IInstallableUnit) updatedPlan[0], (IInstallableUnit[]) updatedPlan[1], profile, profileChangeRequest.getAdditions(), sub.newChild(ExpandWork / 4));
IStatus s = projector.invokeSolver(sub.newChild(ExpandWork / 4));
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
index dff0c135f..4f5d87a76 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
@@ -85,7 +85,7 @@ public class Slicer {
private void validateInput(IInstallableUnit[] ius) {
for (int i = 0; i < ius.length; i++) {
if (!isApplicable(ius[i]))
- throw new IllegalStateException("The IU " + ius[i] + " can't be installed in this environment because its filter does not match."); //$NON-NLS-1$//$NON-NLS-2$
+ throw new IllegalStateException(NLS.bind(Messages.Explanation_missingRootFilter, ius[i]));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties
index 42e255c12..f91eb82bd 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties
@@ -25,8 +25,10 @@ Explanation_fromPatch=From Patch: {0}
Explanation_hardDependency=Cannot satisfy dependency: {0} depends on: {1}
Explanation_patchedHardDependency=Cannot satisfy patched ({0}) dependency: {1} depends on: {2}
Explanation_missingRequired=Missing requirement: {0} requires ''{1}'' but it could not be found
+Explanation_missingRootRequired=You requested to install ''{0}'' but it could not be found
Explanation_missingNonGreedyRequired=Missing non greedy requirement: ''{0}'' is required non greedily but it could not be found
Explanation_missingRequiredFilter=Missing requirement for filter {0}: {1} requires ''{2}'' but it could not be found
+Explanation_missingRootFilter={0} can't be installed in this environment because its filter is not applicable.
Explanation_optionalDependency=Optional dependency
Explanation_rootMissing=Cannot complete the install because one or more required items could not be found.
Explanation_rootSingleton=Cannot complete the install because of a conflicting dependency.

Back to the top