Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] How to extract the version/revision of an installed package?
Date: Wed, 26 Nov 2008 04:54:14
Message-Id: 492CD685.2020905@gentoo.org
In Reply to: Re: [gentoo-portage-dev] How to extract the version/revision of an installed package? by Ned Ludd
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 Ned Ludd wrote:
5 > On Tue, 2008-11-25 at 14:03 -0800, Brian Harring wrote:
6 >> On Tue, Nov 25, 2008 at 06:05:21PM +0200, Amit Dor-Shifer wrote:
7 >>> Given the following:
8 >>> # qlist -Iv sys-apps/portage
9 >>> sys-apps/portage-2.1.4.5
10 >>>
11 >>> How do I safely extract the "2.1.4.5"?
12 >>>
13 >>> (I don't necessarily need to use qlist. Just want to get the version of an
14 >>> installed package within a bash script)
15 >> This *really* should be folded into portageq offhand- it's the initial
16 >> step towards shifting versionator logic (yet another standalone
17 >> parser/comparison implementation) into the PM.
18 >>
19 >> Counter arguements?
20 >> ~brian
21 >
22 > Yes. he said a bash script. portageq still takes a few seconds to load
23 > and invokes far far to many instructions for very simple info.
24 >
25 > The 3 execve's I just posted are still faster than one portageq call.
26 > So.. foo.c wins again. :p
27
28 Well, I think portageq will be fine if it's limited to a small
29 number of calls. Here's a simple test, with portage-2.2_rc16:
30
31 # time python -c "import portage.versions"
32
33 real 0m0.141s
34 user 0m0.124s
35 sys 0m0.016s
36
37 It's not so bad if it only has to be called a few times. For cases
38 where a large number need to be split, they could be processed in a
39 batch by a single portageq call, by either passing all the inputs in
40 as arguments or writing them to stdin.
41 - --
42 Thanks,
43 Zac
44 -----BEGIN PGP SIGNATURE-----
45 Version: GnuPG v2.0.9 (GNU/Linux)
46
47 iEYEARECAAYFAkks1oQACgkQ/ejvha5XGaM/fgCfQwG2gD0viF5qjcN0WBewlCxi
48 08sAoKBZYQy3Ttkb4KhFIChPVsbFjpQR
49 =fc1x
50 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-portage-dev] How to extract the version/revision of an installed package? Brian Harring <ferringb@×××××.com>