-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fix creation of generic-capabilities with multiple versions #64
Fix creation of generic-capabilities with multiple versions #64
Conversation
Indeed, some tests would be welcome. I believe this part of the code is relatively well tested already, so it shouldn't be too hard to add 1 test. |
89915de
to
c4145e5
Compare
This change is ready for submission (tests have been added). It would be great if this would make it into RC1, but it requires Project-lead/PMC approval. I also managed to build/install a version of Tycho locally that uses this change and can confirm this change fixes the build problem from eclipse-equinox/equinox.framework#44 (comment). It only requires to use the updated target-platform from eclipse-platform/eclipse.platform.releng.aggregator#239 which can be achieved by adding the containing module locally. |
I would leave that decision to @tjwatson |
@HannesWell the freeze period check still success here should it not give a red x here? |
There is no entry that contains the word "stabilization" in the calendar for today. Therefore the build succeeds: In general I think it would be good if the freeze period would get their dedicated entries in the calendar. That would make it simpler to understand. |
Maybe "Endgame" is an alias here? |
I created eclipse-platform/eclipse.platform.releng.aggregator#272 to discuss further improvements of the freezePeriod check so we can keep this one on topic :) |
@tjwatson could please review this PR. If we submit this until tomorrow (Wednesday) evening it will be considered for RC1. |
...equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java
Show resolved
Hide resolved
This is what the 'a.jre.javase' version 18.0.0 IU looks like in p2:
Changing the API of IProvidedCapability seems like a bit of a non-starter... Furthermore, the p2 repositories are so full of a.jre.javase IUs in the above form that they will never be stamped out of existence. And even if that wasn't a problem, it seems to me that because the a.jre.javase IUs aren't singletons, more than one can together satisfy a requirement that seeks to exclude Java 18. So I can't foresee that we could fix this problem for osgi.ee... It seems odd that org.eclipse.equinox.internal.p2.metadata.RequiredPropertiesMatch was introduced, primarily to support osgi.ee requirements, but this was not recognized as a problem... The following (the selected negative requirement) is the only way I could figure out how to express in p2 to exclude an IU with Java 17 osgi.ee capability: |
Thanks Ed. And in general multi-versioned provided-capabilities are not working at all the moment, so I think we cannot break it. |
I don't know how these a.jre.javase IUs are manufactured; I think Tycho does that. In the JustJ generator, it creates a p2.inf for this purpose using this to produce the strings And this to generate capability advice I've never looked in detail at how the relatively new RequiredPropertiesMatch works either... Perhaps as you suggest it's better that it be overly permissive with multiple capabilities rather than not working at all... |
I think it is generated here: |
@laeubi Indeed! That explains why searching for "a.jre.javase" didn't turn it up. :-P |
If I search for "how do P2 do it" I always open |
Some parts of the discussion accidentally shifted to eclipse-equinox/equinox.framework#44 (comment) and following:
@merks replied:
I replied:
How should we proceed here? Submit this change now and later 'fix' the part of the code that is intended to handle multi-versioned capabilities to merge multiple equivalent single-version capabilities to one? |
IIUC, we already represent the I also do not really understand how p2 represents the generic filter expression to produce Perhaps I'm diving into where all the dragons live and we don't really need to go there? |
Yes, I understand it the same.
If we go the way suggested here, we definitely would have to support 'flattened' single version capabilities for a long time, even if we manage to implement multi-version capabilities in the future since the release-repos (ideally) life forever.
Maybe, but I really cannot tell. Although I would be happy to complete eclipse-equinox/equinox.framework#44 it is actually not urgent. Besides that actually I could revert the removal of |
I'm fine keeping The problem with this p2 issue is that once it is fixed we have to wait another release until we get a version of p2 in the field that can then be used to update to the version where we need the support for the multi-version capability/requirement matching. |
Alright. Yes lets not make the SimRel team busy. As the replacement of the other packages showed it requires some adjustments of test-setups and products that use specific bundles.
Unfortunately yes. But the only way to speed that up would be #23. |
I can't even tell if it makes any sense, that's like you would require that your Framework runs on Java 7 and Java 8 at the same time... |
You seem to be missing the point. The point isn't for me to make an example that is semantically meaningful (in your opinion) but rather to draw attention to the fact that there are things that one can express (syntactically) that resolve in OSGi but will not resolve when mapped to p2. If no one will ever sensibly/semantically do that because it's nonsense, great, it doesn't matter. But nevertheless, this corner exists and where there is room for existence, something may dwell in the future... Again, I'm fine with ignoring this corner, but I don't think we should misunderstand it. |
The question for me is just, do we want to work on the larger scoped problem (that might be resolved on different levels), or solve just this case (that might not solve others we need to address in the future). Just from a simple minded standpoint, probably the problem is more when evaluating the expression then, because obviously the Unit does provides versions 2 and 2.1, and writing it in one or two lines should not make a difference at all regardless on how we express this in the model... but I have no clue whats easier here, change the Expression evaluator or change the model. I would be fine with any of those as long as we make progress here until the 2022-12 release so it can finally be fixed and we are not leaving behind just we are freeze because of the complexity and never move on in any direction. |
I'm not sure that "this" case is well defined here. The solution being proposed is to expand a multi-version capability into multiple single-version capabilities. That doesn't seem unreasonable and it's likely that in the great majority of the cases the multi-version syntax is "just a shortcut" for that.
Here you effectively argue that multi-version capabilities have no semantic meaning. But the resolution process is about binding requirements with capabilities; the hosting IUs aren't relevant during that processing. But let's not argue the point because that will get us nowhere, and certainly not toward the conclusion that you wish to reach.
So I think we mostly all agree that expanding a multi-version requirement is the path of least resistance and will cover the common sensible cases in the real world. Let's give @tjwatson as chance to comment with any concerns he might have. |
At least there is |
To reiterate, let's not argue this point because that will get us nowhere, and certainly not toward the conclusion that you wish to reach... |
I think what is being asked of me is if I think it is OK to represent a multi-version capability as separate distinct capabilities for the purposes of p2 resolution. As Ed points out, that will not solve some (likely corner case) filters that try to be excluded when matching some specific capability at a specific version for some reason. I don't think that is a common thing. I've only seen it on osgi.ee requirements say if you want to match on all versions >=7 and < Java 9 it would be something like "(&(osgi.ee=1.7)(!(osgi.ee=9.0)))". But I've not seen a common use case for that in other capabilities like the osgi.contract capabilities. So for the short to mid-term solution it may be OK to live with this limitation. We have been living with it for osgi.ee and (AFAIK) we have no one really complaining. The main issue I have is if we ever do want to consolidate such fanned out capabilities back into a single muilt-value capability will we have made that more complicated to achieve in the future. My suspicion is that we cannot really know if that will be overly complicated by this decision or not. Furthermore, my suspicion is that we will never really revisit this topic unless it becomes a real pain point for some use case discovered in the field. I don't see anyone wanting to spend large amounts of time solving some academic issue that nobody has really run into. |
If I understand it correctly, those corner cases don't work today either, do they? I think it is OK, if this solution only fixes some cases ,hopefully the most common ones, but not all.
That is IMHO the more important point, we should not block a more complete solution in the future (if required) by this not perfect solution. To me it looks like this is boiled down to one question: |
I believe in OSGi there is a semantic difference. I thought Thomas has already mentioned that twice. I think if necessary, in the future we could stop expanding to multiple capabilities and create a new type of capability. I don't think that would break the existing uses of the proposed approach. |
Thanks Ed, yes to be clear a single capability with a list of values for a single attribute is semantically different than multiple capabilities with a single value for the attribute from the original list of values. For OSGi capabilities a version is treated no differently than any other capability attribute. Perhaps another example, not using versions, will make it more clear
vs.
In OSGi when you have a requirement like:
That will try to resolve the requirement to a single capability that can satisfy supporting both red and blue. If you separate that single capability into 3 different capabilities there will be no single capability that can support both red and blue. So the resolution will fail. OSGi resolution does not consider a group of capabilities and their combined attributes to be able to satisfy a requirement. Each capability that the resolver considers to be a valid candidate must satisfy the requirement filter on its own. With that being said, I am fine moving forward with a solution that does not do this for version attributes and fanning out the capabilities like that which is being suggested. The main issue is that p2 (and the old equinox resolver BTW) treat version as a special attribute when compared to other matching attributes. It did this because back then there were only a limited number of capability types (osgi.wiring.package, osgi.wiring.host, osgi.wiring.bundle) and all of them were considered to have a single defined version. |
c4145e5
to
31bb14f
Compare
Sorry for asking the same question again.
That is the information I was searching for and now its crystal clear. Thank you Tom. :) Since everybody seems to be fine with the proposed approach, do you have any more remarks regarding the implementation? |
...equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java
Outdated
Show resolved
Hide resolved
31bb14f
to
bf5b96f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is an improvement over current state, does fix some bugs without really harming anything else, so it is good enough in practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let move this forward. Thanks.
Great, thank you. Should we then publish a P2-Snapshot soon so that it can be used in a Tycho Snapshot? |
This workflow is currently not really supported ... but I'm working on it ;-) |
Great! |
Snapshots are supposed to be published on every I-Build to https://repo.eclipse.org/content/repositories/eclipse-snapshots already. But looking at https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/platform/org.eclipse.equinox.p2.publisher.eclipse/ , it looks like there is currently some glitch, for which I've opened eclipse-platform/eclipse.platform.releng#121. |
This PR aims to fix the flawed read/processing of provided Generic-capbailities that have a list of versions, which was discovered in eclipse-equinox/equinox.framework#44 (comment).
I think I should add some tests for this.
Furthermore I would like to test this fix first locally with Tycho as described here:
https://github.com/eclipse/tycho/blob/master/CONTRIBUTING.md#building-tycho-against-a-locally-built-version-of-p2