Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 559620 - Incorrect repository generation with tycho 1.6
Summary: Incorrect repository generation with tycho 1.6
Status: CLOSED INVALID
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 4.15   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 350088
Blocks: 551486
  Show dependency tree
 
Reported: 2020-01-28 05:51 EST by Sarika Sinha CLA
Modified: 2020-02-25 05:34 EST (History)
5 users (show)

See Also:


Attachments
Smaller reproducible scenario (710.40 KB, application/x-gzip)
2020-02-10 05:14 EST, Sarika Sinha CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sarika Sinha CLA 2020-01-28 05:51:23 EST
Faced issue during Bug 551486, where repository is not generated properly. 
Example: 
Incorrect repository with tycho 1.6 -
https://download.eclipse.org/eclipse/updates/4.15-P-builds/P20200122-0550

Correct Repository with tycho 1.4:
https://download.eclipse.org/eclipse/downloads/drops4/P20200128-0510/

Probably an issue with org.eclipse.tycho:tycho-p2-repository-plugin:1.6.0:assemble-repository
Comment 1 Mickael Istria CLA 2020-01-28 05:54:00 EST
Can you please explicit what's correct/incorrect, it's not obvious at 1st sight.
Comment 2 Sarika Sinha CLA 2020-01-28 05:56:51 EST
(In reply to Mickael Istria from comment #1)
> Can you please explicit what's correct/incorrect, it's not obvious at 1st
> sight.

Incorrect one has extra features for JDT and PDE from master:
org.eclipse.jdt_3.18.300.v20200110-0905.jar
org.eclipse.pde_3.14.300.v20200110-0905.jar
Comment 3 Alexander Kurtakov CLA 2020-02-04 09:03:22 EST
Would you please create a small reproducer which can be used to debug the issue? P-builds are enough of a hassle on their own to be used to debug tycho.
Comment 4 Sarika Sinha CLA 2020-02-10 05:14:18 EST
Created attachment 281764 [details]
Smaller reproducible scenario

@Alex, @Michael,
I hope this smaller reproducible use case will be convenient to reproduce the problem.

PDE git repository can also be used instead of pde.ui and pde.build.


Thanks Sravan!
Comment 5 Mickael Istria CLA 2020-02-10 05:20:06 EST
(In reply to Sarika Sinha from comment #4)
> Created attachment 281764 [details]
> Smaller reproducible scenario
> 
> @Alex, @Michael,
> I hope this smaller reproducible use case will be convenient to reproduce
> the problem.

Which command should we run and in which order to see the issue?
Comment 6 Sravan Kumar Lakkimsetti CLA 2020-02-10 05:31:12 EST
mvn clean verify -f eclipse.platform.releng.tychoeclipsebuilder/java14patch415 -Pjava14patch415 -DskipTests=true(In reply to Mickael Istria from comment #5)
> (In reply to Sarika Sinha from comment #4)
> > Created attachment 281764 [details]
> > Smaller reproducible scenario
> > 
> > @Alex, @Michael,
> > I hope this smaller reproducible use case will be convenient to reproduce
> > the problem.
> 
> Which command should we run and in which order to see the issue?

mvn clean verify -f eclipse.platform.releng.tychoeclipsebuilder/java14patch415 -Pjava14patch415 -DskipTests=true

if this command gives error in building eclipse.pde.ui or eclipse.pde.build please replace those folders with respective git repos
Comment 7 Mickael Istria CLA 2020-02-10 05:51:33 EST
(In reply to Sravan Kumar Lakkimsetti from comment #6)
> mvn clean verify -f
> eclipse.platform.releng.tychoeclipsebuilder/java14patch415 -Pjava14patch415
> -DskipTests=true

I see

[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project  (/home/mistria/sandbox/patch-feature/patch_source/eclipse.platform.releng.tychoeclipsebuilder/java14patch415/pom.xml) has 1 error
[ERROR]     Non-readable POM /home/mistria/sandbox/patch-feature/patch_source/eclipse.platform.releng.tychoeclipsebuilder/java14patch415/pom.xml: /home/mistria/sandbox/patch-feature/patch_source/eclipse.platform.releng.tychoeclipsebuilder/java14patch415/pom.xml (No such file or directory)


Is the pom actually missing or does the command point to wrong location?
Comment 8 Sravan Kumar Lakkimsetti CLA 2020-02-10 06:52:31 EST
I will check tomorrow morning and let you know i think i may have given you wrong command. Basically you need trigger maven command with home/mistria/sandbox/patch-feature/patch_source/eclipse.platform.releng.tychoeclipsebuilder/java14patch415/pom.xml

You'll get the repository in eclipse... repository folder inder java14patch415
Comment 9 Sravan Kumar Lakkimsetti CLA 2020-02-11 04:57:03 EST
Here the updated source bundle https://drive.google.com/file/d/1tDVKloLPcWHHwDLx8eqdKUk1sYSmUvSB/view?usp=sharing

Once the tar is extraced, you'll find eclipse.platform.releng.aggregator folder

> cd eclipse.platform.releng.aggregator/eclipse.platform.releng.tychoeclipsebuilder/java14patch415
> mvn -f pom.xml clean verify -Pjava14patch415 -DskipTests

Please check the folders features and plugins in side eclipse.platform.releng.tychoeclipsebuilder/java14patch415/eclipse.releng.repository.java14patch/target/repository/

these folders should have only the jars ending with BETA_JAVA14.jar other jars should not be present

If you want to run with tycho 1.4 please modify tycho.version and tycho-extras.version in eclipse.platform.releng.aggregator/eclipse-platform-parent/pom.xml
Comment 10 Mickael Istria CLA 2020-02-14 09:59:33 EST
The behavior changed between Tycho 1.5.1 and Tycho 1.6.0.
I actually think it's caused by a change in how p2 specify dependency on patched feature (maybe https://git.eclipse.org/c/equinox/rt.equinox.p2.git/commit/?id=3d0b351e0d3f340bcc26f7a651f4eebfc817b722 ); the metadata are slightly different, but the "greediness" doesn't seem to change, so it can be unrelated.
Comment 11 Mickael Istria CLA 2020-02-14 11:38:26 EST
Before we spend more effort on this issue, I have a genuine question: what actual usage or integration issue is caused by this one? Hqvibg the pqtched feature in the same repo can actually help as people who don't have previous PDE installed and try to install the patch feature are more likely to be successful.
Comment 12 Sarika Sinha CLA 2020-02-18 03:46:03 EST
(In reply to Mickael Istria from comment #11)
> Before we spend more effort on this issue, I have a genuine question: what
> actual usage or integration issue is caused by this one? Hqvibg the pqtched
> feature in the same repo can actually help as people who don't have previous
> PDE installed and try to install the patch feature are more likely to be
> successful.

The problem is that the installation of P build fails on I build because of this change. In P Build we specify the 4.15 M1 build as base, so the patch build installs on this M1 build but if any future I build is taken, PDE fails to install. Whereas the P build built with tycho 1.4, it installs well on all the I builds after M1 also.
Comment 13 Mickael Istria CLA 2020-02-18 17:52:13 EST
So it seems to me it's not a Tycho isuse, but it's exactly that the strategy that's used by JDT P-builds is contrary to goal of bug 350088.
I think you'll be able to reproduce it with PDE build or with the Export > Plugin Development > Deployable features wizard.
Would it be possible to have this P-Build built against the current I-Build of JDT?
Comment 14 Sarika Sinha CLA 2020-02-18 22:49:06 EST
(In reply to Mickael Istria from comment #13)
> So it seems to me it's not a Tycho isuse, but it's exactly that the strategy
> that's used by JDT P-builds is contrary to goal of bug 350088.
> I think you'll be able to reproduce it with PDE build or with the Export >
> Plugin Development > Deployable features wizard.
> Would it be possible to have this P-Build built against the current I-Build
> of JDT?

No, this defeats the purpose. Because P build is built after we have the Beta branch in a logical state. And the Marketplace Entry states that this P build can be applied on any build after a certain build. Updating Marketplace entry for each P build will be a manual activity.
Comment 15 Mickael Istria CLA 2020-02-19 02:42:40 EST
(In reply to Sarika Sinha from comment #14)
> And the Marketplace Entry states that this P
> build can be applied on any build after a certain build.

So according to https://help.eclipse.org/2019-12/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Ffeature_manifest.html , this has never been supposed to work: `If "patch" is "true", version must be set. [...] If "patch" is "true", "perfect" is assumed and other values cannot be set. [...] perfect: Dependent plug-in version must match exactly the specified version."

and this approach has been abusing a bug that was fixed with bug 350088.

> Updating
> Marketplace entry for each P build will be a manual activity.

I think it's better to have the patch feature built against I-Build, so if someone installs the patch feature from marketplace, they'll get an upgrade to I-Build if the "host" + the patch, and it provides the story you want of being able to use patch feature after a certain build while using a patch.
Comment 16 Ed Merks CLA 2020-02-21 04:15:48 EST
Is there something more to do in p2?  Or is this "user error to rely on old buggy behavior"?
Comment 17 Mickael Istria CLA 2020-02-21 10:40:08 EST
Let's mark it as INVALID as p2 and Tycho are behaving as expected according to the contract defined in the good old feature.xml description.
Comment 18 Sravan Kumar Lakkimsetti CLA 2020-02-25 04:18:36 EST
(In reply to Mickael Istria from comment #17)
> Let's mark it as INVALID as p2 and Tycho are behaving as expected according
> to the contract defined in the good old feature.xml description.

I think the new behavior is similar to setting true to flag "includeAllDependencies" (link: https://www.eclipse.org/tycho/sitedocs/tycho-p2/tycho-p2-repository-plugin/assemble-repository-mojo.html#includeAllDependencies)

In our build we don't set this flag. By default this should be set to false. Can you please let us know the importance of this flag?
Comment 19 Mickael Istria CLA 2020-02-25 04:33:17 EST
(In reply to Sravan Kumar Lakkimsetti from comment #18)
> I think the new behavior is similar to setting true to flag
> "includeAllDependencies" (link:
> https://www.eclipse.org/tycho/sitedocs/tycho-p2/tycho-p2-repository-plugin/
> assemble-repository-mojo.html#includeAllDependencies)

The results look similar, but the reason is a bit different and lies in p2 publisher: when a feature has a dependency on a specific version of another feature, it's considered as an include and the referenced feature is included.
But this is consistent with the patch feature "contract", so neither p2 nor Tycho are much to blame here.
Comment 20 Sravan Kumar Lakkimsetti CLA 2020-02-25 04:55:48 EST
(In reply to Mickael Istria from comment #19)
> (In reply to Sravan Kumar Lakkimsetti from comment #18)
> > I think the new behavior is similar to setting true to flag
> > "includeAllDependencies" (link:
> > https://www.eclipse.org/tycho/sitedocs/tycho-p2/tycho-p2-repository-plugin/
> > assemble-repository-mojo.html#includeAllDependencies)
> 
> The results look similar, but the reason is a bit different and lies in p2
> publisher: when a feature has a dependency on a specific version of another
> feature, it's considered as an include and the referenced feature is
> included.
> But this is consistent with the patch feature "contract", so neither p2 nor
> Tycho are much to blame here.

Ok. Here is the requirement here

We need to create a patch repository with the following requirements

1. This repository should have patches for JDT feature and PDE feature
2. should be applicable on specified version range for example we want to apply the patch on a feature whose version falling between [3.18.300.v20200110-0905,3.19.0.v20200610-0905)
3. Should contain only the modified plugins

Can you please suggest a way to achieve this?
Comment 21 Mickael Istria CLA 2020-02-25 05:01:07 EST
(In reply to Sravan Kumar Lakkimsetti from comment #20)
> We need to create a patch repository with the following requirements
> 1. This repository should have patches for JDT feature and PDE feature
> 2. should be applicable on specified version range for example we want to
> apply the patch on a feature whose version falling between
> [3.18.300.v20200110-0905,3.19.0.v20200610-0905)

Patch feature cannot be applied on a version range by contract. Your requirement cannot be fulfilled directly by a single patch features. You'll need to have 1 patch feature per version of the feature you want to patch. I suggest you create 1 patch feature for latest milestone + 1 patch feature for the latest I-Build and publish both in the repository.

> 3. Should contain only the modified plugins

I think this requirement is overkill and you should consider getting rid of it at the moment. What matters isn't really the content of the repo but the metadata.

> Can you please suggest a way to achieve this?

As mentioned above, as single patch feature cannot work.
Comment 22 Mickael Istria CLA 2020-02-25 05:02:59 EST
Instead of patch features, have you considered using a +0.0.100 feature on the Java14 branches and publishing those "regular" features? They'll be apply-able on a version range.
Comment 23 Sravan Kumar Lakkimsetti CLA 2020-02-25 05:23:10 EST
(In reply to Mickael Istria from comment #22)
> Instead of patch features, have you considered using a +0.0.100 feature on
> the Java14 branches and publishing those "regular" features? They'll be
> apply-able on a version range.

So basically using the Y-build update site instead of Patch build.

Y-build is a full build with +0.0.50 on modified features
Comment 24 Mickael Istria CLA 2020-02-25 05:26:22 EST
(In reply to Sravan Kumar Lakkimsetti from comment #23)
> So basically using the Y-build update site instead of Patch build.

Yes, I think that would work and be simpler to grok from maintenance and usage POV.

> Y-build is a full build with +0.0.50 on modified features

Good.
Comment 25 Sarika Sinha CLA 2020-02-25 05:27:56 EST
 +0.0.50 is little complicated as the beta branch was initially based on 4.14 but finally it needs to be merged mack to master and then the +0.0.50  will be on 4.16. Lot of API filters associated, basically lot of effort in doing all this multiple times. 

So if anything can be done for P Build itself, it will really help.
Comment 26 Mickael Istria CLA 2020-02-25 05:34:03 EST
(In reply to Sarika Sinha from comment #25)
> So if anything can be done for P Build itself, it will really help.

If your requirements for testing can be reduced mostly to testing against
* Last M-Build
* Last I-Build
(ie if you can drop intermediary I-Builds)
I think building 2 patch features in the same build is the easiest approach (one with static version for the M-Build, another with 0.0.0 to resolve to latest I-Build).

On the long run, it would be great if we can find a productive workflow that gets rid of patch features. Patch features have always brought some complexity here and there that is better when avoided.