diff options
author | Pascal Rapicault | 2010-05-14 19:22:11 +0000 |
---|---|---|
committer | Pascal Rapicault | 2010-05-14 19:22:11 +0000 |
commit | 55007022e33a4af56b0c5904c743516feb75e043 (patch) | |
tree | eb3e711dae3670e6ee6928604a8d1273a5dc73c3 /bundles | |
parent | e524783c3ab0c2ceedbb968c03a2a34cf2ae3a7b (diff) | |
download | rt.equinox.p2-55007022e33a4af56b0c5904c743516feb75e043.tar.gz rt.equinox.p2-55007022e33a4af56b0c5904c743516feb75e043.tar.xz rt.equinox.p2-55007022e33a4af56b0c5904c743516feb75e043.zip |
Remove initial profile
Diffstat (limited to 'bundles')
3 files changed, 19 insertions, 1 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..2edc2d9a0 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 @@ -231,6 +231,8 @@ public class DirectorApplication implements IApplication { private IProvisioningAgent targetAgent; private boolean noArtifactRepositorySpecified = false; + private long newProfile = -1; + private ProfileChangeRequest buildProvisioningRequest(IProfile profile, Collection<IInstallableUnit> installs, Collection<IInstallableUnit> uninstalls) { ProfileChangeRequest request = new ProfileChangeRequest(profile); markRoots(request, installs); @@ -351,6 +353,7 @@ public class DirectorApplication implements IApplication { if (profileProperties != null) putProperties(profileProperties, props); profile = ((IProfileRegistry) targetAgent.getService(IProfileRegistry.SERVICE_NAME)).addProfile(profileId, props); + newProfile = profile.getTimestamp(); } return profile; } @@ -548,6 +551,7 @@ public class DirectorApplication implements IApplication { ProfileChangeRequest request = buildProvisioningRequest(profile, installs, uninstalls); printRequest(request); planAndExecute(profile, context, request); + removeJunkProfile(profile); } finally { // if we were originally were set to be roaming and we changed it, change it back before we return if (wasRoaming && !Boolean.valueOf(profile.getProperty(IProfile.PROP_ROAMING)).booleanValue()) @@ -555,6 +559,18 @@ public class DirectorApplication implements IApplication { } } + private void removeJunkProfile(IProfile profile) { + if (newProfile == -1) + return; + + //Remove the initial profile entry that is created when the profile is first created during a provisioning operation + try { + ((IProfileRegistry) targetAgent.getService(IProfileRegistry.SERVICE_NAME)).removeProfile(profile.getProfileId(), newProfile); + } catch (ProvisionException e) { + LogHelper.log(new Status(IStatus.OK, Activator.ID, NLS.bind(Messages.could_not_remove_initialProfile, profile.getProfileId()))); + } + } + private void planAndExecute(IProfile profile, ProvisioningContext context, ProfileChangeRequest request) throws CoreException { IProvisioningPlan result = planner.getProvisioningPlan(request, context, new NullProgressMonitor()); IStatus operationStatus = result.getStatus(); 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 872d2964c..a2eeec53d 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 @@ -15,6 +15,8 @@ import org.eclipse.osgi.util.NLS; public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.director.app.messages"; //$NON-NLS-1$ + public static String could_not_remove_initialProfile; + public static String Deprecated_application; public static String Ambigous_Command; public static String Application_NoManager; 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 48dc5cff3..eae7a12ef 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 @@ -61,4 +61,4 @@ Missing_profile = The profile to revert to could not be found. problem_CallingDirector=A problem occured while invoking the director. problem_repoMustBeURI = The repository location ({0}) must be a URI. unableToWriteLogFile=Unable to write to the log file {0}. - +could_not_remove_initialProfile=Could not remove the initial profile created {0}. |