Gentoo Archives: gentoo-portage-dev

From: Ned Ludd <solar@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 01:24:15
Message-Id: 1227662651.4901.13.camel@localhost
In Reply to: Re: [gentoo-portage-dev] How to extract the version/revision of an installed package? by Brian Harring
1 On Tue, 2008-11-25 at 16:31 -0800, Brian Harring wrote:
2 > On Tue, Nov 25, 2008 at 04:18:22PM -0800, Ned Ludd wrote:
3 > >
4 > > On Tue, 2008-11-25 at 14:03 -0800, Brian Harring wrote:
5 > > > On Tue, Nov 25, 2008 at 06:05:21PM +0200, Amit Dor-Shifer wrote:
6 > > > > Given the following:
7 > > > > # qlist -Iv sys-apps/portage
8 > > > > sys-apps/portage-2.1.4.5
9 > > > >
10 > > > > How do I safely extract the "2.1.4.5"?
11 > > > >
12 > > > > (I don't necessarily need to use qlist. Just want to get the version of an
13 > > > > installed package within a bash script)
14 > > >
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 > Curious, does qatom handle use deps? Slot deps? Plans to add
29 > repository deps (admittedly they've not landed)?
30
31 Nope. I'm sticking with EAPI=0 behaviorism's and the development of
32 those utils has pretty much stopped. Well I did slip in some :slot
33 handling a little while ago due to the syntax of the world file changing
34 a while back after being annoyed.
35
36 > The point of shifting it into portageq isn't speed based; it's to
37 > transfer responsibility for atom parsing from multiple authorities
38 > into a single one.
39
40 It's still a good idea to expend the functionality of portageq. But for
41 scripting from bash, reality wins as most everything python-portage
42 related falls a little short due to the sheer number of file i/o calls
43 python makes looking for files that might not pertain at all to the info
44 the user is after. Granted today it's a heck of a lot faster than it
45 used to be a few years ago when the loading problem was first noticed.
46
47 > Besides, just because portageq is slow for heavy data ops doesn't mean
48 > it's going to be slow for doing simple atom splitting. Quick test
49 > locally, cold cache pegs it at 3s- with minor use of snakeoil
50 > demandload that's likely halvable.
51 >
52 > ~brian
53
54
55 I'm all in favor of using the right tool for the task at hand whatever
56 that may be.