1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
Amit Dor-Shifer schrieb: |
5 |
> Thanks :) |
6 |
> |
7 |
> Reason I thought this is relevant is: I'm basically looking for an API |
8 |
> to get an installed package's version/rev. I prefer that over making |
9 |
> syntactical assumptions on the way portage names packages. |
10 |
> |
11 |
> Taking RPM for example, there's such an API: something like rpm -q |
12 |
> --queryformat '%{VERSION}|' PKG_NAME if I remember correctly.| |
13 |
> |
14 |
> Amit |
15 |
|
16 |
You could also use eix ... though I needed quite a time to figure it out ;) |
17 |
|
18 |
# PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages |
19 |
- --format "<installedversionsshort>" |
20 |
1.9.6-r2 1.10.1-r1 |
21 |
|
22 |
Note however, that if you a package has multiple installed versions, |
23 |
they are seperated by space. One could use |
24 |
|
25 |
|
26 |
# PRINT_SLOTS="false" eix -e -I sys-devel/automake --pure-packages |
27 |
- --format "<installedversionsshort:\n>" |
28 |
|
29 |
But this prints an additional empty line at the beginning. |
30 |
|
31 |
> Andrew Gaffney wrote: |
32 |
>> Amit Dor-Shifer wrote: |
33 |
>>> Given the following: |
34 |
>>> # qlist -Iv sys-apps/portage |
35 |
>>> sys-apps/portage-2.1.4.5 |
36 |
>>> |
37 |
>>> How do I safely extract the "2.1.4.5"? |
38 |
>> |
39 |
>> That's probably offtopic for this list, since it really has nothing to |
40 |
>> do with portage itself. However, you probably want something like: |
41 |
>> |
42 |
>> qlist -Iv sys-apps/portage | sed -e 's:^.*-\([0-9][^-_]*\).*$:\1:' |
43 |
>> |
44 |
> |
45 |
|
46 |
-----BEGIN PGP SIGNATURE----- |
47 |
Version: GnuPG v2.0.9 (GNU/Linux) |
48 |
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org |
49 |
|
50 |
iEYEARECAAYFAkksL/sACgkQ4UOg/zhYFuCgIwCdFUhQxUOMuTSqBVgSeb6SgdNd |
51 |
PLYAniyZJKrxqtt1LBPFq9Nr56wvGSz8 |
52 |
=y6nB |
53 |
-----END PGP SIGNATURE----- |