Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2010-05-26 21:39:22 +0000
committerPascal Rapicault2010-05-26 21:39:22 +0000
commit3dd8a00b5641bf6ed86e6567967dd53539d519e7 (patch)
treeb45bee583539712862015d306c214e5b47fd6ec5
parent05cd92f15e1e9e2249a35adc5553caa51de8d74c (diff)
downloadrt.equinox.p2-3dd8a00b5641bf6ed86e6567967dd53539d519e7.tar.gz
rt.equinox.p2-3dd8a00b5641bf6ed86e6567967dd53539d519e7.tar.xz
rt.equinox.p2-3dd8a00b5641bf6ed86e6567967dd53539d519e7.zip
Bug 311393 - [engine] ProvisioningContext always perform reference following for artifact repositoriesv20100527
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties1
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java10
4 files changed, 25 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
index 8f400a55f..47cce150f 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
@@ -131,12 +131,15 @@ public class DirectorApplication implements IApplication {
private static final CommandLineOption OPTION_P2_ARCH = new CommandLineOption(new String[] {"-p2.arch"}, null, Messages.Help_The_ARCH_when_profile_is_created); //$NON-NLS-1$
private static final CommandLineOption OPTION_P2_NL = new CommandLineOption(new String[] {"-p2.nl"}, null, Messages.Help_The_NL_when_profile_is_created); //$NON-NLS-1$
private static final CommandLineOption OPTION_PURGEHISTORY = new CommandLineOption(new String[] {"-purgeHistory"}, null, Messages.Help_Purge_the_install_registry); //$NON-NLS-1$
+ private static final CommandLineOption OPTION_FOLLOW_REFERENCES = new CommandLineOption(new String[] {"-followReferences"}, null, Messages.Help_Follow_references); //$NON-NLS-1$
private static final Integer EXIT_ERROR = new Integer(13);
static private final String FLAVOR_DEFAULT = "tooling"; //$NON-NLS-1$
static private final String PROP_P2_PROFILE = "eclipse.p2.profile"; //$NON-NLS-1$
static private final String NO_ARTIFACT_REPOSITORIES_AVAILABLE = "noArtifactRepositoriesAvailable"; //$NON-NLS-1$
+ private static final String FOLLOW_ARTIFACT_REPOSITORY_REFERENCES = "org.eclipse.equinox.p2.director.followArtifactRepositoryReferences"; //$NON-NLS-1$
+
public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
private static void getURIs(List<URI> uris, String spec) throws CoreException {
@@ -214,6 +217,7 @@ public class DirectorApplication implements IApplication {
private boolean roamingProfile = false;
private boolean purgeRegistry = false;
private boolean stackTrace = false;
+ private boolean followReferences = false;
private String profileId;
private String profileProperties; // a comma-separated list of property pairs "tag=value"
private String ws;
@@ -545,6 +549,8 @@ public class DirectorApplication implements IApplication {
ProvisioningContext context = new ProvisioningContext(targetAgent);
context.setMetadataRepositories(metadataRepositoryLocations.toArray(new URI[metadataRepositoryLocations.size()]));
context.setArtifactRepositories(artifactRepositoryLocations.toArray(new URI[artifactRepositoryLocations.size()]));
+ context.setProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES, String.valueOf(followReferences));
+ context.setProperty(FOLLOW_ARTIFACT_REPOSITORY_REFERENCES, String.valueOf(followReferences));
ProfileChangeRequest request = buildProvisioningRequest(profile, installs, uninstalls);
printRequest(request);
planAndExecute(profile, context, request);
@@ -714,6 +720,11 @@ public class DirectorApplication implements IApplication {
continue;
}
+ if (OPTION_FOLLOW_REFERENCES.isOption(opt)) {
+ followReferences = true;
+ continue;
+ }
+
if (OPTION_P2_OS.isOption(opt)) {
os = getRequiredArgument(args, ++i);
continue;
@@ -838,6 +849,8 @@ public class DirectorApplication implements IApplication {
ProvisioningContext context = new ProvisioningContext(targetAgent);
context.setMetadataRepositories(metadataRepositoryLocations.toArray(new URI[metadataRepositoryLocations.size()]));
context.setArtifactRepositories(artifactRepositoryLocations.toArray(new URI[artifactRepositoryLocations.size()]));
+ context.setProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES, String.valueOf(followReferences));
+ context.setProperty(FOLLOW_ARTIFACT_REPOSITORY_REFERENCES, String.valueOf(followReferences));
executePlan(context, plan);
}
@@ -918,7 +931,7 @@ public class DirectorApplication implements IApplication {
}
private void performHelpInfo() {
- CommandLineOption[] allOptions = new CommandLineOption[] {OPTION_HELP, OPTION_LIST, OPTION_INSTALL_IU, OPTION_UNINSTALL_IU, OPTION_REVERT, OPTION_DESTINATION, OPTION_METADATAREPOS, OPTION_ARTIFACTREPOS, OPTION_REPOSITORIES, OPTION_VERIFY_ONLY, OPTION_PROFILE, OPTION_FLAVOR, OPTION_SHARED, OPTION_BUNDLEPOOL, OPTION_PROFILE_PROPS, OPTION_ROAMING, OPTION_P2_OS, OPTION_P2_WS, OPTION_P2_ARCH, OPTION_P2_NL, OPTION_PURGEHISTORY};
+ CommandLineOption[] allOptions = new CommandLineOption[] {OPTION_HELP, OPTION_LIST, OPTION_INSTALL_IU, OPTION_UNINSTALL_IU, OPTION_REVERT, OPTION_DESTINATION, OPTION_METADATAREPOS, OPTION_ARTIFACTREPOS, OPTION_REPOSITORIES, OPTION_VERIFY_ONLY, OPTION_PROFILE, OPTION_FLAVOR, OPTION_SHARED, OPTION_BUNDLEPOOL, OPTION_PROFILE_PROPS, OPTION_ROAMING, OPTION_P2_OS, OPTION_P2_WS, OPTION_P2_ARCH, OPTION_P2_NL, OPTION_PURGEHISTORY, OPTION_FOLLOW_REFERENCES};
for (int i = 0; i < allOptions.length; ++i) {
allOptions[i].appendHelp(System.out);
}
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java
index a2eeec53d..8f3163b4c 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java
@@ -52,6 +52,7 @@ public class Messages extends NLS {
public static String Help_Revert_to_previous_state;
public static String Help_Use_a_shared_location_for_the_install;
public static String Help_Purge_the_install_registry;
+ public static String Help_Follow_references;
public static String Ignored_repo;
public static String Installing;
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties
index eae7a12ef..ab49951b5 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties
@@ -54,6 +54,7 @@ Help_The_NL_when_profile_is_created=The language to use when the profile is crea
Help_The_OS_when_profile_is_created=The OS to use when the profile is created.
Help_The_WS_when_profile_is_created=The windowing system to use when the profile is created.
Help_Purge_the_install_registry=Remove the history of the profile registry.
+Help_Follow_references=Follow repository references.
unable_to_parse_0_to_uri_1=Unable to parse {0} into an URI: {1}.
unknown_option_0=Unknown option {0}. Use -help for a list of known options.
Help_Missing_argument=The argument specifying what to install or uninstall is missing.
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
index 47d55a0cc..ea11ce4a5 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* WindRiver - https://bugs.eclipse.org/bugs/show_bug.cgi?id=227372
+ * Sonatype, Inc. - ongoing development
*******************************************************************************/
package org.eclipse.equinox.p2.engine;
@@ -82,6 +83,8 @@ public class ProvisioningContext {
*/
public static final String FOLLOW_REPOSITORY_REFERENCES = "org.eclipse.equinox.p2.director.followRepositoryReferences"; //$NON-NLS-1$
+ private static final String FOLLOW_ARTIFACT_REPOSITORY_REFERENCES = "org.eclipse.equinox.p2.director.followArtifactRepositoryReferences"; //$NON-NLS-1$
+
/**
* Creates a new provisioning context that includes all available metadata and
* artifact repositories available to the specified provisioning agent.
@@ -93,6 +96,7 @@ public class ProvisioningContext {
// null repos means look at them all
metadataRepositories = null;
artifactRepositories = null;
+ setProperty(FOLLOW_ARTIFACT_REPOSITORY_REFERENCES, Boolean.TRUE.toString());
}
/**
@@ -162,7 +166,7 @@ public class ProvisioningContext {
referencedArtifactRepositories.remove(repositories[i]);
}
// Are there any extra artifact repository references to consider?
- if (referencedArtifactRepositories != null && referencedArtifactRepositories.size() > 0) {
+ if (referencedArtifactRepositories != null && referencedArtifactRepositories.size() > 0 && shouldFollowArtifactReferences()) {
SubMonitor innerSub = SubMonitor.convert(sub.newChild(100), referencedArtifactRepositories.size() * 100);
for (URI referencedURI : referencedArtifactRepositories.values()) {
try {
@@ -247,6 +251,10 @@ public class ProvisioningContext {
return Boolean.valueOf(getProperty(FOLLOW_REPOSITORY_REFERENCES)).booleanValue();
}
+ private boolean shouldFollowArtifactReferences() {
+ return Boolean.valueOf(getProperty(FOLLOW_ARTIFACT_REPOSITORY_REFERENCES)).booleanValue();
+ }
+
/**
* Returns a queryable that can be used to obtain any metadata (installable units)
* that are needed for the provisioning operation.

Back to the top