GithubHelp home page GithubHelp logo

Comments (24)

and-k avatar and-k commented on June 10, 2024

After taking a look at changes between the versions 0.22.0 and 0.23.0 I suspect that the implementation of https://bugs.eclipse.org/bugs/show_bug.cgi?id=456543 is causing this issue.
Unfortunately I cannot build these old versions anymore since they are referencing some old eclipse update sites which aren't available anymore.

from tycho.

and-k avatar and-k commented on June 10, 2024

I'm currently trying to find a solution for this issue.

The main problem imho is that every plugin defined in the configuration of the product is being set to version 0.0.0 in org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile.processPluginConfiguration().
Later in org.eclipse.equinox.p2.publisher.eclipse.ProductFileAdvice.getConfigData() only for explicitly defined plugins within the <plugins> of a product the correct version are being set.
Plugins defined indirectly within the <features> of a product are not being considered and are always only set to version 0.0.0

This code has been the same for years even with Tycho 0.22.0. The difference though is that with f59db5e the dependency resolution in Tycho has been changed and therefore this issue occurred. The commit message suggests that the new dependency resolution was intended by the author.

I see two possible solutions now:

  1. P2 would need to handle the plugins defined in <configurations> not as BundleInfo since it sets the version to 0.0.0 if no explicit version is available which is always the case because in Eclipse the graphical "Product Configuration Editor" doesn't even allow to set a version for plugins in <configurations>. Instead only a "BundleConfigurationInfo" should be introduced without a version.
  2. P2 would need also to consider the <features> for bundles in ProductFileAdvice.getConfigData()
    Therefore org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.getBundles() would need to expand the features to get all bundles and not ignore them if the bundles are not directly included in the product

Since I'm not familiar with the Tycho and P2 code I'd appreciate any feedback on my findings or any suggestion for other solutions to fix this issue.

from tycho.

laeubi avatar laeubi commented on June 10, 2024

@and-k I'd like to convert you sample-project into an integration test for tycho, would you mind to add a statement that you release the code under the EPL 2.0 license?

from tycho.

and-k avatar and-k commented on June 10, 2024

I've added a EPL-2.0 License to the repository. You are free to use it under this license.

The sample-project was only intended to easily reproduce the issue. For an integration test I'd recommend to extend it to cover more cases, like having also a non root feature in the product and nested features.

from tycho.

laeubi avatar laeubi commented on June 10, 2024

Thanks for the feedback. There are the following possible (temporary) workarounds that both make the build succeed:

  1. One can add a version attribute in the <plugin id="org.apache.activemq.activemq-core" autoStart="true" startLevel="3" version="5.2.0" /> but this will be lost as the PDE editor does not support versions.
  2. add a <plugin> section with a version (even though it does not makes sense for a feature based product), but that also needs manual editing the product file

Both workaround suffer from the fact that one need to sync the version from the product and the feature and thus might only apply to very limited use-cases where the version does not change often/updated, beside that they seem to be subject to changes as they rely on undocumented behavior.

So I currently see the following options:

  1. Tycho need to resolve the versions and update them accordingly
  2. P2 is enhanced and tycho uses that (might require 1. anyways)
  3. P2 is made smarter when no version is available (seems most problematic as there is maybe code relying on old behavior)

from tycho.

laeubi avatar laeubi commented on June 10, 2024

I have now created a POV for the first option that tycho resolves the bundles and set versions. That work so far as with root and non-root features but becomes to brittle when features include other features that include the bundle in question.
I'll then investigate if we can instead improve on the P2 part ....

from tycho.

laeubi avatar laeubi commented on June 10, 2024

As there are some testfailure indicating that it might be a backward-compatibility problem I have added now a switch to explicitly enable this behavior by the following configuration in the parent (or product) pom:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-p2-publisher-plugin</artifactId>
  <version>${tycho-version}</version>
  <configuration>
	  <ignorePluginConfiguration>true</ignorePluginConfiguration>
  </configuration>
</plugin>

the builds are finally green after the outage of the eclipse-infra so this is ready to submit, it would be good if @and-k could verify that this solves the issue with a local build tycho-plugin.

