Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2010-03-04 15:12:49 +0000
committerDJ Houghton2010-03-04 15:12:49 +0000
commitb536fda962268686d72893f14674479c0e14bee8 (patch)
tree19d6cc539947065cc07f9f7bcd5288aff29fb16c
parentfbfd23f3135a1df4d2ab24ce8473b976b5be0f31 (diff)
downloadrt.equinox.p2-b536fda962268686d72893f14674479c0e14bee8.tar.gz
rt.equinox.p2-b536fda962268686d72893f14674479c0e14bee8.tar.xz
rt.equinox.p2-b536fda962268686d72893f14674479c0e14bee8.zip
Bug 303330 - [reconciler] No diagnosis of dropin problemsv20100304-1012
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.options5
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java77
4 files changed, 104 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.core/.options b/bundles/org.eclipse.equinox.p2.core/.options
index cf100dbed..13d7c0c2f 100644
--- a/bundles/org.eclipse.equinox.p2.core/.options
+++ b/bundles/org.eclipse.equinox.p2.core/.options
@@ -17,4 +17,7 @@ org.eclipse.equinox.p2.core/metadata/parsing=false
org.eclipse.equinox.p2.core/artifacts/mirrors=false
#Detailde debugging information about the projector
-org.eclipse.equinox.p2.core/planner/projector=false \ No newline at end of file
+org.eclipse.equinox.p2.core/planner/projector=false
+
+#Detailed debugging information about the dropins reconciler
+org.eclipse.equinox.p2.core/reconciler=false \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java
index 695dd996c..3ecabe52d 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * 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
@@ -30,6 +30,7 @@ public class Tracing {
public static boolean DEBUG_METADATA_PARSING = false;
public static boolean DEBUG_MIRRORS = false;
public static boolean DEBUG_PLANNER_PROJECTOR = false;
+ public static boolean DEBUG_RECONCILER = false;
static {
DebugOptions options = (DebugOptions) ServiceHelper.getService(Activator.context, DebugOptions.class.getName());
@@ -42,6 +43,7 @@ public class Tracing {
DEBUG_METADATA_PARSING = options.getBooleanOption(Activator.ID + "/metadata/parsing", false); //$NON-NLS-1$
DEBUG_MIRRORS = options.getBooleanOption(Activator.ID + "/artifacts/mirrors", false); //$NON-NLS-1$
DEBUG_PLANNER_PROJECTOR = options.getBooleanOption(Activator.ID + "/planner/projector", false); //$NON-NLS-1$
+ DEBUG_RECONCILER = options.getBooleanOption(Activator.ID + "/reconciler", false); //$NON-NLS-1$
}
}
}
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 42a863046..1f5cede64 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
@@ -14,9 +14,9 @@ import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
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.provisional.p2.artifact.repository.IArtifactRepository;
@@ -24,8 +24,10 @@ import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifact
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.RepositoryListener;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.internal.provisional.p2.query.Collector;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -40,6 +42,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
private static final String LINKS_PATH = "path"; //$NON-NLS-1$
private static final String DROPIN_ARTIFACT_REPOSITORIES = "dropin.artifactRepositories"; //$NON-NLS-1$
private static final String DROPIN_METADATA_REPOSITORIES = "dropin.metadataRepositories"; //$NON-NLS-1$
+ final private String PREFIX = "[reconciler][dropins] "; //$NON-NLS-1$
private static final String PIPE = "|"; //$NON-NLS-1$
private BundleContext context;
private List metadataRepositories = new ArrayList();
@@ -55,8 +58,12 @@ 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;
+ }
URL repositoryURL = createRepositoryURL(file);
if (repositoryURL != null) {
@@ -67,8 +74,12 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
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;
+ }
URL repositoryURL = createRepositoryURL(file);
if (repositoryURL != null) {
@@ -175,6 +186,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
} catch (ProvisionException e) {
repository = Activator.loadMetadataRepository(repoURL, null);
}
+ debugRepository(repository);
metadataRepositories.add(repository);
} catch (ProvisionException ex) {
LogHelper.log(ex);
@@ -301,4 +313,13 @@ public class DropinsRepositoryListener extends RepositoryListener {
return result;
}
+ private void debugRepository(IMetadataRepository repository) {
+ if (!Tracing.DEBUG_RECONCILER)
+ return;
+ Tracing.debug(PREFIX + "Repository created " + repository.getLocation()); //$NON-NLS-1$
+ Collector result = repository.query(InstallableUnitQuery.ANY, new Collector(), new NullProgressMonitor());
+ for (Iterator iter = result.iterator(); iter.hasNext();)
+ Tracing.debug(PREFIX + "\t" + iter.next()); //$NON-NLS-1$
+ }
+
}
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 9fc39a191..8c991f891 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
@@ -15,8 +15,7 @@ import java.net.URL;
import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.*;
import org.eclipse.equinox.internal.p2.extensionlocation.Constants;
import org.eclipse.equinox.internal.provisional.configurator.Configurator;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
@@ -83,14 +82,18 @@ public class ProfileSynchronizer {
ProvisioningContext context = getContext();
ProfileChangeRequest request = createProfileChangeRequest(context);
- if (request == null)
+ if (request == null) {
+ if (Tracing.DEBUG_RECONCILER)
+ Tracing.debug("[reconciler][plan] Empty request");
return Status.OK_STATUS;
+ }
+ debug(request);
SubMonitor sub = SubMonitor.convert(monitor, 100);
try {
//create the provisioning plan
ProvisioningPlan plan = createProvisioningPlan(request, context, sub.newChild(50));
-
+ debug(request, plan);
status = plan.getStatus();
if (status.getSeverity() == IStatus.ERROR || plan.getStatus().getSeverity() == IStatus.CANCEL || plan.getOperands().length == 0)
return status;
@@ -409,4 +412,68 @@ public class ProfileSynchronizer {
}
return false;
}
+
+ private void debug(ProfileChangeRequest request) {
+ if (!Tracing.DEBUG_RECONCILER) {
+ return;
+ }
+ final String PREFIX = "[reconciler][request] "; //$NON-NLS-1$
+ IInstallableUnit[] toAdd = request.getAddedInstallableUnits();
+ if (toAdd == null || toAdd.length == 0) {
+ Tracing.debug(PREFIX + "No installable units to add."); //$NON-NLS-1$
+ } else {
+ for (int i = 0; i < toAdd.length; i++) {
+ Tracing.debug(PREFIX + "Adding IU: " + toAdd[i].getId() + ' ' + toAdd[i].getVersion()); //$NON-NLS-1$
+ }
+ }
+ IInstallableUnit[] toRemove = request.getRemovedInstallableUnits();
+ if (toRemove == null || toRemove.length == 0) {
+ Tracing.debug(PREFIX + "No installable units to remove."); //$NON-NLS-1$
+ } else {
+ for (int i = 0; i < toRemove.length; i++) {
+ Tracing.debug(PREFIX + "Removing IU: " + toRemove[i].getId() + ' ' + toRemove[i].getVersion()); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private void debug(ProfileChangeRequest request, ProvisioningPlan plan) {
+ if (!Tracing.DEBUG_RECONCILER)
+ return;
+ final String PREFIX = "[reconciler][plan] "; //$NON-NLS-1$
+ //get the request
+ List toAdd = new ArrayList();
+ toAdd.addAll(Arrays.asList(request.getAddedInstallableUnits()));
+ List toRemove = new ArrayList();
+ 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 (int i = 0; i < toAdd.size(); i++) {
+ Tracing.debug(PREFIX + toAdd.get(i));
+ }
+ }
+ if (toRemove.size() != 0) {
+ Tracing.debug(PREFIX + "Some units will not be uninstalled:"); //$NON-NLS-1$
+ for (int i = 0; i < toRemove.size(); i++) {
+ Tracing.debug(PREFIX + toRemove.get(i));
+ }
+ }
+ }
}

Back to the top