Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] [cross-project-issues-dev] Weird p2 install behavior: doesn't take "mandatory" attribute into account

p2 only provides approximation of osgi dependency resolution rules. it
does not honour mandatory attributes, bundle-symbolic-name and
bundle-version Import-Package directives, and probably more.

I've introduced dependency-resolution <extraRequirements> parameter to
workaround this in Tycho, but to make this work during installation you
probably want to list all features/bundles you need as dependency of
your feature.

--
Regards,
Igor

On 2014-12-19, 13:47, Andreas Sewe wrote:
Hi all,

we've just noticed a weird behavior of p2 during installation.

Here are the steps to reproduce:

- Install the bare 4.5-M4 SDK [1].

Note that it does not contain any bundles from Eclipse Code
Recommenders, Aether, or m2e.

- Next, install the latest version of "Code Recommenders for Java
Developers" from [2]

This installs all the bundles from Code Recommenders, some bundles from
Aether (which are made available through [2]) and(!) the bundle
org.eclipse.m2e.maven.runtime from [3], the update site pre-configured
by 4.5 M4.

And herein lies the problem:

osgi> ss recommenders
"Framework is launched."


id	State       Bundle
263	INSTALLED   org.eclipse.recommenders.apidocs_2.1.12.v20141202-0751
264	INSTALLED   org.eclipse.recommenders.apidocs.rcp_2.1.12.v20141202-0751
265	INSTALLED   org.eclipse.recommenders.calls_2.1.12.v20141202-0751
266	INSTALLED   org.eclipse.recommenders.calls.rcp_2.1.12.v20141202-0751
267	STARTING    org.eclipse.recommenders.chain.rcp_2.1.12.v20141202-0751
268	STARTING    org.eclipse.recommenders.completion.rcp_2.1.12.v20141202-0751
269	STARTING    org.eclipse.recommenders.injection_2.1.12.v20141202-0751
270	RESOLVED    org.eclipse.recommenders.jayes_2.1.12.v20141202-0751
271	RESOLVED    org.eclipse.recommenders.jayes.io_2.1.12.v20141202-0751
272	RESOLVED    org.eclipse.recommenders.jdt_2.1.12.v20141217-0920
273	INSTALLED   org.eclipse.recommenders.models_2.1.12.v20141211-1032
274	INSTALLED   org.eclipse.recommenders.models.rcp_2.1.12.v20141203-0852
275	RESOLVED    org.eclipse.recommenders.net_2.1.12.v20141202-0751
276	INSTALLED   org.eclipse.recommenders.overrides_2.1.12.v20141202-0751
277	INSTALLED   org.eclipse.recommenders.overrides.rcp_2.1.12.v20141202-0751
278	STARTING    org.eclipse.recommenders.rcp_2.1.12.v20141202-0751
279	RESOLVED    org.eclipse.recommenders.subwords.rcp_2.1.12.v20141202-0751
280	RESOLVED    org.eclipse.recommenders.utils_2.1.12.v20141211-1252

Code Recommenders is totally unusable.

The root cause is that it cannot resolve some package imports of
org.eclipse.aether, even though the org.eclipse.aether.api bundle is
present on the Code Recommenders update site [2].

osgi> diag 273
org.eclipse.recommenders.models [273]
   Unresolved requirement: Import-Package: org.apache.maven.repository.internal; version="[3.1.0,3.2.0)"
     -> Export-Package: org.apache.maven.repository.internal; bundle-symbolic-name="org.eclipse.aether.maven"; bundle-version="3.1.0.v20140706-2237"; version="3.1.0"; uses:="com.google.inject,javax.inject,org.eclipse.aether,org.eclipse.aether.artifact,org.eclipse.aether.deployment,org.eclipse.aether.impl,org.eclipse.aether.installation,org.eclipse.aether.repository,org.eclipse.aether.resolution,org.eclipse.aether.spi.locator,org.eclipse.aether.spi.log"
        org.eclipse.aether.maven [255]
          Unresolved requirement: Import-Package: org.eclipse.aether; version="[0.9.1,1.1.0)"

This is due to the fact that p2 has installed the bundle
org.eclipse.m2e.maven.runtime instead as a provider of the package
org.eclipse.aether:

osgi> p org.eclipse.aether
osgi.wiring.package; bundle-symbolic-name="org.eclipse.m2e.maven.runtime"; bundle-version:Version="1.6.0.20141217-0916"; provider="m2e"; version:Version="1.0.0.v20140518"; osgi.wiring.package="org.eclipse.aether"; mandatory:="provider"<org.eclipse.m2e.maven.runtime_1.6.0.20141217-0916 [261]>

But this bundle is not a valid substitute for the org.eclipse.aether.api
bundle, due to the mandatory provider attribute of "m2e".

Is this a bug in p2? IMHO, p2 should be able to detect that
org.eclipse.m2e.maven.runtime does not provide the necessary package for
the bundle org.eclipse.aether.maven to import, as the latter's
Import-Package does not use provider="m2e".

FWIW, for the history of the provider="m2e" attribute added [4]
precisely to avoid these kind of wiring problems, see Bug 403243 [5].

Any insights as to why p2 behaves the way it does are greatly appreciated.

Best wishes,

Andreas

[1]
<http://download.eclipse.org/eclipse/downloads/drops4/S-4.5M4-201412102000/>
[2] <http://download.eclipse.org/recommenders/updates/head/>
[3] <http://download.eclipse.org/releases/mars>
[4]
<https://git.eclipse.org/c/m2e/m2e-core.git/commit/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml?id=7e198c6ae5cffbd6fc45e0cb3b54492123d7e2e4>
[5] <https://bugs.eclipse.org/bugs/show_bug.cgi?id=403243>



Back to the top