163 lines
9.6 KiB
Diff
163 lines
9.6 KiB
Diff
--- rt.equinox.p2/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
|
|
+++ rt.equinox.p2/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$
|
|
+ System.setProperty(PROP_IGNORE_USER_CONFIGURATION, "processed_and_unset"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ return true;}
|
|
String baseTimestamp = getBaseTimestamp(profile.getProfileId());
|
|
if (baseTimestamp == null)
|
|
return false;
|
|
--- rt.equinox.p2/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
|
|
+++ rt.equinox.p2/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
|
|
@@ -570,6 +570,7 @@
|
|
|
|
// get all IUs from all our repos
|
|
IQueryResult<IInstallableUnit> allIUs = getAllIUsFromRepos();
|
|
+ HashSet<IInstallableUnit> removedFromAllIUs = new HashSet<IInstallableUnit>();
|
|
for (Iterator<IInstallableUnit> iter = allIUs.iterator(); iter.hasNext();) {
|
|
final IInstallableUnit iu = iter.next();
|
|
IInstallableUnit existing = profileIUs.get(iu);
|
|
@@ -583,6 +584,7 @@
|
|
// (and more expensive) way to find this out is to do an IU profile property query.
|
|
if (two == null) {
|
|
// the IU is already installed so don't mark it as a dropin now - see bug 404619.
|
|
+ removedFromAllIUs.add(iu);
|
|
iter.remove();
|
|
continue;
|
|
}
|
|
@@ -625,7 +627,7 @@
|
|
}
|
|
// if the IU from the profile is in the "all available" list, then it is already added
|
|
// otherwise if it isn't in the repo then we have to remove it from the profile.
|
|
- if (!all.contains(iu))
|
|
+ if (!all.contains(iu) && !removedFromAllIUs.contains(iu))
|
|
toRemove.add(iu);
|
|
}
|
|
|
|
@@ -799,8 +801,8 @@
|
|
IStatus installerPlanStatus = engine.perform(plan.getInstallerPlan(), phaseSet, monitor);
|
|
if (!installerPlanStatus.isOK())
|
|
return installerPlanStatus;
|
|
-
|
|
- applyConfiguration(true);
|
|
+ if (isReconciliationApplicationRunning())
|
|
+ applyConfiguration(true);
|
|
}
|
|
return engine.perform(plan, phaseSet, monitor);
|
|
}
|
|
--- rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java.bak 2013-06-10 09:33:20.000000000 +0200
|
|
+++ rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java 2013-06-11 15:44:28.654682088 +0200
|
|
@@ -144,7 +144,7 @@
|
|
}
|
|
|
|
public boolean performCancel() {
|
|
- String[] buttons = new String[] {IDialogConstants.YES_LABEL, ProvUIMessages.ImportFromInstallationPag_LATER_BUTTON, IDialogConstants.NO_LABEL};
|
|
+ String[] buttons = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL};
|
|
MessageDialog dialog = new MessageDialog(getShell(), ProvUIMessages.ImportFromInstallationPage_CONFIRMATION_TITLE, null, ProvUIMessages.ImportFromInstallationPage_CONFIRMATION_DIALOG, MessageDialog.QUESTION, buttons, 2);
|
|
|
|
return rememberCancellationDecision(dialog.open());
|
|
--- rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationPage_c.java
|
|
+++ rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationPage_c.java
|
|
@@ -15,6 +15,7 @@ package org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration;
|
|
import java.net.URI;
|
|
import org.eclipse.core.runtime.Platform;
|
|
import org.eclipse.equinox.internal.p2.ui.ProvUI;
|
|
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
|
|
import org.eclipse.equinox.internal.p2.ui.dialogs.ISelectableIUsPage;
|
|
import org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard;
|
|
import org.eclipse.equinox.internal.p2.ui.model.ProfileElement;
|
|
@@ -103,6 +104,12 @@ public class ImportFromInstallationPage_c extends AbstractImportPage_c implement
|
|
public org.eclipse.equinox.p2.query.IQueryable<?> getQueryable() {
|
|
return toBeImportedProfile;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public int getQueryType() {
|
|
+ return QueryProvider.STRICT_INSTALLED_IUS;
|
|
+ }
|
|
+
|
|
};
|
|
element.setQueryable(toBeImportedProfile);
|
|
input = element;
|
|
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
|
|
index 9cb6a53..b758ae7 100644
|
|
--- rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
|
|
+++ rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
|
|
@@ -43,6 +43,7 @@ public class QueryProvider {
|
|
public static final int AVAILABLE_UPDATES = 5;
|
|
public static final int INSTALLED_IUS = 6;
|
|
public static final int AVAILABLE_ARTIFACTS = 7;
|
|
+ public static final int STRICT_INSTALLED_IUS = 8;
|
|
|
|
public QueryProvider(ProvisioningUI ui) {
|
|
this.ui = ui;
|
|
@@ -224,6 +225,31 @@ public class QueryProvider {
|
|
return null;
|
|
return new ElementQueryDescriptor(queryable, ArtifactKeyQuery.ALL_KEYS, new Collector<Object>(), new ArtifactKeyWrapper((IArtifactRepository) queryable, element));
|
|
|
|
+ case STRICT_INSTALLED_IUS :
|
|
+ // Querying of IU's. We are drilling down into the requirements.
|
|
+ if (element instanceof IIUElement && context.getShowInstallChildren()) {
|
|
+ Collection<IRequirement> reqs = ((IIUElement) element).getRequirements();
|
|
+ IExpression[] requirementExpressions = new IExpression[reqs.size()];
|
|
+ int i = 0;
|
|
+ for (IRequirement req : reqs) {
|
|
+ requirementExpressions[i++] = req.getMatches();
|
|
+ }
|
|
+ IExpressionFactory factory = ExpressionUtil.getFactory();
|
|
+ IQuery<IInstallableUnit> meetsAnyRequirementQuery = QueryUtil.createMatchQuery(factory.or(requirementExpressions));
|
|
+ IQuery<IInstallableUnit> visibleAsAvailableQuery = policy.getVisibleAvailableIUQuery();
|
|
+ //dropins things have no file property
|
|
+ IQuery<IInstallableUnit> strictQuery = QueryUtil.createIUPropertyQuery("file.name", null); //$NON-NLS-1$
|
|
+ IQuery<IInstallableUnit> createCompoundQuery = QueryUtil.createCompoundQuery(QueryUtil.createCompoundQuery(visibleAsAvailableQuery, meetsAnyRequirementQuery, true), strictQuery, true);
|
|
+ return new ElementQueryDescriptor(queryable, createCompoundQuery, new Collector<IInstallableUnit>(), new InstalledIUElementWrapper(queryable, element));
|
|
+ }
|
|
+
|
|
+ profile = ProvUI.getAdapter(element, IProfile.class);
|
|
+ if (profile == null)
|
|
+ return null;
|
|
+ //dropins things have no file property
|
|
+ IQuery<IInstallableUnit> installedNotDropinsQuery = QueryUtil.createCompoundQuery(policy.getVisibleInstalledIUQuery(), QueryUtil.createIUPropertyQuery("file.name", null), true);
|
|
+ return new ElementQueryDescriptor(profile, installedNotDropinsQuery, new Collector<IInstallableUnit>(), new InstalledIUElementWrapper(profile, element)); //$NON-NLS-1$
|
|
+
|
|
default :
|
|
return null;
|
|
}
|