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

Allow negation in advanced version specifiers #397

Closed
zerothi opened this issue May 6, 2021 · 5 comments
Closed

Allow negation in advanced version specifiers #397

zerothi opened this issue May 6, 2021 · 5 comments
Milestone

Comments

@zerothi
Copy link

zerothi commented May 6, 2021

Is your feature request related to a problem? Please describe.

One can define versions using the advanced version specifiers
However, it is only positive matches.

Describe the solution you'd like

It would be great if one could do negative matches. A possible solution would be:

# match all versions except 1.1.0
@^1.1.0
# match all >=1.0.0, except 1.2.0 AND including 0.9.0
@1.0.0:,^1.2.0,0.9.0

Describe alternatives you've considered

The above is of course easily bypassed by something like:

@:1.0.9,1.1.1:
@1.0.0:1.1.9,1.2.1:,0.9.0

but that quickly gets complicated when having more than 1 excluded version.

It would be great if the version specifiers also allows ranges when negating.

Additional context

This is generally useful when certain released versions of a library has specific bugs. This could be a release that accidentally breaks API or something else.

@zerothi
Copy link
Author

zerothi commented May 6, 2021

Actually, it looks like @1.2:,:1.4 does not work? Only single version specifiers are allowed in comma separated ones according to the documentation?

@xdelaruelle
Copy link
Member

The advanced version specifier of Modules follows syntax of Spack version specifier.

So for the need you describe, I suggest to enable the use of version range within version list.

For the moment version list can only be composed of version.

With that change @:1.1.8,1.1.10,1.1.12: will mean all versions except 1.1.9 and 1.1.11.

@zerothi
Copy link
Author

zerothi commented May 7, 2021

Ok, I see that they don't have a negation. While they use ^ for dependencies, there is no use of ! which easily could act as a negation?
I have made an issue at spack to hear about their ideas here.

As far as I've understood then you agree that the version list doesn't allow version ranges within versions lists? And that you think this would be useful?

Allowing more ranges in one list would definitely be nice to have.

@xdelaruelle
Copy link
Member

Ok, I see that they don't have a negation. While they use ^ for dependencies, there is no use of ! which easily could act as a negation?
I have made an issue at spack to hear about their ideas here.

I wonder if ! does not have a special meaning on some shells (tcsh?).

As far as I've understood then you agree that the version list doesn't allow version ranges within versions lists? And that you think this would be useful?

Yes. It was not part of the advanced version specifiers feature made in 2019 but it seems really useful to add this. At first sight it seems it does not require much work to add that.

@zerothi
Copy link
Author

zerothi commented May 7, 2021

Ok, I see that they don't have a negation. While they use ^ for dependencies, there is no use of ! which easily could act as a negation?
I have made an issue at spack to hear about their ideas here.

I wonder if ! does not have a special meaning on some shells (tcsh?).
Yes, this would be a problem, one would have to escape using quotation marks. Otherwise one have to use a non-standard negation operator which would also be troublesome.

As far as I've understood then you agree that the version list doesn't allow version ranges within versions lists? And that you think this would be useful?

Yes. It was not part of the advanced version specifiers feature made in 2019 but it seems really useful to add this. At first sight it seems it does not require much work to add that.

Ok, great! That would still be most useful!

@xdelaruelle xdelaruelle added this to the 4.8 milestone May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants