Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail on missing plugin product requirement #3393

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

laeubi
Copy link
Member

@laeubi laeubi commented Jan 20, 2024

Currently Tycho does not fail if a requirement of a product can't be found in the resolve phase but only if the product is materialized. Even then it fails with an obscure error that claims the products bundle is not found where actually the dependency can't be found.

@mickaelistria @akurtakov @merks This currently allows to publish a product into a P2 repository even if the products requirements can not fully be fulfilled if one never materialize the product., it just produces some warnings

[WARNING] Problems resolving provisioning plan.:
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.client 0.0.0.
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.core 0.0.0.
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.sse 0.0.0.
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; org.osgi.dto [1.0.0,2.0.0).
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; org.osgi.framework.dto [1.8.0,2.0.0).
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)).

At least this this unexpected as Tycho in all other cases try to fail early and requires that everything is in the target.

I now wonder if this is a feature (so the materialize step might needs to be enhanced to fail better) or actually a bug and Tycho should already fail resolving that project.

The error from the materialize step is:

[INFO] --- tycho-p2-director:5.0.0-SNAPSHOT:materialize-products (materialize-products) @ plugin.product ---
org.osgi.service.jaxrs 1.0.1.202109301733
[INFO] Installing product plugin.product for environment linux/gtk/x86_64 to ....
Installing plugin.product 1.0.0.202401201824.
Installation failed.
Cannot complete the install because one or more required items could not be found.
	Software being installed: plugin.product 1.0.0.202401201824 (plugin.product 1.0.0.202401201824)
	Missing requirement: plugin.product 1.0.0.202401201824 (plugin.product 1.0.0.202401201824) requires 'org.eclipse.equinox.p2.iu; org.osgi.service.jaxrs [1.0.1.202109301733,1.0.1.202109301733]' but it could not be found

@laeubi laeubi force-pushed the fail_on_missing_product_requirement branch from f6cc32a to c2370ee Compare January 20, 2024 19:18
@laeubi
Copy link
Member Author

laeubi commented Jan 20, 2024

I now testes it wit a testcase where I emulate it with a feature, this one fails as expected with:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: plugin.product 1.0.0.qualifier
[ERROR]   Missing requirement: org.osgi.service.jaxrs 1.0.1.202109301733 requires 'java.package; javax.ws.rs.client 0.0.0' but it could not be found
[ERROR]   Cannot satisfy dependency: org.osgi.service.jaxrs.feature.feature.group 1.0.0.qualifier depends on: org.eclipse.equinox.p2.iu; org.osgi.service.jaxrs 0.0.0
[ERROR]   Cannot satisfy dependency: plugin.product 1.0.0.qualifier depends on: org.eclipse.equinox.p2.iu; org.osgi.service.jaxrs.feature.feature.group 0.0.0

so I get the impression this is more a bug than a feature...

Copy link

github-actions bot commented Jan 20, 2024

Test Results

  579 files  ±0    579 suites  ±0   4h 1m 44s ⏱️ + 41m 25s
  387 tests +3    380 ✅ + 4   7 💤 ±0  0 ❌ ±0 
1 161 runs  +9  1 139 ✅ +10  22 💤 ±0  0 ❌ ±0 

Results for commit 0631bfe. ± Comparison against base commit 8395720.

♻️ This comment has been updated with latest results.

@merks
Copy link
Contributor

merks commented Jan 21, 2024

I'm Oomph's build I see a bunch of warnings like this latest, but that is not related to a product and the (installer) product materializes correctly:

[WARNING] Problems resolving provisioning plan.: [Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.wildwebdeveloper.xml [1.3.0,1.4.0).; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4e 0.18.0.; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4j 0.21.0.]
[WARNING] Problems resolving provisioning plan.: [Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.wildwebdeveloper.xml [1.3.0,1.4.0).; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4e 0.18.0.; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4j 0.21.0.]
[WARNING] Problems resolving provisioning plan.: [Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.wildwebdeveloper.xml [1.3.0,1.4.0).; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4e 0.18.0.; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4j 0.21.0.]
[WARNING] Problems resolving provisioning plan.: [Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.wildwebdeveloper.xml [1.3.0,1.4.0).; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4e 0.18.0.; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4j 0.21.0.]
[WARNING] Problems resolving provisioning plan.: [Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.wildwebdeveloper.xml [1.3.0,1.4.0).; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4e 0.18.0.; Unable to satisfy dependency from org.eclipse.m2e.editor.lemminx 2.0.5.20231113-2319 to osgi.bundle; org.eclipse.lsp4j 0.21.0.]

