[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] Follow-UP Updating to a certain version

Hi all,

with the snippet from Elena I had some trouble, Elena uses engine.createPlan which is likely to not resolve the dependencies of my prduct IU. Since I didn't get how to achieve that, I stepped back to the UpdateOperation.

I make a query for my server-matching IU and want to select that Update from the availaible Updates on the UpdateOperation. I guess this would be all I need.

But now when I resolve the UpdateOperation I get the following output:

!ENTRY org.eclipse.equinox.p2.operations 4 0 2010-05-24 12:21:24.989
!MESSAGE Operation details
!SUBENTRY 1 org.eclipse.equinox.p2.director 4 1 2010-05-24 12:21:24.989
!MESSAGE Cannot complete the install because of a conflicting dependency.
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE Software being installed: Buchmanager 1.6.2.201005241213 (de.eiswind.mango.client.core.mango 1.6.2.201005241213)
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE Software currently installed: Shared profile 1.0.0.1274695660811 (profile 1.0.0.1274695660811)
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 1 2010-05-24 12:21:24.989
!MESSAGE Only one of the following can be installed at once: 
!SUBENTRY 3 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE Order Plugin 1.5.0.201005241213 (de.eiswind.mango.client.order 1.5.0.201005241213)
!SUBENTRY 3 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE Order Plugin 1.5.0.201005241205 (de.eiswind.mango.client.order 1.5.0.201005241205)
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 1 2010-05-24 12:21:24.989
!MESSAGE Cannot satisfy dependency:
!SUBENTRY 3 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE From: Buchmanager Client Feature 1.6.2.201005241213 (de.eiswind.mango.client.core.feature.feature.group 1.6.2.201005241213)
!SUBENTRY 3 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE To: de.eiswind.mango.client.order [1.5.0.201005241213]
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 1 2010-05-24 12:21:24.989
!MESSAGE Cannot satisfy dependency:
!SUBENTRY 3 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE From: Buchmanager 1.6.2.201005241213 (de.eiswind.mango.client.core.mango 1.6.2.201005241213)
!SUBENTRY 3 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE To: de.eiswind.mango.client.core.feature.feature.group [1.6.2.201005241213]
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 1 2010-05-24 12:21:24.989
!MESSAGE Cannot satisfy dependency:
!SUBENTRY 3 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE From: Shared profile 1.0.0.1274695660811 (profile 1.0.0.1274695660811)
!SUBENTRY 3 org.eclipse.equinox.p2.director 4 0 2010-05-24 12:21:24.989
!MESSAGE To: de.eiswind.mango.client.order [1.5.0.201005241205]

I know that both versions cant be installed at once, I want it to be updated instead.

My code looks like this (sorry for the static shell, but Im before workbench startup)

IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME);

// get the server-version-matching latest Update from the repository
Update update = getUpdate(profile, provisioningContext, engine, context);
if (update == null) {
return null;
}
ProvisioningSession session = new ProvisioningSession(agent);
UpdateOperation operation = new UpdateOperation(session);
log(IStatus.INFO, "Resolving the update", null);
UpdateShell.show();
SubMonitor sub = SubMonitor.convert(UpdateShell.getProgressMonitor(), "Suche nach updates ...", 200);

IStatus status = operation.resolveModal(sub.newChild(100));

if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
UpdateShell.closeShell();
return null;
}

if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
if (status.getSeverity() != IStatus.ERROR) {
log(IStatus.INFO, "Checking for available update matches", null);
Update[] selected = new Update[1];
operation.setSelectedUpdates(new Update[0]);
for (Update available : operation.getPossibleUpdates()) {
if (available.equals(update)) {
log(IStatus.INFO, "Update matches available: " + update, null);
selected[0] = available;
operation.setSelectedUpdates(selected);
}
}

// More complex status handling might include showing the user what
// updates
// are available if there are multiples, differentiating patches vs.
// updates, etc.
// In this example, we simply update as suggested by the operation.
ProvisioningJob job = operation.getProvisioningJob(UpdateShell.getProgressMonitor());
status = job.runModal(sub.newChild(100));
if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
}
UpdateShell.closeShell();
return status;

Anyone got a hint for me quickly ?

Thanks for helping me.

Regards Thomas
--