from tycho.

laeubi avatar laeubi commented on June 10, 2024

The fix is now merged into the master-branch and will appear in the snapshot repository soon. Special thanks to Compart AG who has sponsored this bugfix and @and-k for providing the initial reproducer.

from tycho.

mickaelistria avatar mickaelistria commented on June 10, 2024

Do I get it right that fixing https://bugs.eclipse.org/bugs/show_bug.cgi?id=574952 would have prevented Tycho from hosting a workaround here?
I really want to avoid a trend of Tycho hosting workarounds for upstream issues.

from tycho.

laeubi avatar laeubi commented on June 10, 2024

I haven't yet got any response if this is a bug, a feature, whatever of P2 or if its intentional or an undesired side-effect so I can't tell if this is a workaround or simply a matter of providing necessary configuration options in Tycho.

from tycho.

laeubi avatar laeubi commented on June 10, 2024

@mickaelistria I have digged a bit more into this and I think the issue (for tycho) is actually that

  1. we have publish-products that publish the product on the basis of the whole target platform
  2. then we have assemble-repository that uses the real product/project dependencies to build a project specific repository in target/repository
  3. in materialize-products then this target/repository is used (but has references to plugins from step 1 not in the final product repository)

What I can think of is, that after assemble-repository we call again publish-products that then rebuilds the meta-data based on target/repository. What do you think? Would this be a more better approach (i still need to test if it actually works)....

from tycho.

mickaelistria avatar mickaelistria commented on June 10, 2024

Would this be a more better approach (i still need to test if it actually works)....

If the root cause is a p2 bug, the best approach is to fix the p2 bug.

from tycho.

laeubi avatar laeubi commented on June 10, 2024

As mentioned I'm not sure if this is a bug or not, at least some support from the P2 team would be good to analyze/verify/fix would be good as the code is rather complex and maybe there are side-effects. I'll try to explain the situation here so it might become more clear:

If the product is feature based then a publishing it results in the following items:

  • a requirement to all declared features (tycho seem to handle root features special here and add them manually!)
  • a requirement to all configured bundles (but without a version as it is not declared!) that also set the start levels
  • then in the process of publishing these data, the bundle version is resolved by P2 against the "target" (here target platform of tycho) and resolves to the highest version

What is missing (maybe by intent!) is that actually one to resolve the version against all plugins from all features, included features and so on... but this is a heavy operation, and as the P2 code does not distinguish between "plugin" and "plugin configuration" this is not very easy to change, especially as this is very deep inside the P2 code and it seems there is even some code doing nasty things to detect especially simpleconfigurator.
And then there is a hidden 'mixed' mode in P2 that is neither supported by tycho nor PDE that allows to specify features and bundles in a product.

from tycho.

mickaelistria avatar mickaelistria commented on June 10, 2024

at least some support from the P2 team would be good to analyze/verify/fix would be good

Most people who constitute what one could call "the P2 team" seem to have approved your proposal. So that's worth trying.

then in the process of publishing these data, the bundle version is resolved by P2 against the "target" (here target platform of tycho) and resolves to the highest version

If I understand correctly, https://bugs.eclipse.org/bugs/show_bug.cgi?id=574952 would avoid this by not resolving to a specific version during product publication; delegating it to install-time (p2 director).

from tycho.

laeubi avatar laeubi commented on June 10, 2024

To illustrate it with the itest provided here the product repository looks like this:

product.differentVersions/product/target/repository/plugins/org.apache.activemq.activemq-core_5.2.0.jar
product.differentVersions/product/target/repository/plugins/org.apache.activemq.activemq-jaas_5.2.0.jar
product.differentVersions/product/target/repository/plugins/org.apache.camel.camel-core_1.5.0.jar

this is what is produced (and works without any modifications) up to the assemble-repository phase, but the later materialize-products fails because it now uses the p2content.xml produced in the earlier publish-products phase where the metadata was created on the basis of the whole target-platform (and thus referencing the 5.7.0 version)!

