diff options
author | Krzysztof Daniel | 2013-05-16 15:50:20 +0000 |
---|---|---|
committer | Pascal Rapicault | 2013-05-16 17:32:52 +0000 |
commit | e54bcf3357346b2223572bb4f352d49935674625 (patch) | |
tree | 8dd81c639361dddb77cc8245cd4e2a19f6f16c87 | |
parent | 247bf1545b01b008b550ad21c83528d9545148bd (diff) | |
download | rt.equinox.p2-e54bcf3357346b2223572bb4f352d49935674625.tar.gz rt.equinox.p2-e54bcf3357346b2223572bb4f352d49935674625.tar.xz rt.equinox.p2-e54bcf3357346b2223572bb4f352d49935674625.zip |
Bug 408138 - Dropins are broken in after master configuration change
First part of the fix. It reestablishes the connection between
SimpleConfiguratorImpl and SimpleProfileRegistry, so when config.ini is
modified, user profile is dropped even without timestamp change.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=408138
-rw-r--r-- | bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java index 8d55e005f..0fb0ecc2c 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java @@ -7,6 +7,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Ericsson AB - ongoing development + * Red Hat, Inc. - Bug 408138 ******************************************************************************/ package org.eclipse.equinox.internal.p2.engine; @@ -38,6 +39,7 @@ import org.xml.sax.SAXException; public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { + private static final String PROP_IGNORE_USER_CONFIGURATION = "eclipse.ignoreUserConfiguration"; //$NON-NLS-1$ private static final String SIMPLE_PROFILE_REGISTRY_INTERNAL = "_simpleProfileRegistry_internal_"; //$NON-NLS-1$ private static final String PROFILE_REGISTRY = "profile registry"; //$NON-NLS-1$ private static final String PROFILE_PROPERTIES_FILE = "state.properties"; //$NON-NLS-1$ @@ -263,6 +265,14 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { internalSetProfileStateProperty(profile, profile.getTimestamp(), IProfile.STATE_PROP_SHARED_INSTALL, IProfile.STATE_SHARED_INSTALL_VALUE_NEW); internalSetProfileStateProperty(profile, profile.getTimestamp(), SIMPLE_PROFILE_REGISTRY_INTERNAL + getBaseTimestamp(profile.getProfileId()), getBaseTimestamp(id)); agent.registerService(SERVICE_SHARED_INSTALL_NEW_TIMESTAMP, Long.toString(profile.getTimestamp())); + + // this looks like a hack, but: + // (1) SimpleConfigurationImpl keeps returning master configuration as long as the property is set + // (2) SimpleConfigurationImpl sets the propery after it drops user configuration + // therefore dropins reconciliation can't load dropins plugins installed into user configuration + // after the user configuration has been dropped. + // It is necessary to unset this property. + System.setProperty(PROP_IGNORE_USER_CONFIGURATION, "processed_and_unset"); //$NON-NLS-1$ //$NON-NLS-2$ } else { //This is the first time we create the shared profile. Tag it as such and also remember the timestamp of the base internalSetProfileStateProperty(profile, profile.getTimestamp(), IProfile.STATE_PROP_SHARED_INSTALL, IProfile.STATE_SHARED_INSTALL_VALUE_INITIAL); @@ -279,6 +289,12 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { if (agent.getService(SERVICE_SHARED_INSTALL_NEW_TIMESTAMP) != null) return false; + // if the property is set by OSGI, and there is no new timestamp (because of the previous condition) + // ignore current profile. This will happen only once, because SERVICE_SHARED_INSTALL_NEW_TIMESTAMP + // is set during profile reset. + if ("true".equals(System.getProperty(PROP_IGNORE_USER_CONFIGURATION))) //$NON-NLS-1$ //$NON-NLS-2$ + return true; + String baseTimestamp = getBaseTimestamp(profile.getProfileId()); if (baseTimestamp == null) return false; |