Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329279 - [planner] p2 director does not install source bundles from optional features
Summary: [planner] p2 director does not install source bundles from optional features
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Daniel Le Berre CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 329202 330460
  Show dependency tree
 
Reported: 2010-11-02 13:33 EDT by Kim Moir CLA
Modified: 2010-11-18 14:01 EST (History)
4 users (show)

See Also:


Attachments
Artifacts used to demonstrate a non-source bundle being dropped (5.95 KB, application/zip)
2010-11-10 21:03 EST, Ben Vitale CLA
no flags Details
Change weighting scheme to fix the problem (932 bytes, patch)
2010-11-11 09:06 EST, Daniel Le Berre CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Moir CLA 2010-11-02 13:33:49 EDT
As a result of investigating bug 329202, Andrew, DJ and I discovered that the director isn't installing optional source features for the SDK.  The eclipse SDK generates the platform source feature and optional equinox.p2.user.ui.source feature.  If you run the p2.director from M3 with the following arguments, the org.eclipse.equinox.p2.user.ui feature and associated bundles will be included in the install, but not org.eclipse.equinox.p2.user.ui.source components.

 -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog  -metadataRepository http://download.eclipse.org/eclipse/updates/3.7milestones/S-3.7M2a-201009211024 -artifactRepository http://download.eclipse.org/eclipse/updates/3.7milestones/S-3.7M2a-201009211024 -installIU org.eclipse.sdk.ide  -os linux -ws gtk -arch x86 -destination c:\installSDK -profile SDKProfile  -profileProperties org.eclipse.update.install.features=true

This issue first appeared during M3, as the M2a build seems fine.
Comment 1 Ben Vitale CLA 2010-11-04 11:28:51 EDT
(In reply to comment #0)
> This issue first appeared during M3, as the M2a build seems fine.

I can reproduce this problem using the 3.6.1 director. It's *not* a problem with the 3.6.0 director.

I'm investigating a similar problem with my own product build (against 3.6.1) where an optional dependency is not being included by the director. I am wondering if bug 326624 is at play here. Following that back to the delta between 3.6.0 and 3.6.1, bug 323322 has this comment from DJ:

"There was a problem with tagging HEAD so this fix won't appear in integration
builds until the first build after 3.7 M2."

If there is in fact a side effect from the fix for bug 323322 which is causing this behavior, that comment may explain why you didn't see it in M2?
Comment 2 Jeff McAffer CLA 2010-11-08 13:22:30 EST
the irony of p2 not installing its own source bundles is amusing. ;-)
Comment 3 Kim Moir CLA 2010-11-08 13:31:49 EST
yes, I thought the same thing :-)
Comment 4 Kim Moir CLA 2010-11-08 15:55:40 EST
This issue also applies to 3.6.2
Comment 5 Pascal Rapicault CLA 2010-11-09 22:33:49 EST
Unfortunately this is not the first in the life of p2 that it decides to optimize itself out :) I remember we had such a situation in 3.4 release. Oh well :)
Comment 6 Pascal Rapicault CLA 2010-11-09 22:49:26 EST
This looks similar to bug #326624
Comment 7 Daniel Le Berre CLA 2010-11-10 01:51:56 EST
Hum, there must be something else in that source bundle than being optional.
We have many test cases regarding the expected behavior for the projector on optional packages and they all pass.

Pascal, could you create me a test case such that I can check in the encoding what's going on?

Ben, what other feature has the optional dependency that is not installed?

I have found a simpler way to encode optional dependencies this summer. If we can have testcases for this problem and bug 329202, I could implement it on HEAD to see if it solves those problems.
Comment 8 Ben Vitale CLA 2010-11-10 08:49:25 EST
The irony is not lost in my case, either. I have a product which specifies a dependency on org.eclipse.platform, which has an optional dependency on org.eclipse.equinox.p2.user.ui (the real bundle, not the source). Since 3.6.1, the p2 feature is not installed by the director automatically.
Comment 9 Pascal Rapicault CLA 2010-11-10 15:03:33 EST
Sorry about that Ben.
Comment 10 Daniel Le Berre CLA 2010-11-10 15:27:26 EST
The only change that was made between 3.6.0 and 3.6.1 was to make sure that we where not installing anything "for free", i.e. all installed packages do cost something, in order to be sure that any change to an installation is affected by a cost, to make it stable.

