The Slicer returns all missing requirements properly but if there's an attempt
to calculate the minimal explanation, some of these reqirements are cut off and
only the first one is returned to the end user.
Here's the part of code that calculates the explanation:
if (s.getCode() != UNSATISFIABLE || (context != null &&
!(context.getProperty(EXPLANATION) == null ||
Boolean.TRUE.toString().equalsIgnoreCase(context.getProperty(EXPLANATION))))) {
...
return plan; //that plan status contains all
problematic requirements though all substatus codes are "Warning"
}
//Extract the explanation
Set<Explanation> explanation = projector.getExplanation(sub.newChild(ExpandWork
/ 4)); //here some of missing requirements are removed and the only one
remaining is marked as Error.
Test case attached.
What is the minimal explanation supposed to contain?
Thanks,
Katya
________________________________
From: [email protected] [mailto:[email protected]] On Behalf
Of Pascal Rapicault
Sent: Thursday, May 12, 2011 8:56 PM
To: P2 developer discussions
Subject: Re: [p2-dev] Planner explanation question
>From a quick code inspection to SimplePlanner, setting explanation to false
>will completely disable the explanation support (this is used in the case of
>the dropins to avoid computing the explanation since there is no one to read
>it).
Some of the missing requirements are filtered as part of the Slicer (but this
is expected and filter out the noise), but after that the explanation is
constructed by the solver and it tries to return the minimal explanation
between what you have installed and what you are trying to install.
However if you have several missing requirements I think it will stop at the
first one. Is that the pb you are seeing?
If you can provide an automated test case, we could see what can be done.
On 2011-05-12, at 1:40 PM, Todorova, Katya wrote:
Hi guys,
I came across a strange behavior of p2 planner - it hides information when
trying to resolve an IU and resolution fails (due to missing requirements for
example).
If there are more than one missing requirements the final explanation (and
corresponding MultiStatus) will contain only the first one found. This default
behavior
could be avoided if "org.eclipse.equinox.p2.director.explain" property is set
to "false" in the provisioning context used by the planner.
I thought that the explanation is supposed to contain more details than the
"ordinary" status but it turned out it's not the case and it contains even
less. Is that expected?
If yes, any idea why?
Thanks in advance,
Katya
_______________________________________________
p2-dev mailing list
[email protected]<mailto:[email protected]>
https://dev.eclipse.org/mailman/listinfo/p2-dev
### Eclipse Workspace Patch 1.0
#P org.eclipse.equinox.p2.tests
Index: src/org/eclipse/equinox/p2/tests/planner/ExplanationTest.java
===================================================================
RCS file: src/org/eclipse/equinox/p2/tests/planner/ExplanationTest.java
diff -N src/org/eclipse/equinox/p2/tests/planner/ExplanationTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/p2/tests/planner/ExplanationTest.java 1 Jan
1970 00:00:00 -0000
@@ -0,0 +1,37 @@
+package org.eclipse.equinox.p2.tests.planner;
+
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
+import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.planner.IPlanner;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+
+public class ExplanationTest extends AbstractProvisioningTest {
+ IInstallableUnit root;
+ IInstallableUnit b;
+ IInstallableUnit c;
+ IPlanner planner;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ root = createIU("root", Version.create("1.0.0"), new
IRequirement[]
{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new
VersionRange("[1.0.0, 1.0.0]"), null, false, false, true),
MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "missing",
new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true),
MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "C", new
VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}, NO_PROPERTIES,
true);
+
+ b = createIU("B", Version.create("1.0.0"), true);
+
+ c = createIU("C", Version.create("1.0.0"), new IRequirement[]
{MetadataFactory.createRequirement("java.package", "a.b.c", new
VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}, NO_PROPERTIES,
true);
+
+ createTestMetdataRepository(new IInstallableUnit[] {root, b,
c});
+
+ planner = createPlanner();
+ }
+
+ public void testExplanation() {
+ IProfile profile1 = createProfile("TestProfile." + getName());
+ ProfileChangeRequest req = new ProfileChangeRequest(profile1);
+ req.addInstallableUnits(new IInstallableUnit[] {root});
+ ProvisioningContext context = new
ProvisioningContext(getAgent());
+
//context.setProperty("org.eclipse.equinox.p2.director.explain", "false");
+ IProvisioningPlan plan = planner.getProvisioningPlan(req,
context, null);
+ assertEquals("Explanation contains " +
plan.getStatus().getChildren().length + " instead of 4", true,
plan.getStatus().getChildren().length == 4);
+ }
+}
_______________________________________________
p2-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/p2-dev