Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 303330
Collapse All | Expand All

(-).options (-4 / +1 lines)
Lines 17-23 Link Here
17
org.eclipse.equinox.p2.core/artifacts/mirrors=false
17
org.eclipse.equinox.p2.core/artifacts/mirrors=false
18
18
19
#Detailde debugging information about the projector 
19
#Detailde debugging information about the projector 
20
org.eclipse.equinox.p2.core/planner/projector=false
20
org.eclipse.equinox.p2.core/planner/projector=false
21
22
#Detailed debugging information about the dropins reconciler 
23
org.eclipse.equinox.p2.core/reconciler=false
(-)src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java (-3 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2010 IBM Corporation and others.
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 30-36 Link Here
30
	public static boolean DEBUG_METADATA_PARSING = false;
30
	public static boolean DEBUG_METADATA_PARSING = false;
31
	public static boolean DEBUG_MIRRORS = false;
31
	public static boolean DEBUG_MIRRORS = false;
32
	public static boolean DEBUG_PLANNER_PROJECTOR = false;
32
	public static boolean DEBUG_PLANNER_PROJECTOR = false;
33
	public static boolean DEBUG_RECONCILER = false;
34
33
35
	static {
34
	static {
36
		DebugOptions options = (DebugOptions) ServiceHelper.getService(Activator.context, DebugOptions.class.getName());
35
		DebugOptions options = (DebugOptions) ServiceHelper.getService(Activator.context, DebugOptions.class.getName());
Lines 43-49 Link Here
43
				DEBUG_METADATA_PARSING = options.getBooleanOption(Activator.ID + "/metadata/parsing", false); //$NON-NLS-1$
42
				DEBUG_METADATA_PARSING = options.getBooleanOption(Activator.ID + "/metadata/parsing", false); //$NON-NLS-1$
44
				DEBUG_MIRRORS = options.getBooleanOption(Activator.ID + "/artifacts/mirrors", false); //$NON-NLS-1$
43
				DEBUG_MIRRORS = options.getBooleanOption(Activator.ID + "/artifacts/mirrors", false); //$NON-NLS-1$
45
				DEBUG_PLANNER_PROJECTOR = options.getBooleanOption(Activator.ID + "/planner/projector", false); //$NON-NLS-1$
44
				DEBUG_PLANNER_PROJECTOR = options.getBooleanOption(Activator.ID + "/planner/projector", false); //$NON-NLS-1$
46
				DEBUG_RECONCILER = options.getBooleanOption(Activator.ID + "/reconciler", false); //$NON-NLS-1$
47
			}
45
			}
48
		}
46
		}
49
	}
47
	}
(-)src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java (-25 / +4 lines)
Lines 14-22 Link Here
14
import java.net.MalformedURLException;
14
import java.net.MalformedURLException;
15
import java.net.URL;
15
import java.net.URL;
16
import java.util.*;
16
import java.util.*;
17
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.Status;
18
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
19
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
19
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
20
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationArtifactRepository;
20
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationArtifactRepository;
21
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationMetadataRepository;
21
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationMetadataRepository;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
Lines 24-33 Link Here
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
26
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.RepositoryListener;
26
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.RepositoryListener;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
30
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
31
import org.eclipse.osgi.util.NLS;
29
import org.eclipse.osgi.util.NLS;
32
import org.osgi.framework.BundleContext;
30
import org.osgi.framework.BundleContext;
33
import org.osgi.framework.ServiceReference;
31
import org.osgi.framework.ServiceReference;
Lines 42-48 Link Here
42
	private static final String LINKS_PATH = "path"; //$NON-NLS-1$
40
	private static final String LINKS_PATH = "path"; //$NON-NLS-1$
43
	private static final String DROPIN_ARTIFACT_REPOSITORIES = "dropin.artifactRepositories"; //$NON-NLS-1$
41
	private static final String DROPIN_ARTIFACT_REPOSITORIES = "dropin.artifactRepositories"; //$NON-NLS-1$
44
	private static final String DROPIN_METADATA_REPOSITORIES = "dropin.metadataRepositories"; //$NON-NLS-1$
42
	private static final String DROPIN_METADATA_REPOSITORIES = "dropin.metadataRepositories"; //$NON-NLS-1$
