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

Bug 364781

Summary: Unexpected extra IU generated for org.eclipse.update.configurator
Product: [Eclipse Project] Equinox Reporter: Igor Fedorenko <igor>
Component: p2Assignee: Tobias Oberlies <t-oberlies>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: irbull, jan.sievers, pascal, t-oberlies
Version: 3.8.0 Juno   
Target Milestone: Kepler M5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
proposed fix none

Description Igor Fedorenko CLA 2011-11-24 22:17:40 EST
Created attachment 207514 [details]
proposed fix

For apparently historical reasons, BundlesAction has special logic that makes org.eclipse.update.configurator bundle "provide" additional installable unit with id org.eclipse.equinox.simpleconfigurator. This causes problems when building org.eclipse.update.configurator bundle with Tycho -- the build fails because two unrelated bundles provide the same IU.

Attached is a proposed fix that removes special handling of org.eclipse.update.configurator bundle.
Comment 1 Tobias Oberlies CLA 2011-12-08 06:42:41 EST
Does anyone from the p2 team remember why this was done? The code looks more than questionable - the extra bundle is taken from the runtime of the publisher - so unless there are good reasons, I will apply Igor's patch which removes that code.
Comment 2 DJ Houghton CLA 2011-12-08 09:10:34 EST
Pascal, do you remember why this is done?

Since we've already passed the test pass day for M4, this change should wait until M5.
Comment 3 Tobias Oberlies CLA 2011-12-19 05:31:37 EST
@Pascal: Any reasons for this which are still valid? I really want to see this patch in M5.
Comment 4 DJ Houghton CLA 2011-12-19 06:45:57 EST
I think we need to approach this from the other direction and only delete the code if we know why we don't need it anymore, instead of deleting it if we can't remember why we did it. Since it is exception code, it was most likely done because it was fixing a real problem.
Comment 5 Tobias Oberlies CLA 2011-12-19 08:25:48 EST
(In reply to comment #4)
> I think we need to approach this from the other direction and only delete the
> code if we know why we don't need it anymore, instead of deleting it if we can't
> remember why we did it.
So why did we need it? I failed to find the origin of the "add simple configurator" logic. I could only trace it this far:
- In 618de17 [1], the code was copied from Generator.java to BundlesAction.java
- In 2ccb446 [2] the Generator.java was renamed from something no present in the history of the rt.equinox.p2 repository.

So who could still need that code? Probably only the build of org.eclipse.update.configurator and/or org.eclipse.equinox.simpleconfigurator. Do you know how to do a test build of these projects with a publisher with the patch applied?

[1] http://git.eclipse.org/c/equinox/rt.equinox.p2.git/commit/?id=618de1745b89297893c6c48e8bd36972a1a92d87
[2] http://git.eclipse.org/c/equinox/rt.equinox.p2.git/diff/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Generator.java?id=2ccb446cc885495686cc9eb430c4a98031b3cfc5
Comment 6 DJ Houghton CLA 2011-12-19 08:38:52 EST
We could add a condition based on a System property (default value to maintain current behaviour) and then run a test build with the property set.
Comment 7 DJ Houghton CLA 2011-12-19 09:30:07 EST
Having a test case which shows the behaviour helps some scenarios would help. John and I talked about this a bit and it was most likely added when we were doing the initial conversion and needed to have the simple configurator IU but it wasn't in the SDKs that we were generating metadata from. 

Going forward for this we should:
- create test cases for both scenarios 
- ensure the test cases pass with the fix in place

The first test case should:
- Run the publisher against an RCP app which doesn't need the simple configurator
- use the generated metadata to install the app
- run the app and ensure it works

There should also be a test case for the same scenario but the app should require the simple configurator.
Comment 8 Tobias Oberlies CLA 2011-12-20 04:15:56 EST
(In reply to comment #7)
> - Run the publisher against an RCP app which doesn't need the simple
> configurator
Is this still a supported use case? I thought that now that most build systems produce p2 metadata, running the publishers on these artifacts again (=re-publishing) is discouraged because it may lead to violations of the id+version=unique metadata assumption.
Comment 9 Ian Bull CLA 2012-03-14 00:57:22 EDT
This was marked M6.  I'm moving to M7. Does anybody plan on working on this?
Comment 10 Tobias Oberlies CLA 2012-03-16 13:08:50 EDT
@DJ: Are you still interested in providing a test for the "publish existing applications" use case? If not, I'd say we apply the patch and see if any of the users of the (non-API) publisher bundle reminds us what this was ever needed for.
Comment 11 DJ Houghton CLA 2012-03-16 14:05:19 EDT
I'm no longer working on p2 as part of my day job so I don't have time to contribute a test case here. Perhaps Pascal can comment if he remembers why we had the code initially, etc.
Comment 12 Ian Bull CLA 2012-04-27 17:56:58 EDT
Since we are sitting at M7, and I don't know why this code is here (and I don't plan on removing code without a very good reason), I'm going to move this out.
Comment 13 Tobias Oberlies CLA 2013-01-28 03:22:38 EST
The patch has been integrated [1]

@Igor: Thank you for the contribution.

[1] http://git.eclipse.org/c/equinox/rt.equinox.p2.git/commit/?id=98ec6c9475bc2732d92a8800e5deb0bfc436696a