Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2010-01-12 21:06:32 +0000
committerDJ Houghton2010-01-12 21:06:32 +0000
commitff8bbe612ae903e659b398bc18e1feb3c840a1c6 (patch)
tree0e14f03c6cca1efe179827e310f25c8700d8f6a0
parent1433e852fca234c318b03f7f8bb69e04fbec4090 (diff)
downloadrt.equinox.p2-ff8bbe612ae903e659b398bc18e1feb3c840a1c6.tar.gz
rt.equinox.p2-ff8bbe612ae903e659b398bc18e1feb3c840a1c6.tar.xz
rt.equinox.p2-ff8bbe612ae903e659b398bc18e1feb3c840a1c6.zip
Bug 264924 - [reconciler] No diagnosis of dropin problems
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java40
2 files changed, 65 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
index b7bf2f5d8..28588cfc7 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,19 +11,21 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.reconciler.dropins;
-import org.eclipse.equinox.p2.core.ProvisionException;
-
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationArtifactRepository;
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationMetadataRepository;
import org.eclipse.equinox.internal.p2.update.Site;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.RepositoryListener;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
@@ -32,6 +34,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.osgi.util.NLS;
public class DropinsRepositoryListener extends RepositoryListener {
+ private static final String PREFIX = "[reconciler] [dropins] "; //$NON-NLS-1$
private static final String PLUGINS = "plugins"; //$NON-NLS-1$
private static final String FEATURES = "features"; //$NON-NLS-1$
private static final String JAR = ".jar"; //$NON-NLS-1$
@@ -53,15 +56,21 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
public boolean added(File file) {
- if (super.added(file))
+ if (super.added(file)) {
+ if (Tracing.DEBUG_RECONCILER)
+ Tracing.debug(PREFIX + "Interesting feature or bundle added: " + file); //$NON-NLS-1$
return true;
+ }
addRepository(file);
return true;
}
public boolean changed(File file) {
- if (super.changed(file))
+ if (super.changed(file)) {
+ if (Tracing.DEBUG_RECONCILER)
+ Tracing.debug(PREFIX + "Interesting feature or bundle changed: " + file); //$NON-NLS-1$
return true;
+ }
addRepository(file);
return true;
}
@@ -185,11 +194,22 @@ public class DropinsRepositoryListener extends RepositoryListener {
repository = Activator.loadMetadataRepository(repoURL, null);
}
metadataRepositories.add(repository);
+ debugRepository(repository);
} catch (ProvisionException ex) {
LogHelper.log(ex);
}
}
+ private void debugRepository(IMetadataRepository repository) {
+ if (!Tracing.DEBUG_RECONCILER)
+ return;
+ Tracing.debug(PREFIX + "Repository created " + repository.getLocation()); //$NON-NLS-1$
+ // Print out a list of all the IUs in the repository
+ IQueryResult<IInstallableUnit> result = repository.query(InstallableUnitQuery.ANY, new NullProgressMonitor());
+ for (Iterator<IInstallableUnit> iter = result.iterator(); iter.hasNext();)
+ Tracing.debug(PREFIX + "\t" + iter.next()); //$NON-NLS-1$
+ }
+
public void getArtifactRepository(URI repoURL, Map<String, String> properties) {
try {
IArtifactRepository repository = null;
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
index 9419e2889..b2308c470 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -73,7 +73,7 @@ public class ProfileSynchronizer {
return Status.OK_STATUS;
ProvisioningContext context = getContext();
- context.setProperty(EXPLANATION, Boolean.FALSE.toString());
+ context.setProperty(EXPLANATION, new Boolean(Tracing.DEBUG_RECONCILER).toString());
ProfileChangeRequest request = createProfileChangeRequest(context);
String updatedCacheExtensions = synchronizeCacheExtensions();
@@ -96,6 +96,7 @@ public class ProfileSynchronizer {
IStatus status = plan.getStatus();
if (status.getSeverity() == IStatus.ERROR || status.getSeverity() == IStatus.CANCEL)
return status;
+ debug(request, plan);
if (plan.getAdditions().query(InstallableUnitQuery.ANY, null).isEmpty() && plan.getRemovals().query(InstallableUnitQuery.ANY, null).isEmpty()) {
writeTimestamps();
@@ -354,6 +355,41 @@ public class ProfileSynchronizer {
return request;
}
+ private void debug(ProfileChangeRequest request, IProvisioningPlan plan) {
+ if (!Tracing.DEBUG_RECONCILER)
+ return;
+ final String PREFIX = "[reconciler] [plan] "; //$NON-NLS-1$
+ // get the request
+ List<IInstallableUnit> toAdd = new ArrayList<IInstallableUnit>();
+ toAdd.addAll(Arrays.asList(request.getAddedInstallableUnits()));
+ List<IInstallableUnit> toRemove = new ArrayList<IInstallableUnit>();
+ toRemove.addAll(Arrays.asList(request.getRemovedInstallableUnits()));
+ // remove from the request everything what is in the plan
+ Operand[] ops = plan.getOperands();
+ for (int i = 0; i < ops.length; i++) {
+ if (ops[i] instanceof InstallableUnitOperand) {
+ InstallableUnitOperand iuo = (InstallableUnitOperand) ops[i];
+ if (iuo.first() == null && iuo.second() != null)
+ toAdd.remove(iuo.second());
+ if (iuo.first() != null && iuo.second() == null)
+ toRemove.remove(iuo.first());
+ }
+ }
+ // if anything is left in the request, then something is wrong with the plan
+ if (toAdd.size() == 0 && toRemove.size() == 0)
+ Tracing.debug(PREFIX + "Plan matches the request."); //$NON-NLS-1$
+ if (toAdd.size() != 0) {
+ Tracing.debug(PREFIX + "Some units will not be installed, because they are already installed or there are dependency issues:"); //$NON-NLS-1$
+ for (IInstallableUnit unit : toAdd)
+ Tracing.debug(PREFIX + unit);
+ }
+ if (toRemove.size() != 0) {
+ Tracing.debug(PREFIX + "Some units will not be uninstalled:"); //$NON-NLS-1$
+ for (IInstallableUnit unit : toRemove)
+ Tracing.debug(PREFIX + unit);
+ }
+ }
+
/*
* If debugging is turned on, then print out the details for the given profile change request.
*/

Back to the top