almac / rpms / eclipse

Forked from rpms/eclipse 3 years ago
Clone
Krzysztof Daniel 2d61ac2
--- rt.equinox.p2/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
Krzysztof Daniel 2d61ac2
+++ rt.equinox.p2/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
Krzysztof Daniel 2d61ac2
@@ -7,6 +7,7 @@
Krzysztof Daniel 2d61ac2
  * Contributors: 
Krzysztof Daniel 2d61ac2
  *     IBM Corporation - initial API and implementation
Krzysztof Daniel 2d61ac2
  *     Ericsson AB - ongoing development
Krzysztof Daniel 2d61ac2
+ *     Red Hat, Inc. - Bug 408138
Krzysztof Daniel 2d61ac2
  ******************************************************************************/
Krzysztof Daniel 2d61ac2
 package org.eclipse.equinox.internal.p2.engine;
Krzysztof Daniel 2d61ac2
 
Krzysztof Daniel 2d61ac2
@@ -38,6 +39,7 @@ import org.xml.sax.SAXException;
Krzysztof Daniel 2d61ac2
 
Krzysztof Daniel 2d61ac2
 public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
Krzysztof Daniel 2d61ac2
 
Krzysztof Daniel 2d61ac2
+	private static final String PROP_IGNORE_USER_CONFIGURATION = "eclipse.ignoreUserConfiguration"; //$NON-NLS-1$
Krzysztof Daniel 2d61ac2
 	private static final String SIMPLE_PROFILE_REGISTRY_INTERNAL = "_simpleProfileRegistry_internal_"; //$NON-NLS-1$
Krzysztof Daniel 2d61ac2
 	private static final String PROFILE_REGISTRY = "profile registry"; //$NON-NLS-1$
Krzysztof Daniel 2d61ac2
 	private static final String PROFILE_PROPERTIES_FILE = "state.properties"; //$NON-NLS-1$
Krzysztof Daniel 2d61ac2
@@ -263,6 +265,14 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
Krzysztof Daniel 2d61ac2
 					internalSetProfileStateProperty(profile, profile.getTimestamp(), IProfile.STATE_PROP_SHARED_INSTALL, IProfile.STATE_SHARED_INSTALL_VALUE_NEW);
Krzysztof Daniel 2d61ac2
 					internalSetProfileStateProperty(profile, profile.getTimestamp(), SIMPLE_PROFILE_REGISTRY_INTERNAL + getBaseTimestamp(profile.getProfileId()), getBaseTimestamp(id));
Krzysztof Daniel 2d61ac2
 					agent.registerService(SERVICE_SHARED_INSTALL_NEW_TIMESTAMP, Long.toString(profile.getTimestamp()));
