Discussion:
[tycho-user] Negative requirements: How to include mutually exclusive features in same update site
Andreas Sewe
2017-09-05 12:05:07 UTC
Permalink
Hi,

I have a Tycho build containing two features org.example.foo and
org.example.bar, which both use a p2.inf to state a *negative*
requires.0.namespace = org.eclipse.equinox.p2.iu
requires.0.name = org.example.bar.feature.group
requires.0.min = 0
requires.0.max = 0
requires.0.namespace = org.eclipse.equinox.p2.iu
requires.0.name = org.example.foo.feature.group
requires.0.min = 0
requires.0.max = 0
This is meant to prevent these two features from being installed together.

Unfortunately, it also prevents Tycho from building an
[ERROR] Software being installed: updates raw:1.0.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):1.0.0-SNAPSHOT
[ERROR] Cannot satisfy dependency: org.example.foo.feature.group 1.0.0.qualifier depends on: org.example.bar.feature.group 0.0.0
[ERROR] Cannot satisfy dependency: updates raw:1.0.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):1.0.0-SNAPSHOT depends on: org.example.foo.feature.group 0.0.0
[ERROR] Cannot satisfy dependency: updates raw:1.0.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):1.0.0-SNAPSHOT depends on: org.example.bar.feature.group 0.0.0
For me, this defeats the purpose of the negative requirements: I want to
offer the user both features Foo and Bar on the same update site, but
prevent that he installs both.

Is this possible?

Andreas

[1]
<https://wiki.eclipse.org/Equinox/p2/Customizing_Metadata#Capability_Advice:>
--
Codetrails GmbH
The best code possible

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940
Andreas Sewe
2017-09-05 13:39:15 UTC
Permalink
Post by Andreas Sewe
For me, this defeats the purpose of the negative requirements: I want to
offer the user both features Foo and Bar on the same update site, but
prevent that he installs both.
Is this possible?
FWIW, it is if using PDE's Export > Deployable Features to create a p2
repository. This solution was presumably also used by Ian Bull in this
blog post on Publishing Negation Requirements [1].

Best wishes,

Andreas

[1]
<https://eclipsesource.com/blogs/2012/03/15/publishing-negative-requirements/>
--
Codetrails GmbH
The best code possible

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940
Loading...