FS#63074 - [pacman] Add regular expressions support for NoExtract= directive to shorten/group patterns

Attached to Project: Pacman
Opened by marcin82 (marcin82) - Tuesday, 02 July 2019, 18:48 GMT
Last edited by Dave Reisner (falconindy) - Tuesday, 02 July 2019, 18:50 GMT
Task Type Feature Request
Category Packages: Core
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

It's rather question than feature request. Maybe I'm missing something, but is there any method/syntax to group/shorten one expression to another, as follows - to mark alternatives with curly brackets or pipe | :
`NoExtract = usr/share/doc/* usr/share/gtk-doc/* usr/share/help/* usr/share/info/* usr/share/licenses/*`
`NoExtract = usr/share/{doc,gtk-doc,help,info,licenses}/*`
or
`NoExtract = */locale/*`
`NoExtract = */locales/*`
to:
`NoExtract = */locale(|s)/*`

This task depends upon

Comment by Eli Schwartz (eschwartz) - Tuesday, 02 July 2019, 18:54 GMT
pacman.conf documents that shell-style glob patterns can be used, which means that * to match zero or more characters and ? to match one character will work. regex(3) support is not currently implemented, however.

Does the shell-style glob pattern support do what you need it to do? Most of the examples you've listed are for that.
Comment by marcin82 (marcin82) - Tuesday, 02 July 2019, 19:29 GMT
@Eli Schwartz (eschwartz)

The problem is exactly that these and similar expressions, like examples, just don't work (instead of asterisk of course). Grouping don't work.

To compare - bash globbing:
https://linuxhint.com/bash_globbing_tutorial/
http://tldp.org/LDP/abs/html/globbingref.html
http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm
Comment by Eli Schwartz (eschwartz) - Tuesday, 02 July 2019, 19:43 GMT
The allowable globs are in man 7 glob. They are:

* ? [

That means you can use e.g. [abc] or [[:alpha:]] as well, which you did not mention in your original question but which are mentioned in your links.

Use of {} is not globbing and the tutorials you've been looking at are unreliable and in this case wrong. They describe the effects of {} which in bash is known as brace expansion, and they group it under "globbing". However, in bash, brace expansion is the first form of expansion which is performed -- globbing is part of pathname expansion, which is the seventh and last form of expansion.
Comment by marcin82 (marcin82) - Tuesday, 02 July 2019, 19:56 GMT
Ok. I understand. I've overdone ;] So the only way would be to implement regex, but is it possible...

Loading...