45
	final private String PREFIX = "[reconciler][dropins] "; //$NON-NLS-1$
46
	private static final String PIPE = "|"; //$NON-NLS-1$
43
	private static final String PIPE = "|"; //$NON-NLS-1$
47
	private BundleContext context;
44
	private BundleContext context;
48
	private List metadataRepositories = new ArrayList();
45
	private List metadataRepositories = new ArrayList();
Lines 58-69 Link Here
58
	}
55
	}
59
56
60
	public boolean added(File file) {
57
	public boolean added(File file) {
61
		if (super.added(file)) {
58
		if (super.added(file))
62
			if (Tracing.DEBUG_RECONCILER) {
63
				Tracing.debug(PREFIX + "Interesting feature or bundle added " + file); //$NON-NLS-1$
64
			}
65
			return true;
59
			return true;
66
		}
67
60
68
		URL repositoryURL = createRepositoryURL(file);
61
		URL repositoryURL = createRepositoryURL(file);
69
		if (repositoryURL != null) {
62
		if (repositoryURL != null) {
Lines 74-85 Link Here
74
	}
67
	}
75
68
76
	public boolean changed(File file) {
69
	public boolean changed(File file) {
77
		if (super.changed(file)) {
70
		if (super.changed(file))
78
			if (Tracing.DEBUG_RECONCILER) {
79
				Tracing.debug(PREFIX + "Interesting feature or bundle changed " + file); //$NON-NLS-1$
80
			}
81
			return true;
71
			return true;
82
		}
83
72
84
		URL repositoryURL = createRepositoryURL(file);
73
		URL repositoryURL = createRepositoryURL(file);
85
		if (repositoryURL != null) {
74
		if (repositoryURL != null) {
Lines 186-192 Link Here
186
			} catch (ProvisionException e) {
175
			} catch (ProvisionException e) {
187
				repository = Activator.loadMetadataRepository(repoURL, null);
176
				repository = Activator.loadMetadataRepository(repoURL, null);
188
			}
177
			}
189
			debugRepository(repository);
190
			metadataRepositories.add(repository);
178
			metadataRepositories.add(repository);
191
		} catch (ProvisionException ex) {
179
		} catch (ProvisionException ex) {
192
			LogHelper.log(ex);
180
			LogHelper.log(ex);
Lines 313-325 Link Here
313
		return result;
301
		return result;
314
	}
302
	}
315
303
316
	private void debugRepository(IMetadataRepository repository) {
317
		if (!Tracing.DEBUG_RECONCILER)
318
			return;
319
		Tracing.debug(PREFIX + "Repository created " + repository.getLocation()); //$NON-NLS-1$
320
		Collector result = repository.query(InstallableUnitQuery.ANY, new Collector(), new NullProgressMonitor());
321
		for (Iterator iter = result.iterator(); iter.hasNext();)
322
			Tracing.debug(PREFIX + "\t" + iter.next()); //$NON-NLS-1$
323
	}
324
325
}
304
}
(-)src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java (-72 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved.
2
 * Copyright (c) 2007, 2009 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
4
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html
Lines 15-21 Link Here
15
import java.util.*;
15
import java.util.*;
16
import java.util.Map.Entry;
16
import java.util.Map.Entry;
17
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.equinox.internal.p2.core.helpers.*;
18
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
19
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
19
import org.eclipse.equinox.internal.p2.extensionlocation.Constants;
20
import org.eclipse.equinox.internal.p2.extensionlocation.Constants;
20
import org.eclipse.equinox.internal.provisional.configurator.Configurator;
21
import org.eclipse.equinox.internal.provisional.configurator.Configurator;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
Lines 82-99 Link Here
82
		ProvisioningContext context = getContext();
83
		ProvisioningContext context = getContext();
83
		ProfileChangeRequest request = createProfileChangeRequest(context);
84
		ProfileChangeRequest request = createProfileChangeRequest(context);
84
85
85
		if (request == null) {
86
		if (request == null)
86
			if (Tracing.DEBUG_RECONCILER)
87
				Tracing.debug("[reconciler][plan] Empty request");
88
			return Status.OK_STATUS;
87
			return Status.OK_STATUS;
89
		}
90
		debug(request);
91
88
92
		SubMonitor sub = SubMonitor.convert(monitor, 100);
89
		SubMonitor sub = SubMonitor.convert(monitor, 100);
93
		try {
90
		try {
94
			//create the provisioning plan
91
			//create the provisioning plan
95
			ProvisioningPlan plan = createProvisioningPlan(request, context, sub.newChild(50));
92
			ProvisioningPlan plan = createProvisioningPlan(request, context, sub.newChild(50));
96
			debug(request, plan);
93
97
			status = plan.getStatus();
94
			status = plan.getStatus();
98
			if (status.getSeverity() == IStatus.ERROR || plan.getStatus().getSeverity() == IStatus.CANCEL || plan.getOperands().length == 0)
95
			if (status.getSeverity() == IStatus.ERROR || plan.getStatus().getSeverity() == IStatus.CANCEL || plan.getOperands().length == 0)
99
				return status;
96
				return status;
Lines 412-479 Link Here
412
		}
409
		}
413
		return false;
410
		return false;
414
	}
