Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354581 - Ability to disable greedy behavior for optional packages and in feature level
Summary: Ability to disable greedy behavior for optional packages and in feature level
Status: RESOLVED WORKSFORME
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-12 03:32 EDT by Daniel Danev CLA
Modified: 2019-09-04 01:53 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Danev CLA 2011-08-12 03:32:41 EDT
Build Identifier: M20100909-0800

P2 greedy behavior can be manipulated by the p2.inf as it is stated in help.eclipse.org - http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_customizing_metadata.html

I'm using a syntax like the following in p2.inf in META-INF folder (plugin level):

requires.0.namespace=osgi.bundle
requires.0.name={$id_of_optional_plugin}
requires.0.greedy=false
requires.0.optional=true

While the above is working, it is not the case if i insert the p2.inf file in the feature level.
In the case when i have an optional package dependency, the p2.inf management is not working neither in plugin and in feature level.

Reproducible: Always

Steps to Reproduce:
Optional package dependency greedy behavior:
1. Create a sample plugin with optional package dependency to other sample plugin. Package the plugins in separate features and create an update site of them.
2. Create p2.inf with the following content
   requires.0.namespace=osgi.bundle
   requires.0.name={$id_of_optional_plugin}
   requires.0.greedy=false
   requires.0.optional=true
3. Insert the p2.inf file either at plugin (the one with optional package dependency) level in META-INF folder or in feature level (beside feature.xml)
4. Install only the feature plugin with optional dependency.
Result: The other plugin got greedily installed as well, no matter of the p2.inf content.

Feature level greedy behavior:
1. Create a sample plugin with optional dependency to other sample plugin. Package the plugins in separate features and create an update site of them.
2. Create p2.inf with the following content
   requires.0.namespace=osgi.bundle
   requires.0.name={$id_of_optional_plugin}
   requires.0.greedy=false
   requires.0.optional=true
3. Insert the p2.inf file in feature level (beside feature.xml) - the one containing the plugin with optional dependency
4. Install only the feature plugin with optional dependency.
Result: The other plugin got greedily installed as well, no matter of the p2.inf content.
Comment 1 David Williams CLA 2012-02-14 00:14:58 EST
Can you clarify something .... you talk about the "input" (p2.inf) and the resulting behavior, but an important piece of information is what is in the content.xml file that is produced. Where you want an "optional feature", does specify "optional=true" and "greedy=false"? Or just "optional=true"? (which implies greedy=true). 

The former case would sound like a bug in p2, but the later would sound like a bug in the p2 publisher. 

And ... M20100909? Is that Helios SR1? You might want to investigate at least Indigo if not Juno M5 to see if there has been a change or fix.  

Thanks.
Comment 2 Eclipse Genie CLA 2018-12-07 03:42:42 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Lars Vogel CLA 2019-09-04 01:53:48 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.