[arch-general] pacman version string regex?

clemens fischer ino-news at spotteswoode.dnsalias.org
Fri Jul 3 15:37:44 EDT 2009


Xavier wrote:

> On Fri, Jul 3, 2009 at 6:58 PM, clemens fischer wrote:
>
>> is there a regular expression describing the version comparison
>> algorithm in pacman/lib/libalpm/package.c::alpm_pkg_vercmp()?
>
> Could you give an example of what you are trying to do?

simple example, looking for the details of "ratpoison" (window-manager):

$ pacman -Qs rat|wc
     44     251    1977

(44 lines of mostly irrelevant output)

$ pac sL rat
pac: local/ratpoison

which is the one line i need when part of the package name is known.
There are other options to search descriptions.  I am currently using
the following pattern to exclude version suffixes:

    local vers_glob="-?([nN][gG][_-])+([[:digit:]])+([[:alnum:][:punct:]])"

It is used lateron like this:

    eval tmp=\"\${tmp%%\${vers_glob}}\"

I got bitten by the "-NG_*" suffix just today, and every once in a while
I notice some package isn't found or properly listed.  If there is
a regex or a bash-snippet, I could massage it into proper bash extended
globbing syntax.

The bash script is too big to post it, but you'll find it here[1].

[1] http://freenet-homepage.de/inode/pac.sh


clemens



More information about the arch-general mailing list