So maybe Bug 574952 might help in this particular case, but the issue remains that tycho uses another target for generate the metadata that is actually used later to build the product. That's why it would be good to actually start a fresh "install the product from product file" run but I can't see how this would work in tycho as a different approach is used:
Actually tycho create a director call that installs the (previously published) product by referencing the product IU by id.

So that's worth trying

I'm willing to help here, but encountering some issues, see my last comment in the mentioned ticket, we might head over there for the P2 issue first...

from tycho.

laeubi avatar laeubi commented on June 10, 2024

I'll reopen this ticket as using the flag makes the simple-configurator fail. It seems this can't be resolved reliable without the help of some P2 changes (see https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/183795 for a possible patch)

from tycho.

laeubi avatar laeubi commented on June 10, 2024

@mickaelistria is it possible to use the current P2 snapshot in an official tycho build to verify it before the next p2 release?

from tycho.

mickaelistria avatar mickaelistria commented on June 10, 2024

If we start adopting p2 snapshots, then we won't be able to release before p2/Platform releases. One pitfall of using moveable snapshots is that if p2 has some bug in the snapshots, then Tycho builds/tests will start failing without a related visible change in history,and such cases become pretty expensive to troubleshot.
But since Platform release is relatively soon and there is currently no blocker in Tycho (at least for Platform and a few other projects Tycho depends on), it would be acceptable to use a specific I-Build of Platform/p2 now.

from tycho.

laeubi avatar laeubi commented on June 10, 2024

I just thought to create a PR with the snapshot to see it works (as this will trigger a full build) and simply not merge it (yet).

So we can then use the official P2 when released but still discover if there is any issue it could be found/fixed before the final release.

from tycho.

and-k avatar and-k commented on June 10, 2024

With Tycho 2.5.0 it works again as expected. Thank you @laeubi for fixing this regression issue.

from tycho.

and-k avatar and-k commented on June 10, 2024

I noticed that this issue occurs again with Tycho 2.6.0.
Strangely with Tycho 2.7.0-SNAPSHOT it's working again.
@laeubi Is it possible that the p2 fix wasn't included in the Tycho 2.6.0 release?

from tycho.

laeubi avatar laeubi commented on June 10, 2024

That's really strange, I think 2.6.0 should include the latest releases from 2021-12 ...and as there is an integration test exits for this case it should also be noticed if the problem occurs. Can you check the integration test if it maybe diverged from your use-case?

from tycho.

and-k avatar and-k commented on June 10, 2024

I ran the integration tests myself now:

I checked out the tag: tycho-2.6.0 and build it with
mvn clean install -f tycho-its/pom.xml

[ERROR] Errors:
[ERROR] Tycho109ProductExportTest.exportPluginRcpApplication:91 » Verification Exit co...
[ERROR] IncludeLaunchersTest.includeLaunchers:27 » Verification Exit code was non-zero...
[ERROR] IncludeLaunchersTest.noIncludeLaunchers:40 » Verification Exit code was non-ze...
[ERROR] CustomSourceEncodingTest.test:27 » Verification Exit code was non-zero: 1; com...
[ERROR] ProductMixedVersionsTest.testMixedPluginVersions:33 » Verification Exit code w...
[INFO]
[ERROR] Tests run: 224, Failures: 0, Errors: 5, Skipped: 4

Then I checked out the tag: tycho-2.5.0 and build it with
mvn clean install -f tycho-its/pom.xml

[ERROR] Errors:
[ERROR] Tycho109ProductExportTest.exportPluginRcpApplication:91 » Verification Exit co...
[ERROR] IncludeLaunchersTest.includeLaunchers:27 » Verification Exit code was non-zero...
[ERROR] IncludeLaunchersTest.noIncludeLaunchers:40 » Verification Exit code was non-ze...
[ERROR] CustomSourceEncodingTest.test:27 » Verification Exit code was non-zero: 1; com...
[INFO]
[ERROR] Tests run: 221, Failures: 0, Errors: 4, Skipped: 4

So for release 2.6.0 the integration test ProductMixedVersionsTest.testMixedPluginVersions is also failing for me.

from tycho.

laeubi avatar laeubi commented on June 10, 2024

@and-k can you confirm that it works with the current 2.7.0 SNAPSHOT?

from tycho.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.