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

Encode in a feature requirement if it is a "require" requirement #138

Closed
laeubi opened this issue Aug 23, 2022 · 32 comments
Closed

Encode in a feature requirement if it is a "require" requirement #138

laeubi opened this issue Aug 23, 2022 · 32 comments

Comments

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

As discussed in eclipse-tycho/tycho#1281 in certain cases it is desirable to not include things that are marked as "require" in a feature into an update site.

Tycho is using a (customized) MirrorApplication for building a Repository from the P2 metadata of a feature but encounters the following problem in the FeaturesAction:

for (FeatureEntry entry : entries) {
VersionRange range = getVersionRange(entry);
String requiredId = getTransformedId(entry.getId(), entry.isPlugin(), /*isGroup*/true);
required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, requiredId, range, getFilter(entry), entry.isOptional(), false));
}

here every requirement is encoded as a requirement regardless of it is a plugin, includes (=feature) or requires (either bundle or plugin) of the form :

<required namespace='org.eclipse.equinox.p2.iu' name='my.bundle' range='...'/>
<required namespace='org.eclipse.equinox.p2.iu' name='my.feature.feature.feature.jar' range='...'>

so at the mirroring phase, Tycho has no way to distinguish if this is a something to consider or not because:

<requires>
   <import plugin="bcpkix" version="1.2.3" match="perfect"/>
</requires>

and

<plugin  id="bcpkix"> ... </plugin>

both create the same metadata that is:

<required namespace='org.eclipse.equinox.p2.iu' name='bcpkix' range='[1.2.3,1.2.3]'/>

