Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355483

Summary: Unable to upgrade Eclipse RCP application (after moving to Eclipse 3.7)
Product: [Eclipse Project] Equinox Reporter: Michael Spector <spektom>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: major    
Priority: P3 CC: kane.mx, kane.zhu, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Application p2 profile folder
none
Repository content.jar
none
Repository artifacts.jar none

Description Michael Spector CLA 2011-08-23 06:25:44 EDT
Created attachment 201985 [details]
Application p2 profile folder

Some our users can't upgrade their instance due to the following error:

Status ERROR: org.eclipse.equinox.p2.director code=0 
	Software being installed: StepwellS Editor 1.3.0.v20110821-1703 (com.stepwell.rcp.Product 1.3.0.v20110821-1703) null
Status ERROR: org.eclipse.equinox.p2.director code=0 Software currently installed: StepwellS RCP Application 1.3.0.v20110814-1719 (com.stepwell.ui 1.3.0.v20110814-1719) null

Status ERROR: org.eclipse.equinox.p2.director code=1 Only one of the following can be installed at once:  null children=[
	Status ERROR: org.eclipse.equinox.p2.director code=0 StepwellS RCP Application 1.3.0.v20110814-1719 (com.stepwell.ui 1.3.0.v20110814-1719) null
	Status ERROR: org.eclipse.equinox.p2.director code=0 StepwellS RCP Application 1.3.0.v20110821-1107 (com.stepwell.ui 1.3.0.v20110821-1107) null]

Status ERROR: org.eclipse.equinox.p2.director code=1 Cannot satisfy dependency: null children=[
	Status ERROR: org.eclipse.equinox.p2.director code=0 From: StepwellS Editor 1.3.0.v20110821-1703 (com.stepwell.rcp.Product 1.3.0.v20110821-1703) null 
	Status ERROR: org.eclipse.equinox.p2.director code=0 To: com.stepwell.rcp_feature.feature.group [1.3.0.v20110821-1704] null]

Status ERROR: org.eclipse.equinox.p2.director code=1 Cannot satisfy dependency: null children=[
	Status ERROR: org.eclipse.equinox.p2.director code=0  From: StepwellS Editor 1.3.0.v20110821-1704 (com.stepwell.rcp_feature.feature.group 1.3.0.v20110821-1704) null
	Status ERROR: org.eclipse.equinox.p2.director code=0 To: com.stepwell.ui [1.3.0.v20110821-1107] null]

Installation units "com.stepwell.rcp_feature.feature.group [1.3.0.v20110821-1704]" and "com.stepwell.ui [1.3.0.v20110821-1107]" both present in the repository (see attached repository manifests).

This started to happen after moving to Eclipse 3.7 (the upgrade process from Eclipse 3.5 based application to 3.7 went well)
Comment 1 Michael Spector CLA 2011-08-23 06:26:08 EDT
Created attachment 201986 [details]
Repository content.jar
Comment 2 Michael Spector CLA 2011-08-23 06:26:26 EDT
Created attachment 201987 [details]
Repository artifacts.jar
Comment 3 Meng Xin Zhu CLA 2011-08-26 02:40:41 EDT
It's not a p2 problem.

In your latest profile, every thing installed by p2 is marked its property 'org.eclipse.equinox.p2.internal.inclusion.rules' with value 'STRICT'.

It means that your application explicitly installed all of those IUs via p2's API. Then in those updating case, you want to only update the actual root IU(com.stepwell.rcp.Product), however there is some IUs required by your product are not required by new version(1.3.0.v20110821-1107) of your product.

The correct way is your application explicitly remove the non-required IUs when updating to new version. And the tricky way is adding some code to fix your profile, remove unnecessary IU properties.
Comment 4 Michael Spector CLA 2011-08-26 03:45:38 EDT
Then I think the standard procedure of building/updating Eclipse RCP application simply doesn't work:

1. We build Eclipse RCP application using the PDE builder this way:

http://www.vogella.de/articles/EclipsePDEBuild/article.html#productbuild_project

2. We use the following suggested way to update Eclipse RCP application headlessly:

http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.equinox/p2/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P2Util.java?view=markup&root=RT_Project

This procedure worked well in Eclipse 3.5, but after moving to Eclipse 3.7 some of our clients experience the issue. If this is not a p2 bug, and one should use another procedure for deploying/updating Eclipse RCP applications in Eclipse 3.7, please point me to the updated document.

Thanks.
Comment 5 Meng Xin Zhu CLA 2011-08-26 05:19:22 EDT
Both your building process and Update code don't have problem. And UpdateOperation is since from 3.6, it doesn't have problem to update your application from a clean base.

The problem came from the updating 'com.stepwell.rcp.Product' 1.3.0.v20110515-1620 to 1.3.0.v20110522-1655. I don't know how you use P2 API to update your application, at least you are using p2 1.x that doesn't have UpdateOperation yet. From the profile it looks like your code explicitly updated all IUs that have new version. So the profile records the 'STRICT' rule for those IUs.
Comment 6 Michael Spector CLA 2011-08-26 06:20:02 EDT
Previously we used this version of P2Utils.java:

http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.equinox/p2/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P2Util.java?view=markup&revision=1.1&root=RT_Project

After upgrading to Eclipse 3.7, we switched to the latest version.

We don't have any use of p2 API other than that.

(In reply to comment #5)
> Both your building process and Update code don't have problem. And
> UpdateOperation is since from 3.6, it doesn't have problem to update your
> application from a clean base.
> 
> The problem came from the updating 'com.stepwell.rcp.Product'
> 1.3.0.v20110515-1620 to 1.3.0.v20110522-1655. I don't know how you use P2 API
> to update your application, at least you are using p2 1.x that doesn't have
> UpdateOperation yet. From the profile it looks like your code explicitly
> updated all IUs that have new version. So the profile records the 'STRICT' rule
> for those IUs.
Comment 7 Meng Xin Zhu CLA 2011-08-26 09:23:55 EDT
(In reply to comment #6)
> Previously we used this version of P2Utils.java:
> 
> http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.equinox/p2/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P2Util.java?view=markup&revision=1.1&root=RT_Project
> 
> After upgrading to Eclipse 3.7, we switched to the latest version.
> 
> We don't have any use of p2 API other than that.
This version of P2Util searches updates for each IU, then explicitly remove older one and install new one. That's why all of those IUs have 'STRICT' contracts.

The revision 1.1 of P2Util is not a best practice, however P2 didn't have public API at that time. Actually UpdateOperation does the right thing as expected. You have to use underlying API to update your application in your case.
Comment 8 Michael Spector CLA 2011-08-26 12:39:27 EDT
I see now, thanks.