Krzysztof Daniel 2d61ac2
+
Krzysztof Daniel 2d61ac2
+					// this looks like a hack, but:
Krzysztof Daniel 2d61ac2
+					// (1) SimpleConfigurationImpl keeps returning master configuration as long as the property is set
Krzysztof Daniel 2d61ac2
+					// (2) SimpleConfigurationImpl sets the propery after it drops user configuration
Krzysztof Daniel 2d61ac2
+					// therefore dropins reconciliation can't load dropins plugins installed into user configuration
Krzysztof Daniel 2d61ac2
+					// after the user configuration has been dropped.
Krzysztof Daniel 2d61ac2
+					// It is necessary to unset this property.
Krzysztof Daniel ec3bf12
+					//System.setProperty(PROP_IGNORE_USER_CONFIGURATION, "processed_and_unset"); //$NON-NLS-1$ //$NON-NLS-2$
Krzysztof Daniel 2d61ac2
 				} else {
Krzysztof Daniel 2d61ac2
 					//This is the first time we create the shared profile. Tag it as such and also remember the timestamp of the base
Krzysztof Daniel 2d61ac2
 					internalSetProfileStateProperty(profile, profile.getTimestamp(), IProfile.STATE_PROP_SHARED_INSTALL, IProfile.STATE_SHARED_INSTALL_VALUE_INITIAL);
Krzysztof Daniel 2d61ac2
@@ -279,6 +289,12 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
Krzysztof Daniel 2d61ac2
 		if (agent.getService(SERVICE_SHARED_INSTALL_NEW_TIMESTAMP) != null)
Krzysztof Daniel 2d61ac2
 			return false;
Krzysztof Daniel 2d61ac2
 
Krzysztof Daniel 2d61ac2
+		// if the property is set by OSGI, and there is no new timestamp (because of the previous condition)
Krzysztof Daniel 2d61ac2
+		// ignore current profile. This will happen only once, because SERVICE_SHARED_INSTALL_NEW_TIMESTAMP
Krzysztof Daniel 2d61ac2
+		// is set during profile reset.
Krzysztof Daniel ec3bf12
+		if ("true".equals(System.getProperty(PROP_IGNORE_USER_CONFIGURATION))){ //$NON-NLS-1$ //$NON-NLS-2$
Krzysztof Daniel ec3bf12
+			System.setProperty(PROP_IGNORE_USER_CONFIGURATION, "processed_and_unset"); //$NON-NLS-1$ //$NON-NLS-2$
Krzysztof Daniel ec3bf12
+			return true;}
Krzysztof Daniel 2d61ac2
 		String baseTimestamp = getBaseTimestamp(profile.getProfileId());
Krzysztof Daniel 2d61ac2
 		if (baseTimestamp == null)
Krzysztof Daniel 2d61ac2
 			return false;
Krzysztof Daniel ec3bf12
--- rt.equinox.p2/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
Krzysztof Daniel ec3bf12
+++ rt.equinox.p2/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
Krzysztof Daniel ec3bf12
@@ -570,6 +570,7 @@
Krzysztof Daniel ec3bf12
 
Krzysztof Daniel ec3bf12
 		// get all IUs from all our repos 
Krzysztof Daniel ec3bf12
 		IQueryResult<IInstallableUnit> allIUs = getAllIUsFromRepos();
Krzysztof Daniel ec3bf12
+		HashSet<IInstallableUnit> removedFromAllIUs = new HashSet<IInstallableUnit>();
Krzysztof Daniel ec3bf12
 		for (Iterator<IInstallableUnit> iter = allIUs.iterator(); iter.hasNext();) {
Krzysztof Daniel ec3bf12
 			final IInstallableUnit iu = iter.next();
Krzysztof Daniel ec3bf12
 			IInstallableUnit existing = profileIUs.get(iu);
Krzysztof Daniel ec3bf12
@@ -583,6 +584,7 @@
Krzysztof Daniel ec3bf12
 				// (and more expensive) way to find this out is to do an IU profile property query.
Krzysztof Daniel ec3bf12
 				if (two == null) {
Krzysztof Daniel ec3bf12
 					// the IU is already installed so don't mark it as a dropin now - see bug 404619.
Krzysztof Daniel ec3bf12
+					removedFromAllIUs.add(iu);
Krzysztof Daniel ec3bf12
 					iter.remove();
Krzysztof Daniel ec3bf12
 					continue;
Krzysztof Daniel ec3bf12
 				}
Krzysztof Daniel ec3bf12
@@ -625,7 +627,7 @@
Krzysztof Daniel ec3bf12
 			}
Krzysztof Daniel ec3bf12
 			// if the IU from the profile is in the "all available" list, then it is already added
Krzysztof Daniel ec3bf12
 			// otherwise if it isn't in the repo then we have to remove it from the profile.
Krzysztof Daniel ec3bf12
-			if (!all.contains(iu))
Krzysztof Daniel ec3bf12
+			if (!all.contains(iu) && !removedFromAllIUs.contains(iu))
Krzysztof Daniel ec3bf12
 				toRemove.add(iu);
Krzysztof Daniel ec3bf12
 		}
Krzysztof Daniel ec3bf12
 
Krzysztof Daniel ec3bf12
@@ -799,8 +801,8 @@
Krzysztof Daniel ec3bf12
 			IStatus installerPlanStatus = engine.perform(plan.getInstallerPlan(), phaseSet, monitor);
Krzysztof Daniel ec3bf12
 			if (!installerPlanStatus.isOK())
Krzysztof Daniel ec3bf12
 				return installerPlanStatus;
Krzysztof Daniel ec3bf12
-
Krzysztof Daniel ec3bf12
-			applyConfiguration(true);
Krzysztof Daniel ec3bf12
+			if (isReconciliationApplicationRunning())
Krzysztof Daniel ec3bf12
+				applyConfiguration(true);
Krzysztof Daniel ec3bf12
 		}
Krzysztof Daniel ec3bf12
 		return engine.perform(plan, phaseSet, monitor);
Krzysztof Daniel ec3bf12
 	}