Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java123
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java198
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/IQueryResult.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/IStatusCodes.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Messages.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlanAnalyzer.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java344
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/messages.properties8
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RelaxedUpdateInstallOperation.java112
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java218
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Remedy.java55
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java57
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java157
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ReducedCUDFParser.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllAnyVersionTests.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279c.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/JBoss.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerIUProperties.java198
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerOneInstalledOneBeingInstalled.java175
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerOneInstalledReplacingIt.java102
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerOneInstalledTwoBeingInstalled.java171
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerRequestWithOptionalInstall.java122
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerRequestWithRemoval.java86
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/iu_add.gifbin0 -> 318 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/iu_remove.gifbin0 -> 351 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizardPage.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java123
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RemediationPage.java343
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java51
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java28
51 files changed, 2752 insertions, 375 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 f9ad8f358..f9d9aae1a 100644
--- a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
@@ -23,10 +23,10 @@ Export-Package: org.eclipse.equinox.internal.p2.director;
org.eclipse.equinox.p2.installer",
org.eclipse.equinox.p2.planner;version="2.0.0"
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0.0)",
- org.sat4j.core;bundle-version="[2.2.0,2.4.0)",
- org.sat4j.pb;bundle-version="[2.2.0,2.4.0)",
org.eclipse.core.jobs;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.equinox.p2.metadata;bundle-version="[2.0.0,3.0.0)"
+ org.eclipse.equinox.p2.metadata;bundle-version="[2.0.0,3.0.0)",
+ org.sat4j.pb;bundle-version="[2.3.3,3.0.0)",
+ org.sat4j.core;bundle-version="[2.3.3,3.0.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
J2SE-1.4,
CDC-1.1/Foundation-1.1
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java
index 55cc3811f..c29fe8811 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java
@@ -23,17 +23,14 @@ public class OptimizationFunction {
private IQueryable<IInstallableUnit> picker;
private IInstallableUnit selectionContext;
- private Map<String, Map<Version, IInstallableUnit>> slice; //The IUs that have been considered to be part of the problem
- private int numberOfInstalledIUs;
+ protected Map<String, Map<Version, IInstallableUnit>> slice; //The IUs that have been considered to be part of the problem
+ private int numberOfInstalledIUs; //TODO this should be renamed to consideredIUs or sliceSize
private IQueryable<IInstallableUnit> lastState;
- private List<AbstractVariable> abstractVariables;
+ private List<AbstractVariable> optionalRequirementVariable;
- // private IInstallableUnit[] alreadyExistingRoots;
- // private IQueryable<IInstallableUnit> beingInstalled;
-
- public OptimizationFunction(IQueryable<IInstallableUnit> lastState, List<AbstractVariable> abstractVariables, IQueryable<IInstallableUnit> picker, IInstallableUnit selectionContext, Map<String, Map<Version, IInstallableUnit>> slice) {
+ public OptimizationFunction(IQueryable<IInstallableUnit> lastState, List<AbstractVariable> abstractVariables, List<AbstractVariable> optionalRequirementVariable, IQueryable<IInstallableUnit> picker, IInstallableUnit selectionContext, Map<String, Map<Version, IInstallableUnit>> slice) {
this.lastState = lastState;
- this.abstractVariables = abstractVariables;
+ this.optionalRequirementVariable = optionalRequirementVariable;
this.picker = picker;
this.selectionContext = selectionContext;
this.slice = slice;
@@ -44,7 +41,7 @@ public class OptimizationFunction {
numberOfInstalledIUs = sizeOf(lastState);
List<WeightedObject<? extends Object>> weightedObjects = new ArrayList<WeightedObject<? extends Object>>();
- Set<IInstallableUnit> transitiveClosure;
+ Set<IInstallableUnit> transitiveClosure; //The transitive closure of the IUs we are adding (this also means updating)
if (newRoots.isEmpty()) {
transitiveClosure = CollectionUtils.emptySet();
} else {
@@ -63,13 +60,15 @@ public class OptimizationFunction {
for (Entry<String, Map<Version, IInstallableUnit>> entry : s) {
List<IInstallableUnit> conflictingEntries = new ArrayList<IInstallableUnit>(entry.getValue().values());
if (conflictingEntries.size() == 1) {
+ //Only one IU exists with the namespace.
IInstallableUnit iu = conflictingEntries.get(0);
if (iu != metaIu) {
weightedObjects.add(WeightedObject.newWO(iu, POWER));
}
continue;
}
- // IUs are sorted from highest version to lowest.
+
+ // Set the weight such that things that are already installed are not updated
Collections.sort(conflictingEntries, Collections.reverseOrder());
BigInteger weight = POWER;
// have we already found a version that is already installed?
@@ -96,14 +95,15 @@ public class OptimizationFunction {
// maximal weight used so far.
maxWeight = maxWeight.multiply(POWER).multiply(BigInteger.valueOf(s.size()));
- // Add the abstract variables
- BigInteger abstractWeight = maxWeight.negate();
- for (AbstractVariable var : abstractVariables) {
- weightedObjects.add(WeightedObject.newWO(var, abstractWeight));
+ // Add the optional variables
+ BigInteger optionalVarWeight = maxWeight.negate();
+ for (AbstractVariable var : optionalRequirementVariable) {
+ weightedObjects.add(WeightedObject.newWO(var, optionalVarWeight));
}
maxWeight = maxWeight.multiply(POWER).add(BigInteger.ONE);
+ //Now we deal the optional IUs,
BigInteger optionalWeight = maxWeight.negate();
long countOptional = 1;
List<IInstallableUnit> requestedPatches = new ArrayList<IInstallableUnit>();
@@ -117,12 +117,11 @@ public class OptimizationFunction {
if (match instanceof IInstallableUnitPatch) {
requestedPatches.add(match);
countOptional = countOptional + 1;
- } else {
- weightedObjects.add(WeightedObject.newWO(match, optionalWeight));
}
}
}
+ // and we make sure that patches are always favored
BigInteger patchWeight = maxWeight.multiply(POWER).multiply(BigInteger.valueOf(countOptional)).negate();
for (Iterator<IInstallableUnit> iterator = requestedPatches.iterator(); iterator.hasNext();) {
weightedObjects.add(WeightedObject.newWO(iterator.next(), patchWeight));
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 59e8eb271..ba401bbd0 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
@@ -11,6 +11,7 @@
* Jed Anderson - switch from opb files to API calls to DependencyHelper in bug 200380
* Sonatype, Inc. - ongoing development
* Rapicorp, Inc. - split the optimization function
+ * Red Hat, Inc. - support for remediation page
******************************************************************************/
package org.eclipse.equinox.internal.p2.director;
@@ -27,9 +28,10 @@ import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.expression.IMatchExpression;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.osgi.util.NLS;
+import org.sat4j.minisat.restarts.LubyRestarts;
import org.sat4j.pb.*;
-import org.sat4j.pb.tools.DependencyHelper;
-import org.sat4j.pb.tools.WeightedObject;
+import org.sat4j.pb.core.PBSolverResolution;
+import org.sat4j.pb.tools.*;
import org.sat4j.specs.*;
/**
@@ -53,7 +55,7 @@ public class Projector {
private IQueryable<IInstallableUnit> picker;
private QueryableArray patches;
- private Map<IInstallableUnit, AbstractVariable> noopVariables; //key IU, value AbstractVariable
+ private List<AbstractVariable> allOptionalAbstractRequirements;
private List<AbstractVariable> abstractVariables;
private Map<String, Map<Version, IInstallableUnit>> slice; //The IUs that have been considered to be part of the problem
@@ -78,6 +80,9 @@ public class Projector {
private Map<IInstallableUnit, AbstractVariable> nonGreedyVariables = new HashMap<IInstallableUnit, AbstractVariable>();
private Map<AbstractVariable, List<Object>> nonGreedyProvider = new HashMap<AbstractVariable, List<Object>>(); //Keeps track of all the "object" that provide an IU that is non greedly requested
+ private boolean emptyBecauseFiltered;
+ private boolean userDefinedFunction;
+
static class AbstractVariable {
// private String name;
@@ -154,24 +159,19 @@ public class Projector {
public Projector(IQueryable<IInstallableUnit> q, Map<String, String> context, Set<IInstallableUnit> nonGreedyIUs, boolean considerMetaRequirements) {
picker = q;
- noopVariables = new HashMap<IInstallableUnit, AbstractVariable>();
slice = new HashMap<String, Map<Version, IInstallableUnit>>();
selectionContext = InstallableUnit.contextIU(context);
abstractVariables = new ArrayList<AbstractVariable>();
+ allOptionalAbstractRequirements = new ArrayList<AbstractVariable>();
result = new MultiStatus(DirectorActivator.PI_DIRECTOR, IStatus.OK, Messages.Planner_Problems_resolving_plan, null);
assumptions = new ArrayList<Object>();
this.nonGreedyIUs = nonGreedyIUs;
this.considerMetaRequirements = considerMetaRequirements;
}
- // protected boolean isInstalled(IInstallableUnit iu) {
- // return !lastState.query(QueryUtil.createIUQuery(iu), null).isEmpty();
- // }
-
@SuppressWarnings("unchecked")
public void encode(IInstallableUnit entryPointIU, IInstallableUnit[] alreadyExistingRoots, IQueryable<IInstallableUnit> installedIUs, Collection<IInstallableUnit> newRoots, IProgressMonitor monitor) {
alreadyInstalledIUs = Arrays.asList(alreadyExistingRoots);
- // numberOfInstalledIUs = sizeOf(installedIUs);
lastState = installedIUs;
this.entryPoint = entryPointIU;
try {
@@ -184,7 +184,14 @@ public class Projector {
if (DEBUG_ENCODING) {
solver = new UserFriendlyPBStringSolver<Object>();
} else {
- solver = SolverFactory.newEclipseP2();
+ if (userDefinedFunction) {
+ PBSolverResolution mysolver = SolverFactory.newCompetPBResLongWLMixedConstraintsObjectiveExpSimp();
+ mysolver.setSimplifier(mysolver.SIMPLE_SIMPLIFICATION);
+ mysolver.setRestartStrategy(new LubyRestarts(512));
+ solver = mysolver;
+ } else {
+ solver = SolverFactory.newEclipseP2();
+ }
}
int timeout = DEFAULT_SOLVER_TIMEOUT;
String timeoutString = null;
@@ -204,10 +211,13 @@ public class Projector {
solver.setTimeoutOnConflicts(timeout);
IQueryResult<IInstallableUnit> queryResult = picker.query(QueryUtil.createIUAnyQuery(), null);
if (DEBUG_ENCODING) {
- dependencyHelper = new DependencyHelper<Object, Explanation>(solver, false);
+ dependencyHelper = new LexicoHelper<Object, Explanation>(solver, false);