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

Hi, Thomas.
Looking at your snippet, it appears that you are not resolving (again) once you've changed which update you want to select in the operation. So the operation still has the plan that was generated initially. You need to call
op.resolveModal
after changing the selections. This is what will generate a new provisioning plan for the IU that matches your server. At that point, you can get the provisioning job and run it. The last example snippet in the UpdateOperation javadoc has an example like this...

susan

Inactive hide details for Thomas Kratz ---05/24/2010 03:31:23 AM---Hi all, with the snippet from Elena I had some trouble, ElenThomas Kratz ---05/24/2010 03:31:23 AM---Hi all, with the snippet from Elena I had some trouble, Elena uses engine.createPlan which is likely to not resolve the depende



          Thomas Kratz <eiswind@xxxxxxxxxxxxxx>
          Sent by: p2-dev-bounces@xxxxxxxxxxx

          05/24/2010 03:30 AM
          Please respond to P2 developer discussions



To: p2-dev <p2-dev@xxxxxxxxxxx>
cc:
Subject: [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
--
_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev

GIF image

GIF image

GIF image