Skip to main content

[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,

 

Maybe what you can do is create an update plan, yourself and pass it directly to the P2 engine in order the update to be performed.

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

engine.perform(plan, null);

In order to create the plan, you need to get the InstallableUnit(your product) both from the profile and from the repository and decide, whether to add it to the plan for update or no(based on the versions).

IProvisioningPlan plan = engine.createPlan(profile, provisioningContext);

plan.updateInstallableUnit(oldIUFromProfile, newIUFromRepo)

 

If this approach is ok for your scenario, I can send you how I have done It in our Updater.

 

Regards,

Elena

From: p2-dev-bounces@xxxxxxxxxxx [mailto:p2-dev-bounces@xxxxxxxxxxx] On Behalf Of Thomas Kratz
Sent: Monday, May 17, 2010 11:24 AM
To: p2-dev
Subject: [p2-dev] Follow up: Updating to a certain version

 

Hi all,

I've been having a tough time with p2, but most of the trouble where caused by myself. Thanks for the help so far, at leat I have the UI up now and thanks to finding out that p2.data.area=@config/../p2 I now know that this wont work when you change the osgi.configuration.area. Really had a fight with this.

But I still need your help with understanding the API. I want to to a headless Update on Startup, and I looked into the prestartupade and the cloud example. As far as I can see the Policy in the cloud example is useful only to the p2 UI.

What I need to achieve is that I only update to a certain osgi version, because client and server need to stay in sync and I cannot know when the server gets updated. So the client asks the server for its version at startup (simply policy, versions have to match) and then I want to update to the same version on the client side. I did some diving into the API but I didn't see any starting point where to place such a restriction on the UpdateOperation. I can see the available Updates after the resolve, but looking at the "Update" I don't understand how I should select the right one because there so little info exposed in there.

If you could give me a starting point, wether to place a query upfront the resolve operation or wether to select the right update afterwards this would be of great help to me.

If I need to give any further information please let me know.

Regards Thomas


Back to the top