Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 555572 - package.keywords ATOM wildcards not suppots version precisely
Summary: package.keywords ATOM wildcards not suppots version precisely
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All Linux
: Normal normal with 3 votes (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on: 402197
Blocks:
  Show dependency tree
 
Reported: 2015-07-21 18:10 UTC by Maksym
Modified: 2022-10-20 02:43 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info (file_555572.txt,16.70 KB, text/plain)
2015-07-21 21:43 UTC, Maksym
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maksym 2015-07-21 18:10:00 UTC
I trying to install for example Qt5. But I want to install Qt-5.4 instead of Qt-5.5.

So I edit the package.keywords
=dev-qt/*-*5.4* ~amd64
But it didn't work.
Works only
=dev-qt/*-*4* ~amd64

Please make that version can be specified precisely.
Comment 1 Rafał Mużyło 2015-07-21 20:44:24 UTC
Please make sane entries in your configuration files ?

But lets see what will the maintainers say...
Comment 2 Zac Medico gentoo-dev 2015-07-21 21:18:58 UTC
(In reply to Maksym from comment #0)
> I trying to install for example Qt5. But I want to install Qt-5.4 instead of
> Qt-5.5.
> 
> So I edit the package.keywords
> =dev-qt/*-*5.4* ~amd64

It would work if you removed the wildcard before the 5.

Of course, we could add support for the syntax that you have used, though it wouldn't match exactly what I think you intended to match.

> But it didn't work.
> Works only
> =dev-qt/*-*4* ~amd64

This works because of the extension added for bug 402197.
Comment 3 Maksym 2015-07-21 21:43:52 UTC
Created attachment 407362 [details]
emerge-info
Comment 4 Maksym 2015-07-21 21:45:31 UTC
(In reply to Zac Medico from comment #2)
> (In reply to Maksym from comment #0)
> > I trying to install for example Qt5. But I want to install Qt-5.4 instead of
> > Qt-5.5.
> > 
> > So I edit the package.keywords
> > =dev-qt/*-*5.4* ~amd64
> 
> It would work if you removed the wildcard before the 5.

Still didn't work. I removed wildcard before 5 and got: 
--- Invalid atom in /etc/portage/package.keywords: =dev-qt/*-5.4*
Comment 5 Zac Medico gentoo-dev 2015-07-21 23:18:18 UTC
(In reply to Maksym from comment #4)
> Still didn't work. I removed wildcard before 5 and got: 
> --- Invalid atom in /etc/portage/package.keywords: =dev-qt/*-5.4*

That's right, now I remember that operators are not currently supported with wildcard atoms, except for the specific case which is supported since bug 402197 (where the version part contains 2 wildcards with digits in between).
Comment 6 Martin 2022-05-23 21:02:34 UTC
Just now stumbled across this old bug when trying to select a range of atom versions...


Can this be fixed to work with for example:

=abc/xyz-*.*.2

and

=abc/xyz-*.*.2*


Thanks,
Martin
Comment 7 Fabian Groffen gentoo-dev 2022-05-24 07:39:51 UTC
https://projects.gentoo.org/pms/6/pms.html#x1-860008.2.6.1

Quote from that chapter on operators, and in particular the '=':

 =
    Exactly equal to the specified version. Special exception: if the version specified has an asterisk immediately following it, then only the given number of version components is used for comparison, i. e. the asterisk acts as a wildcard for any further components. When an asterisk is used, the specification must remain valid if the asterisk were removed. (An asterisk used with any other operator is illegal.)

So, the '*' is only valid for '='-based atoms, and it doesn't quite act as a glob or something.  It basically means "ignore the remainder when comparing this atom".

While I wonder if what you want is useful (perhaps you can use SLOT/SUBSLOT or something?) if you really want this to work, a change to PMS is necessary to allow and properly define the (new) behaviour.
Comment 8 Martin 2022-05-24 15:17:45 UTC
(In reply to Fabian Groffen from comment #7)
> https://projects.gentoo.org/pms/6/pms.html#x1-860008.2.6.1
> 
> Quote from that chapter on operators, and in particular the '=':
> 
>  =
>     Exactly equal to the specified version. Special exception: if the
> version specified has an asterisk immediately following it, then only the
> given number of version components is used for comparison, i. e. the
> asterisk acts as a wildcard for any further components...

> So, the '*' is only valid for '='-based atoms, and it doesn't quite act as a
> glob or something.  It basically means "ignore the remainder when comparing
> this atom".
> 
> While I wonder if what you want is useful...

My use cases are:

1:

Only install sys-kernel/gentoo-sources for kernel versions >= release v10.

For that, I would naively expect the 'globbing' description to be ">=sys-kernel/gentoo-sources-*.*.10"

(or alternatively: "sys-kernel/gentoo-sources-*.*.??*")


emerge gives a warning for that example:

--- Invalid atom in /etc/portage/package.accept_keywords: >=sys-kernel/gentoo-sources-*.*.10


2:

Install the latest versions of media-libs/mesa and any "-r?" versions but not any "rc?" (or "rc??") versions...



Thanks kindly for your explanation.

(However, is there not a strange exception for "*9999*"?...)


That explanation suggests the emerge versions comparison is truncated at the first "*" character...

However...

The examples given in the "GLOSSARY" section of https://dev.gentoo.org/~zmedico/portage/doc/man/portage.5.html strongly suggests that the "*" is used in the same way as 'globbing' in bash.

(There is also the inconsistency for "emerge --search" that offers a regex search but not the "*" globbing search.)




This is an old 'feature' that has good scope to unexpectedly break old configs if changed...

Hence:

Keep the existing behaviour for the use of a single "*" in the version field, and implement bash-like globbing with "*" and "?" only for accept/mask entries that do not use any comparison operators?

eg: "sys-kernel/gentoo-sources-*.*.??*"


Regards,
Martin
Comment 9 Fabian Groffen gentoo-dev 2022-05-24 18:36:52 UTC
> Only install sys-kernel/gentoo-sources for kernel versions >= release v10.
>
> For that, I would naively expect the 'globbing' description to be ">=sys-kernel/gentoo-sources-*.*.10"

*.*.10 matches 0.0.10, right?
so 1.0.0 > 0.0.10

Now if there's a usecase for this corner case, I don't know.  It does demonstrate why only = is supported here.

I believe it's clear you want a selection of versions here that can only be expressed by creating multiple masks.

> Install the latest versions of media-libs/mesa and any "-r?" versions but not
any "rc?" (or "rc??") versions...

Again, I believe the only thing you can currently do is add masks, but they will all be version based.

So, it appears you have a good point that perhaps for expressing masks, a more powerful matching scheme could be allowed.  I've got no idea though how to get there.  I guess this would be up to portage and/or pms teams.