411
	}
415
416
	private void debug(ProfileChangeRequest request) {
417
		if (!Tracing.DEBUG_RECONCILER) {
418
			return;
419
		}
420
		final String PREFIX = "[reconciler][request] "; //$NON-NLS-1$
421
		IInstallableUnit[] toAdd = request.getAddedInstallableUnits();
422
		if (toAdd == null || toAdd.length == 0) {
423
			Tracing.debug(PREFIX + "No installable units to add."); //$NON-NLS-1$
424
		} else {
425
			for (int i = 0; i < toAdd.length; i++) {
426
				Tracing.debug(PREFIX + "Adding IU: " + toAdd[i].getId() + ' ' + toAdd[i].getVersion()); //$NON-NLS-1$
427
			}
428
		}
429
		IInstallableUnit[] toRemove = request.getRemovedInstallableUnits();
430
		if (toRemove == null || toRemove.length == 0) {
431
			Tracing.debug(PREFIX + "No installable units to remove."); //$NON-NLS-1$
432
		} else {
433
			for (int i = 0; i < toRemove.length; i++) {
434
				Tracing.debug(PREFIX + "Removing IU: " + toRemove[i].getId() + ' ' + toRemove[i].getVersion()); //$NON-NLS-1$
435
			}
436
		}
437
	}
438
439
	private void debug(ProfileChangeRequest request, ProvisioningPlan plan) {
440
		if (!Tracing.DEBUG_RECONCILER)
441
			return;
442
		final String PREFIX = "[reconciler][plan] "; //$NON-NLS-1$
443
		//get the request
444
		List toAdd = new ArrayList();
445
		toAdd.addAll(Arrays.asList(request.getAddedInstallableUnits()));
446
		List toRemove = new ArrayList();
447
		toRemove.addAll(Arrays.asList(request.getRemovedInstallableUnits()));
448
449
		//remove from the request everything what is in the plan
450
		Operand[] ops = plan.getOperands();
451
		for (int i = 0; i < ops.length; i++) {
452
			if (ops[i] instanceof InstallableUnitOperand) {
453
				InstallableUnitOperand iuo = (InstallableUnitOperand) ops[i];
454
				if (iuo.first() == null && iuo.second() != null) {
455
					toAdd.remove(iuo.second());
456
				}
457
				if (iuo.first() != null && iuo.second() == null) {
458
					toRemove.remove(iuo.first());
459
				}
460
			}
461
		}
462
		//if anything is left in the request, then something is wrong with the plan
463
		if (toAdd.size() == 0 && toRemove.size() == 0) {
464
			Tracing.debug(PREFIX + "Plan matches the request"); //$NON-NLS-1$
465
		}
466
		if (toAdd.size() != 0) {
467
			Tracing.debug(PREFIX + "Some units will not be installed, because they are already installed or there are dependency issues:"); //$NON-NLS-1$
468
			for (int i = 0; i < toAdd.size(); i++) {
469
				Tracing.debug(PREFIX + toAdd.get(i));
470
			}
471
		}
472
		if (toRemove.size() != 0) {
473
			Tracing.debug(PREFIX + "Some units will not be uninstalled:"); //$NON-NLS-1$
474
			for (int i = 0; i < toRemove.size(); i++) {
475
				Tracing.debug(PREFIX + toRemove.get(i));
476
			}
477
		}
478
	}
479
}
412
}

Return to bug 303330