-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Amit Dor-Shifer schrieb:
> Thanks :)
> 
> Reason I thought this is relevant is: I'm basically looking for an API
> to get an installed package's version/rev. I prefer that over making
> syntactical assumptions on the way portage names packages.
> 
> Taking RPM for example, there's such an API: something like rpm -q
> --queryformat '%{VERSION}|' PKG_NAME if I remember correctly.|
> 
> Amit

You could also use eix ... though I needed quite a time to figure it out ;)

# PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages
- --format "<installedversionsshort>"
1.9.6-r2 1.10.1-r1

Note however, that if you a package has multiple installed versions,
they are seperated by space. One could use


# PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages
- --format "<installedversionsshort:\n>"

But this prints an additional empty line at the beginning.

> Andrew Gaffney wrote:
>> Amit Dor-Shifer wrote:
>>> Given the following:
>>> # qlist -Iv sys-apps/portage
>>> sys-apps/portage-2.1.4.5
>>>
>>> How do I safely extract the "2.1.4.5"?
>>
>> That's probably offtopic for this list, since it really has nothing to
>> do with portage itself. However, you probably want something like:
>>
>> qlist -Iv sys-apps/portage | sed -e 's:^.*-\([0-9][^-_]*\).*$:\1:'
>>
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkksL/sACgkQ4UOg/zhYFuCgIwCdFUhQxUOMuTSqBVgSeb6SgdNd
PLYAniyZJKrxqtt1LBPFq9Nr56wvGSz8
=y6nB
-----END PGP SIGNATURE-----

Reply via email to