@laeubi
Copy link
Member Author

laeubi commented Jan 21, 2024

@merks thats maybe cause by what I have described here:

the Slicer selects more units than are actually required, the not required one can have missing dependencies... then you get these warnings but the planner will just ignore the unsatisfied items.

@merks
Copy link
Contributor

merks commented Jan 21, 2024

The target only uses planner mode:

https://github.com/eclipse-oomph/oomph/blob/master/releng/org.eclipse.oomph.parent/tp/org.eclipse.oomph.tp.target

It appears to resolve fine in the IDE:

image

Anyway, it's probably unrelated. I was just concerned that this warning might turn into a failure...

@laeubi
Copy link
Member Author

laeubi commented Jan 21, 2024

I now found that this actually is/was a "feature" 12 years ago:

the rationale is that one adds a feature to the product but the platform filter does not match it should still resolve and will result in a product only contain the bundles that match the current environment.

To archive this, currently Tycho only adds an optional requirement to all bundles in the product while actually it should use a filter (that was removed with that commit).

I'll try to create a test-case for this even though today such products are probably not very useful anymore and one could better use a feature based product.

As the metadata in p2 contains already a property org.eclipse.equinox.p2.type.product this then can better be used to disable the requirement in the slicer if the plugin does not match.

@laeubi
Copy link
Member Author

laeubi commented Jan 21, 2024

When changing this to a strict requirement the error is now:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: plugin.product 1.0.0.qualifier
[ERROR]   Missing requirement: plugin.product 1.0.0.qualifier requires 'org.eclipse.equinox.p2.iu; org.osgi.service.jaxrs 0.0.0' but it could not be found

what still is confusing as the plugin is there but its dependencies can't be resolved... I currently don't understand why P2 handles feature/plugin differently here.

Currently Tycho does not fail if a requirement of a product can't be
found in the resolve phase but only if the product is materialized. Even
then it fails with an obscure error that claims the products bundle is
not found where actually the dependency can't be found.
@laeubi laeubi force-pushed the fail_on_missing_product_requirement branch from c2370ee to 5fe9ea7 Compare January 21, 2024 13:38
@laeubi
Copy link
Member Author

laeubi commented Jan 21, 2024

I have now added a testcase to confirm the behavior, so if one has a product with different native fragments Tycho can build such a product successful and the slicer do not complains because the requirements are actually filtered out (and native fragments usually don't have additional requirements).

@laeubi
Copy link
Member Author

laeubi commented Jan 21, 2024

I now needed to copy the Projector into Tycho but opened a PR to make it extensible so we can alter remove that again:

this now works with having a (non optional) requirement on the product that can still be projected successfully!

@laeubi
Copy link
Member Author

laeubi commented Jan 21, 2024

The product build now fails in the example with:

[ERROR] Cannot resolve dependencies of project tycho-its:plugin.product:eclipse-repository:1.0.0-SNAPSHOT
[ERROR]  with context {osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86_64}
[ERROR]   Software being installed: plugin.product 1.0.0.qualifier
[ERROR]   Missing requirement: org.osgi.service.jaxrs 1.0.1.202109301733 requires 'java.package; javax.ws.rs.client 0.0.0' but it could not be found
[ERROR]   Cannot satisfy dependency: plugin.product 1.0.0.qualifier depends on: org.eclipse.equinox.p2.iu; org.osgi.service.jaxrs 0.0.0: See log for details

what is desired here! So when no other test failures arise this is now finally ready to be merged!

@laeubi laeubi merged commit 155e4bc into eclipse-tycho:main Jan 22, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WARNING] Mirror tool: Problems resolving provisioning plan
2 participants