Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2011-04-11 00:06:19 -0400
committerPascal Rapicault2011-04-11 00:06:19 -0400
commit32d32d7038ee02b115135571e2c81e32b57b3b84 (patch)
tree3d11a3717ead1001ce5af2c8ca314b5a3466cbad
parent113a71498908d2e5dfc09042b5d891d9c6fd1930 (diff)
downloadrt.equinox.p2-32d32d7038ee02b115135571e2c81e32b57b3b84.tar.gz
rt.equinox.p2-32d32d7038ee02b115135571e2c81e32b57b3b84.tar.xz
rt.equinox.p2-32d32d7038ee02b115135571e2c81e32b57b3b84.zip
Add resolution mode in the slicing options
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java6
3 files changed, 40 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
index b748d3689..327ea2a47 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
@@ -22,8 +22,11 @@ import org.eclipse.equinox.internal.p2.director.PermissiveSlicer;
import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.internal.repository.mirroring.*;
import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.planner.IPlanner;
+import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
@@ -320,9 +323,30 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
return new FileMirrorLog(absolutePath, 0, root);
}
+ private IQueryable<IInstallableUnit> performResolution(IProgressMonitor monitor) throws ProvisionException {
+ IProfileRegistry registry = Activator.getProfileRegistry();
+ String profileId = "MirrorApplication-" + System.currentTimeMillis();
+ IProfile profile = registry.addProfile(profileId, slicingOptions.getFilter());
+ IPlanner planner = (IPlanner) Activator.getAgent().getService(IPlanner.SERVICE_NAME);
+ if (planner == null)
+ throw new IllegalStateException();
+ IProfileChangeRequest pcr = planner.createChangeRequest(profile);
+ pcr.addAll(sourceIUs);
+ IProvisioningPlan plan = planner.getProvisioningPlan(pcr, null, monitor);
+ registry.removeProfile(profileId);
+ IQueryable<IInstallableUnit>[] arr = new IQueryable[plan.getInstallerPlan() == null ? 1 : 2];
+ arr[0] = plan.getAdditions();
+ if (plan.getInstallerPlan() != null)
+ arr[1] = plan.getInstallerPlan().getAdditions();
+ return new CompoundQueryable<IInstallableUnit>(arr);
+ }
+
private IQueryable<IInstallableUnit> slice(IProgressMonitor monitor) throws ProvisionException {
if (slicingOptions == null)
slicingOptions = new SlicingOptions();
+ if (slicingOptions.getInstallTimeLikeResolution())
+ return performResolution(monitor);
+
PermissiveSlicer slicer = new PermissiveSlicer(getCompositeMetadataRepository(), slicingOptions.getFilter(), slicingOptions.includeOptionalDependencies(), slicingOptions.isEverythingGreedy(), slicingOptions.forceFilterTo(), slicingOptions.considerStrictDependencyOnly(), slicingOptions.followOnlyFilteredRequirements());
IQueryable<IInstallableUnit> slice = slicer.slice(sourceIUs.toArray(new IInstallableUnit[sourceIUs.size()]), monitor);
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java
index 4909ca8ae..52b106b19 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java
@@ -20,6 +20,8 @@ public class SlicingOptions {
private boolean considerStrictDependencyOnly = false;
private boolean followOnlyFilteredRequirements = false;
private boolean latestVersion = false;
+ private boolean resolve = false;
+
private Map<String, String> filter = null;
public boolean includeOptionalDependencies() {
@@ -79,4 +81,12 @@ public class SlicingOptions {
public void latestVersionOnly(boolean latest) {
this.latestVersion = latest;
}
+
+ public void installTimeLikeResolution(boolean resolve) {
+ this.resolve = resolve;
+ }
+
+ public boolean getInstallTimeLikeResolution() {
+ return resolve;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java
index fe94b51fb..d5e5ca4de 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java
@@ -29,6 +29,7 @@ public class SlicingOption extends Task {
options.everythingGreedy(true);
options.includeOptionalDependencies(true);
options.followOnlyFilteredRequirements(false);
+ options.installTimeLikeResolution(false);
setIncludeFeatures(true);
}
@@ -104,7 +105,12 @@ public class SlicingOption extends Task {
options.latestVersionOnly(latest);
}
+ public void setResolve(boolean resolve) {
+ options.installTimeLikeResolution(resolve);
+ }
+
public SlicingOptions getOptions() {
return options;
}
+
}

Back to the top