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 308934 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java (-22 / +29 lines)
Lines 418-447 Link Here
418
			return null;
418
			return null;
419
		}
419
		}
420
420
421
		// if we had some bundles which moved locations then we need to create 2 change requests.
421
		// if we have just a regular add/remove then set up the change request as per normal
422
		// one will remove the bundle from the profile and then the other will add it back in 
422
		if (toMove.isEmpty()) {
423
		// at the new location
423
			context.setExtraInstallableUnits(toAdd);
424
		if (!toMove.isEmpty()) {
424
			request.addAll(toAdd);
425
			ReconcilerProfileChangeRequest moveRequest = new ReconcilerProfileChangeRequest(profile, true);
425
			request.removeAll(toRemove);
426
			moveRequest.removeAll(toMove);
426
		} else {
427
			// force removal of all moved IUs, which will also remove anything which depends on them
427
			// if we had some bundles which moved locations then we need to create a move change request
428
			// see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=306424#c6
428
			// and remove the moved bundles first. The caller of this method will take care of calling us again
429
			Collection<IRequirement> extraReqs = new ArrayList<IRequirement>();
429
			// to re-add the bundles at their new location (and other bundles which need adding)
430
			for (IInstallableUnit unit : toMove) {
430
			request = new ReconcilerProfileChangeRequest(profile, true);
431
				IRequirement negation = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, unit.getId(), //
431
			request.removeAll(toMove);
432
						new VersionRange(unit.getVersion(), true, unit.getVersion(), true), null, 0, 0, false);
432
		}
433
				extraReqs.add(negation);
433
434
			}
434
		// force removal of all moved and removed IUs, which will also remove anything which depends on them
435
			moveRequest.addExtraRequirements(extraReqs);
435
		// see: bug 306424#c6 and bug 308934.
436
			debug(request);
436
		Collection<IRequirement> extraReqs = new ArrayList<IRequirement>();
437
			return moveRequest;
437
		for (IInstallableUnit unit : request.getRemovals()) {
438
			IRequirement negation = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, unit.getId(), //
439
					new VersionRange(unit.getVersion(), true, unit.getVersion(), true), null, 0, 0, false);
440
			extraReqs.add(negation);
438
		}
441
		}
439
442
		request.addExtraRequirements(extraReqs);
440
		context.setExtraInstallableUnits(toAdd);
441
		request.addAll(toAdd);
442
		request.removeAll(toRemove);
443
		debug(request);
443
		debug(request);
444
445
		return request;
444
		return request;
446
	}
445
	}
447
446
Lines 518-523 Link Here
518
				Tracing.debug(PREFIX + "Removing IU property: " + entry.getKey() + "->" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
517
				Tracing.debug(PREFIX + "Removing IU property: " + entry.getKey() + "->" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
519
			}
518
			}
520
		}
519
		}
520
521
		Collection<IRequirement> extra = request.getExtraRequirements();
522
		if (extra == null || extra.isEmpty()) {
523
			Tracing.debug(PREFIX + "No extra requirements."); //$NON-NLS-1$
524
		} else {
525
			for (IRequirement requirement : extra)
526
				Tracing.debug(PREFIX + "Extra requirement: " + requirement); //$NON-NLS-1$
527
		}
521
	}
528
	}
522
529
523
	/*
530
	/*

Return to bug 308934