Possible things to mitigate this:

  1. It seems each requirement can have a description, if that is persistent, one might add requires if the FeatureEntry#isRequires
  2. Currently all requirements are added with optional=false because you cannot control for requires that they are optional, so probably one can declare the FeatureEntry#isRequires as non greedy and optional as claimed here.
  3. one can have an additional attribute (not sure if that is even possible without major effort.
@laeubi
Copy link
Member Author

laeubi commented Aug 23, 2022

@merks that's how far I can track this down, would be good if you can help sorting this out so we can have the "flag that everyone wants" in Tycho afterwards.

@merks
Copy link
Contributor

merks commented Aug 24, 2022

I would not go down such a root. The IRequirement.getDescription() is just text and is generally not populated. It's not even mentioned here for populating via a p2.inf:

https://wiki.eclipse.org/Equinox/p2/Customizing_Metadata#Capability_Advice

Personally, I think to try to use information in the description to have semantic content/impact seems like a hack at best.

I don't know why Eike brought up greedy/optional; that seems not relevant here other than as some analog to how includes are treated differently from requires when composing an update site from features...

What was the behavior for <import plugin="bcpkix" version="1.2.3" match="perfect"/> before you changed the behavior?

Personally, I would just restore the original behavior however it was implement. Probably it was treating these two things as identical and no one every noticed or complained. Trying to add more metadata to IRequirement is definitely an ocean boiling exercise and will break 'bad' frameworks like the CBI p2 aggregator used for building the SimRel repository and Maven-published repositories.

So my suggestion would be to look at the range, and if there is exactly one version that can satisfy the range, treat it as an include, otherwise treat it as an import. Yes, that's not perfect and would treat match="perfect" as an include. But given no one noticed and no one complained about the past behavior, I can't imagine that being a problem that needs to be solved with major effort.

If you feel strongly that such information must be encoded to achieve perfection, I would encode additional information as IU properties instead.

As a name for a flag that everyone wants, I'd suggest "includeAllFeatureRequirements" or perhaps "includeFeatureImports". Personally I think it would be better to be false by default, to avoid surprising but very impactful behavior changes (that 'nobody wants').

I wonder what @sratz thinks about this theme? As I mentioned, I think it's sufficient to restore the previous behavior via configuration and avoid significant further complications...

(Note that I'll be traveling the next days and will not have so much time.)

@laeubi
Copy link
Member Author

laeubi commented Aug 24, 2022

What was the behavior for <import plugin="bcpkix" version="1.2.3" match="perfect"/> before you changed the behavior?

As described above, these produces identical metadata and thus such a plugin/feature will be included.

If you feel strongly that such information must be encoded to achieve perfection

Its not about "perfection" it is about consistency. If we say that <import plugin/feature=" " .../> should not included, or not always included (e.g. controlled by a flag) then this should simply always work, it should not be a side effect (what it currently is/was), because currently it is simply assumed that if a perfect match version is given it is assumed that this is not an import (Tycho even mention it in the current site-doc here:

Dependencies with a strict version range, i.e. a range which only matches exactly one version of an artifact, are also considered as inclusions

So what happens is that you use a strict range and the import is part of your update-site and some times later you decide to use a version range, now suddenly an artifact is not included anymore and your install probably fail and you can really get mad banging your head on the desk because you see it is mentioned in the feature.

Of course it will work the other way round if you don't like the inclusion at all, and likes to pin your version while before the stuff was not included now it suddenly is (and you will blame Tycho and getting angry).

But given no one noticed and no one complained about the past behavior,

I really would appreciate to not apply experience from one "domain" to all other "domains", obviously it was noticed and complained, otherwise no one would have bothered to mentioned it in the docs (and no one would have bother to try fixing this). And simply because one is not affected to not mean others are not affected as well.

As a name for a flag that everyone wants, I'd suggest "includeAllFeatureRequirements" or perhaps "includeFeatureImports". Personally I think it would be better to be false by default, to avoid surprising but very impactful behavior changes

I'm all open for that and most probably will provide a patch today, still the problem remains that such a flag is confusing if it do not do what is claims to and thus I'm aiming for a solution "at the root" so we can have a solution that really satisfies everyone and do not depend on surprising side-effects.

I would encode additional information as IU properties instead.

Could you probably propose a patch for the FeaturesAction? I actually won't mind the exact approach but must confess I'm not completely clear here how it should looks like because one must be able to match this to the actual requirement later on.

@merks
Copy link
Contributor

merks commented Aug 24, 2022

I know those things produce identical p2 data and I personally think it's fine to treat that identically in Tycho.

In any case, as mentioned I do not have significant availability now until Monday. Let's see with @sratz thinks about this...

@laeubi
Copy link
Member Author

laeubi commented Aug 24, 2022

I know those things produce identical p2 data and I personally think it's fine to treat that identically in Tycho.

In any case, as mentioned I do not have significant availability now until Monday. Let's see with @sratz thinks about this...

No problem we do not need a solution right now, so better safe than sorry:

  1. This problem was not noticed more than four months so it doesn't matter a few days anyways
  2. Old releases can be used in the meanwhile for everyone trying an upgrade until it is fixed
  3. I can still prepare a patch for Tycho 3.x and we either can fix it with 2022-09 or 2022-12 release as it do not make things worse as they are currently are

@sratz
Copy link
Contributor

sratz commented Aug 29, 2022

So I have been trying to better understand the core problem and tried try to summarize:

What users typically want:

  • <plugin> and <includes> (features) shall be included inside an update site
  • <requires> (plugins and features) shall not be

How Tycho works:

  1. the feature.xml is converted into pure p2 metadata.
  2. There is no distinction anymore where the dependency originated from
  3. The update site artifact is assembled using a mirror application using a slicer. The default slicer implementation only picks dependencies to be mirrored if they are defined with a strict version requirement.

Why it typically worked in the way people expected it to:

  • When a feature.xml is modelled, for <plugin> and <includes> typically the attribute version="0.0.0" is used.
    • This results in a strict p2 metadata version range [x.y.z,x.y.z]
    • The slicer picks that one up during assembly of the update site
  • When a feature.xml is modelled and one wants to depend on a different feature during runtime, but that feature is not to be shipped as part of one's own update site, a <requires> element is used
    • Here, you typically do not use a strict version requirement, but usually a lower bound our a range.
    • Due to the way the slicer behaves, this is not picked up during assembly of the update site.

So the result that 'everyone expects' is really just a convenient side effect of how the slicer works and how you model dependencies.

And if one were to deviate from that "0.0.0" for <plugin> and <includes> + range for <requires> pattern the semantics would change and the expectation would not be fulfilled anymore.

@laeubi Your suggestion would be to explicitly remember the origin of a dependency in the p2 metadata, so that we can also explicitly make a decision later based on that flag when assembling an update site.

I agree that explicit things are always better and that the previous behavior was indeed undefined.

For Tycho 3.0.0 it sounds reasonable to make this explicit. That is:

  • Introduce such origin metadata in p2 for Tycho to set and consider
  • Make things explicit during update site assembly:
    • Package <plugin> and <includes> (no matter whether strict or not)
    • Do not package <requires> (also no matter whether strict or not)
    • Maybe these can be overridden using options
  • For the typical scenarios this would result in the same content ending up in the update site and this would be a 'compatible' change
  • Only for atypical scenarios things would change incompatibly

@laeubi
Copy link
Member Author

laeubi commented Aug 29, 2022

So the result that 'everyone expects' is really just a convenient side effect of how the slicer works and how you model dependencies.

Correct! Even "worse" the first case (<plugin/includes version="0.0.0" ...>) is always resolved at buildtime that means if the version changes, one needs to rebuild/deploy the feature, what is a constant source of confusion.

Your suggestion would be to explicitly remember the origin of a dependency in the p2 metadata, so that we can also explicitly make a decision later based on that flag when assembling an update site.

I think this would be most obvious also from the P2 meta-data side, because otherwise there is no real chance to recover this data reliable one might parse the feature again, but from P2 POV there is only convention, but not requirement that a given meta-data maps to a "real" feature. Ideally, given how Slicer works, either the IRequirement alone is sufficient, or the IInstallable unit together with an IRequirement to make such decisions.

e.g. currently there is a method QueryUtil.isGroup(iu) so if there should be something like QueryUtil.isRequire(requirement) (the term "direct dependency" is quite misleading here).

@merks
Copy link
Contributor

merks commented Aug 29, 2022

Note that for the comment about And if one were to deviate from that "0.0.0" for <plugin> that the alternative deviation would be to use an explicit fixed version number, so even in that case it would continue to not be open range but a range for a strict version range specifying a single version.

With with regard to 0.0.0 being a constant source of confusion, one can argue it's 'just' bad tool support. Why can't this be detected and reported in the IDE? In fact, how often do builds failed because the MANIFEST.MF needed an increment but nothing in the IDE complained about it? But we really digress here. :-P (Oomph's version builder always detects when anything included by a feature has incremented its version and therefore the feature itself must increment its version, producing an error message, with a quick fix.)

@laeubi
Copy link
Member Author

laeubi commented Aug 29, 2022

With with regard to 0.0.0 being a constant source of confusion, one can argue it's 'just' bad tool support. Why can't this be detected and reported in the IDE?

I'm not sure what you suggest here, but in PDE there are the following options (sadly only applied to either all or nothing):

grafik

while the first is version = "0.0.0" the second is version = <whatever is in your workspace> and the third is something I have no clue about ...

What actually is "confusing" is, that this "synchronize at build" assumes that your are always build "all at once" (I assume actually it is assumed to be computed at the time of the build of the updatesite!) while with distributed artifacts (platform build, or any other where there is a split) this can become quite cumbersome because you need to touch the feature (so it gets a new version!) so changes in the plugin version is picked up.

Oomph's version builder always detects when anything included by a feature has incremented its version and therefore the feature itself must increment its version, producing an error message, with a quick fix

You might want to contribute this to PDE/API tools then :-)

@merks
Copy link
Contributor

merks commented Aug 29, 2022

This may be a stupid idea... I believe the only problem is that 'perfect' maps to a requirement that looks just like an include. What if we mapped 'perfect' x.y.z.q to [x.y.z.q,x.y.z.q_], i.e., to a range so tiny (note the appending of a _ to the qualifier or using that as the qualifier if there is none) that in actual practice, only a single artifact version would ever match. I know it's not perfect (pun intended), but it's expedient and I'm doubtful that anyone actually uses perfect (based on no facts whatsoever).

As we've noticed, IRequirments can't carry additional metadata and to try to add that will be a long and painful exercise Representing the information as IU metadata (property) associated with the requirement can be done without API or serialization changes but is a bit non-trivial because requirements don't have any kind of identity; we'd need to specify a list of IU ID and version-range pairs. Or maybe we just keep a list of the includes and then we only need to specify ID and version pairs. It can certainly be done, but it just feels like overkill or a corner case...

@laeubi
Copy link
Member Author

laeubi commented Aug 29, 2022

I'm doubtful that anyone actually uses perfect

I think we should not replace one assumption by another :-) If we really think no one uses that, it might better be removed from the PDE UI, from the feature.xml and so on...

As we've noticed, IRequirments can't carry additional metadata and to try to add that will be a long and painful exercise

Maybe not arbitrary metadata, but adding a (fixed) attribute? Also given that IRequirement has an extension of IRequiredCapability that claims:

Capabilities are entirely generic, and are intended to be capable of representing anything

one might have more extensions here if it is considered to dangerous to extend the existing items?

Or maybe we just keep a list of the includes and then we only need to specify ID and version pairs.

Even though this might be considered even more complex, currently we have <requires> that list all those, just from XML perspective I can think of having another section <prerequisites> that list those that are "not so required requirements".

This of course will most likely require to duplicate the data partly to not break backward-compatibility, so a flag like

<required namespace='org.eclipse.equinox.p2.iu' name=..' range='..' required=true/false/>

seems less disturbing ...

@merks
Copy link
Contributor

merks commented Aug 30, 2022

I think it is important to note that this need for additional metadata is purely something needed by and used by Tycho. Even there, it's an implementation detail of how Tycho implements the interpretation of a category.xml. It's certainly not something that p2 itself needs or uses for resolving requirements. Arguably Tycho could implement this differently, so elevating this to p2 API is somewhat questionable...

Looking more at implementation details, the current slicers and projector already use the concept of a 'strict version requirement' to determine if a requirement should be considered applicable. We see that here:

@Override
protected boolean isApplicable(IRequirement req) {
//Every filter in this method needs to continue except when the filter does not pass
if (!includeOptionalDependencies)
if (req.getMin() == 0)
return false;
if (considerOnlyStrictDependency) {
if (!RequiredCapability.isStrictVersionRequirement(req.getMatches()))
return false;
}
//deal with filters
if (considerFilter) {
if (onlyFilteredRequirements && req.getFilter() == null) {
return false;
}
return super.isApplicable(req);
}
if (req.getFilter() == null) {
if (onlyFilteredRequirements)
return false;
return true;
}
return evalFilterTo;
}

We also see that filters are used for this purpose (applicability) as well:

image

That makes me think can't we reuse that approach? Included plugins and features can already specify a filter (indirectly via the os, ws, arch, nl properties) so marking those is not so suitable, but imported plugins and features cannot specify a filter in the feature.xml. So one could the the approach of creating a filter while publishing the feature.xml's imported plugins and features to p2 metadata. E.g.,

    <required namespace='org.eclipse.equinox.p2.iu' name='org.example.foobar.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.feature.import.exclude!=true)
      </filter>
    </required>

So the guard implementation in Tycho's slicer would be to check if it's a strict version range (if not it's excluded) and if so, check the filter whether it's explicitly marked/filtered to be excluded from slicing (catching the case of a perfect match import). For regular/normal p2 usage, the property would be false and the requirement would be respected as normal/before, even by older runtimes. Not only that, older runtimes could even read the filter and mirror it properly so there would be no compatibility problems.

@laeubi
Copy link
Member Author

laeubi commented Aug 30, 2022

I think it is important to note that this need for additional metadata is purely something needed by and used by Tycho. Even there, it's an implementation detail of how Tycho implements the interpretation of a category.xml

I think this is quite a bit to simple assumption:

  1. Tycho actually uses MirrorApplication and every user of that is currently restricted by this limitation.
  2. As said above, only because "we" or "most users" or "platform" is not directly affected don't mean there is no problem
  3. Tycho actually is one of the biggest consumers (beside P2 itself and Oomph) of P2 metadata and often a driver for innovation or change in P2 so its a bit easy to say its "only a Tycho problem"

Looking more at implementation details, the current slicers and projector already use the concept of a 'strict version requirement' to determine if a requirement should be considered applicable.

And Tycho do that as well as it reuses P2 implementation... but as explained, "most users" don't want "strict" requirements it is always argued that required should not be included, so as mentioned even saying 'direct' requirements is more than misleading ...

That makes me think can't we reuse that approach? Included plugins and features can already specify a filter (indirectly via the os, ws, arch, nl properties) so marking those is not so suitable, but imported plugins and features cannot specify a filter in the feature.xml. So one could the the approach of creating a filter while publishing the feature.xml's imported plugins and features to p2 metadata. E.g.,

In the end, it doesn't matter much how exactly we do this, and if filters are a way to work that out I think this would be perfectly valid here of course!

So the guard implementation in Tycho's slicer would be to check if it's a strict version range (if not it's excluded) and if so, check the filter whether it's explicitly marked/filtered to be excluded from slicing (catching the case of a perfect match import).

Won't this work for any requirement (regardless of its strict or not?)

Not only that, older runtimes could even read the filter and mirror it properly so there would be no compatibility problems.

This sounds very interesting, do you think you can propose a patch for this in the FeaturesAction?

@merks
Copy link
Contributor

merks commented Aug 30, 2022

I agree that Tycho is one of the most important consumers to consider given this is how most (practically all) projects produce their results!

Yes, I will propose a patch for the FeaturesAction.

With regard to Won't this work for any requirement (regardless of its strict or not?), my concern is the case for EPP where the change broken it. Here the additional requirements are specified via a (generated) p2.inf:

    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.egit.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>

In this case the mapping is from a *.product like this:

image

The problem is that the installMode="root" "includes" do not map to any p2 metadata. But the product catalog generator in Oomph needs to know which features are included/installed by default which was solved with this additional metadata.

If we're not careful with the implementation details, this will end up included in the repository.

Let me think about how we might kill two birds with one stone because in the ideal world, EPP would not need the p2.inf generator hack to solve its problem. Note though that in this case the opposite is needed, i.e., by default the requirement should be filtered out by normal p2 whereas with a feature.xml's include, by default the requirement should be filtered in.

@laeubi
Copy link
Member Author

laeubi commented Aug 30, 2022

The problem is that the installMode="root" "includes" do not map to any p2 metadata.

Maybe the same approach can be used here as well to encode this? I need to check this indetail but if I rember correctly Tycho uses an extension of ProductAction or similar to exactly overcome these limitations.

@merks
Copy link
Contributor

merks commented Aug 30, 2022

Yes, I get the sense that a similar approach could be used and I'm pretty sure that @jonahgraham would be very happy to get rid of this "hack" in EPP's build...

@laeubi
Copy link
Member Author

laeubi commented Aug 30, 2022

The problem is that the installMode="root" "includes" do not map to any p2 metadata

At laest for features of a category there seems to be (org.eclipse.update.install.features=true) already, so maybe we can came up with a name that is similar and not directly contains "epp" in its name.

@merks
Copy link
Contributor

merks commented Aug 30, 2022

I thought that property was used to make the feature.group depend on the feature.jar:

<unit id='org.eclipse.oomph.all.feature.group' version='1.26.0.v20220707-2214' singleton='false'>
  <update id='org.eclipse.oomph.all.feature.group' range='[0.0.0,1.26.0.v20220707-2214)' severity='0'/>
...
  <requires size='25'>
...
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.oomph.all.feature.jar' range='[1.26.0.v20220707-2214,1.26.0.v20220707-2214]'>
      <filter>
        (org.eclipse.update.install.features=true)
      </filter>
    </required>

In any case, I think something along these lines ought to be workable...

I'm just swamped at the moment with all the details around getting the 2022-09 release out, but I will keep thinking about this and come up with something early in the next cycle.

@laeubi
Copy link
Member Author

laeubi commented Aug 30, 2022

I thought that property was used to make the feature.group depend on the feature.jar:

I could be wrong, but as fars as I know this is a marker if that feature should be shown to the user to be installable (in contrast to a feature that is just included somehow), e.g. if you mention it in a category.xml then it will get that flag and if I later on add that site to my eclipse I can choose this feature while other features that are included but not mentioned in the category.xml are not getting that flag and thus are invisible.

@merks
Copy link
Contributor

merks commented Sep 1, 2022

Looking at the code that processes imports, it seems an import element can include a filter attribute even if the structured editor doesn't help author that attribute, e.g., it's processed here:

https://github.com/eclipse-equinox/p2/blob/master/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java#L191-L219

Here we see the editor doesn't complain about the filter attribute being present but does complain about the unexpected bogus attribute:

image

If we are to use the filter we'd need to handle the case of there already being a filter. We could use (|(our-filter)(filter-from-import)), i.e., combine the filter with or but then testing that the filter matches wouldn't work well anymore because the other filter condition is arbitrary and we don't know what it will match. We could look for our expected "subfilter" in the overall filter string presentation but that starts to feel a bit more like a hack again.... And then one wonders if using (looking in) the description (a different hack) is worse or better?

Note that org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry.isRequires() does record the information we want...

@laeubi
Copy link
Member Author

laeubi commented Sep 1, 2022

Looking at the code here:

for (FeatureEntry entry : entries) {
VersionRange range = getVersionRange(entry);
String requiredId = getTransformedId(entry.getId(), entry.isPlugin(), /*isGroup*/true);
required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, requiredId, range, getFilter(entry), entry.isOptional(), false));
}

and the called method:

private IMatchExpression<IInstallableUnit> getFilter(FeatureEntry entry) {
StringBuffer result = new StringBuffer();
result.append("(&"); //$NON-NLS-1$
if (entry.getFilter() != null)
result.append(entry.getFilter());
expandFilter(entry.getOS(), "osgi.os", result); //$NON-NLS-1$
expandFilter(entry.getWS(), "osgi.ws", result); //$NON-NLS-1$
expandFilter(entry.getArch(), "osgi.arch", result);//$NON-NLS-1$
expandFilter(entry.getNL(), "osgi.nl", result); //$NON-NLS-1$
if (result.length() == 2)
return null;
result.append(')');
return InstallableUnit.parseFilter(result.toString());
}

it seems that there are already some code to handle expanding a filter.

but then testing that the filter matches wouldn't work well anymore because the other filter condition is arbitrary and we don't know what it will match

Yes, that's true ... I think you can still iterate over the individual items from a filter, its just not very convenient last time I tried that but of course possible. Beside that, even if it is allowed, I never seen anyone using a filter here, so maybe it was just implemented for symmetric reasons and actually never used?

Note that org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry.isRequires() does record the information we want...

Yes that's the last place where this data is recorded.

@laeubi
Copy link
Member Author

laeubi commented Dec 3, 2022

@merks any updates on this?

@merks
Copy link
Contributor

merks commented Dec 4, 2022

No.

@merks
Copy link
Contributor

merks commented Jan 12, 2023

I'm not sure when I can ever find time for this. 😞 Moreover, I'm a bit doubtful of the actual value of implementing this; given limited resource one has to question where to invest resource such that it has the most benefit to the most people. I noticed in particular the other week that the documentation here:

https://tycho.eclipseprojects.io/doc/latest/tycho-p2/tycho-p2-repository-plugin/assemble-repository-mojo.html

explicitly states the following:

Dependencies with a strict version range, i.e. a range which only matches exactly one version of an artifact, are also considered as inclusions.

Changing the above described/documented Tycho behavior specifically for a feature to cover the one (in my opinion) dark corner case where an import specifies an exact version range and the assembled update site is desired not to have the bundle included seems (to me) like a needle-in-a-haystack case. I assume no consumer has ever reported this as a problem...

In any case, I don't want to start a long back and forth discussion. The above comments are merely my opinions and the opinions of others may reasonably differ from mine. I'm just setting expectations about my outlook and my priorities.

@laeubi
Copy link
Member Author

laeubi commented Jan 12, 2023

The documentation just describes the current limitation of P2 because user has complained, it does not describe a feature we specifically implemented. So what "most users" see simply differs on how you define this group of users.

So the problem is not that one extra bundle gets in, but that features are suddenly transitively pulled in and that's more than just a bundle, because currently Tycho can only include all requirements (transitively) or only those with strict version ranges, but for those people that don't want to manually bump their feature just to get a changed dependency included, one need a way to include also version-ranged dependencies (that are actually also "direct" but not transitively.

In any case it is not strictly required that this is implemented by you, it was just raised concerns about changing anything and then you brought up an alternative. But if you describe in what way you would be fine with a change, anyone else can implement it as well if it seems to suffice.

@laeubi
Copy link
Member Author

laeubi commented Jan 24, 2023

Closing this as not being relevant anymore (for me) as it seems more profitable to get rid of outdated P2 technology in Tycho and moving on to more modern and flexible approaches:

@laeubi laeubi closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2023
@merks
Copy link
Contributor

merks commented Jan 9, 2024

This issue is closely related to #424 and I think the same type of solution can be applied here relatively easily.

@merks merks reopened this Jan 9, 2024
@merks
Copy link
Contributor

merks commented Jan 9, 2024

I think this issue can be addressed in org.eclipse.equinox.internal.p2.publisher.eclipse.FeatureManifestParser.processImport like this:

image

I.e., add a filter (!(org.eclipse.equinox.p2.exclude.import=true)) that is true by default, but Tycho can set the context IU property org.eclipse.equinox.p2.exclude.import=true such that any import requirements are invisible/filtered-out.

@laeubi
Copy link
Member Author

laeubi commented Jan 9, 2024

   <requires>
      <import plugin="assertj-core"/>
      <import feature="org.eclipse.core.tests.filesystem.feature" version="4.6.0.qualifier"/>
   </requires>

that must be able to filter out (even though it named "requires" is is more a perquisite.... I have no idea why< it is named import...

@merks
Copy link
Contributor

merks commented Jan 9, 2024

Yes, the above method is used to process imports (feature/plugin). So it's applicable exactly to the things you show above.

merks added a commit to merks/p2 that referenced this issue Jan 12, 2024
Provide new FeatureEntry.createRequires methods that specify isImport,
deprecating the older ones, and provide a field as well as accessors for
isImport. Use that attribute in FeaturesAction.getFilter(FeatureEntry)
to add a filter (!(org.eclipse.equinox.p2.exclude.import=true)) to the
synthesized requirement.

Update StringBuffer to StringBuilder in the otherwise-modified files.

eclipse-equinox#138
merks added a commit that referenced this issue Jan 13, 2024
Provide new FeatureEntry.createRequires methods that specify isImport,
deprecating the older ones, and provide a field as well as accessors for
isImport. Use that attribute in FeaturesAction.getFilter(FeatureEntry)
to add a filter (!(org.eclipse.equinox.p2.exclude.import=true)) to the
synthesized requirement.

Update StringBuffer to StringBuilder in the otherwise-modified files.

#138
@merks
Copy link
Contributor

merks commented Jan 13, 2024

The addition of a filter will allow a resolver to exclude the import requirements at its discretion.

@merks merks closed this as completed Jan 13, 2024
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

No branches or pull requests

3 participants