It was not happening in 3.6.0 because we introduced the notion of greed to the encoding.

The problem must lie in the interaction between greedy and optional dependencies.

I guess it is the case for the source feature. Is it also the case for your problem Ben?
Comment 11 Pascal Rapicault CLA 2010-11-10 16:31:07 EST
Daniel, I just committed a test case reproducing Kim's issue. The test is called Bug329279.
Comment 12 Daniel Le Berre CLA 2010-11-10 16:39:24 EST
ok, thanks Pascal.

Will try to dig into it. I basically can no longer work on my Linux machine because of bug 323881 :(
Comment 13 Daniel Le Berre CLA 2010-11-10 17:56:03 EST
Pascal, I do not see your testcase in HEAD.
Comment 14 Pascal Rapicault CLA 2010-11-10 20:54:05 EST
The file is there:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug329279.java?root=RT_Project&view=log

There can be two problems, you are not on the right branch or you are not using extssh as a connection.
Comment 15 Ben Vitale CLA 2010-11-10 21:03:11 EST
Created attachment 182867 [details]
Artifacts used to demonstrate a non-source bundle being dropped

The attached zip file contains a bundle and a feature. A basic feature-based product is defined. When exported from the 3.6.0 IDE, the p2.user.ui feature appears in both the repository and the installed product.  When exported from the 3.6.1 IDE, the p2.user.ui feature appears in the repository but *not* the installed product.

I should note that my real world scenario involves a headless product build, not an export from the IDE. The end result is the same.

(Hoping Pascal can translate into a low-level test case.)
Comment 16 Ben Vitale CLA 2010-11-10 21:03:54 EST
(In reply to comment #9)
> Sorry about that Ben.

No worries, the workaround to include the missing feature is straightforward and simple: declare it as a dependency.
Comment 17 Daniel Le Berre CLA 2010-11-11 08:49:25 EST
I started looking at that testcase.

It is an optimization function problem: the "score" of the installation without the source feature is better than when it is installed.

I need to investigate further to see why it happens.
Comment 18 Daniel Le Berre CLA 2010-11-11 09:06:48 EST
Created attachment 182899 [details]
Change weighting scheme to fix the problem

Here is a simple fix for that bug.

Installing an optional package can propagate the installation of many other packages. As such, depending of the weight we put on the installation of the optional package, it might be "better" not to install it if the consequence of installing it is to get many individual penalties.

For instance, if A is optional, and requires to install B, C, D and E, then we get
a penalty p for installing B,C,D and E and a reward r for installing A.
r must be set in such a way that whatever the number of packages that must be installed to satisfy the optional dependency, the reward is always greater to the sum of the penalty.

The is the object of that patch, that uses for the reward a new value that cannot be compensated.
Comment 19 Pascal Rapicault CLA 2010-11-11 13:01:45 EST
If you are happy with the patch, feel free to release in HEAD and in the branch.
Comment 20 Daniel Le Berre CLA 2010-11-11 15:14:41 EST
Done.

I also included this bug test case to AllTests on HEAD.
Comment 21 Kim Moir CLA 2010-11-18 10:45:30 EST
I released the bundles from I20101117-0800 to the builder and verified that it fixed the issue in build N20101117-2000.  Merci Daniel et Pascal!
Comment 22 Daniel Le Berre CLA 2010-11-18 12:04:23 EST
Thanks Kim for giving it a try. We let you close that bug.
Comment 23 Kim Moir CLA 2010-11-18 14:01:48 EST
Closing.