Gentoo Archives: gentoo-portage-dev

From: Brian <dol-sen@×××××.net>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Portage API
Date: Tue, 19 Oct 2004 01:08:18
Message-Id: 1098148132.27883.87.camel@localhost
In Reply to: Re: [gentoo-portage-dev] Portage API by Jason Stubbs
1 Here is the portion of Fredriks reply on the porthole-dev list for those
2 that are not on that list.
3
4 Hi,
5
6 Yes, I confess. I wrote most of portagelib.py. I am a little rusty
7 though, since I haven't been involved in porthole development for quite
8 som time.
9
10 mån 2004-10-18 klockan 22.14 skrev Brian:
11 > On Mon, 2004-10-18 at 22:53 +0900, Jason Stubbs wrote:
12 > > The current USE settings. I'm don't see why PORTDIR or
13 PORTDIR_OVERLAY is
14 > > needed.
15 >
16 > Porthole searches the directories for ebuilds, etc.. Better to use
17 the
18 > correct directories, so get the correct directories. I believe Dan
19 was
20 > using portage rather than creating new code to scan
21 thru /etc/make.conf
22 > as well as the globals & defaults.
23
24 Yep, except it was I who did it :-)
25
26 > > > portage.auxdbkeys
27 > >
28 > > I'm not sure what's required here either.
29
30 auxdbkeys is/should be a list of all properties an ebuild can have. It
31 was used to get all properties at once. The point of this was, if I
32 recall correctly, to convert the properties into fields in a python
33 object. Not necessary, but high in hack value, I think :-)
34
35 > > > # showing complete porthole function for (possibly) more clarity
36 > > > def get_properties(ebuild):
37 > > > """Get all ebuild variables in one chunk."""
38 > > > return Properties(dict(zip(keys,
39 > > > portage.portdb.aux_get(ebuild,
40 > > >
41 portage.auxdbkeys))))
42 > > >
43 > > >
44
45 See previous point.
46
47 >
48 > To use portage's vercmp() I would have to write a python bubble sort
49 to
50 > sort a list of ebuild versions. What I did was use Marius's code and
51 > modified it to pad the version string parts to 3 digits then used
52 > python's builtin list.sort().
53 >
54
55 Ah, but list.sort() takes an option argument, which is a comparison
56 function. I haven't looked at it, but I would guess vercmp() is designed
57 to work with list.sort(). No need to write that bubble sort.
58
59 --
60 Fredrik Arnerup <e97_far@×××××.se>
61 http://www.stacken.kth.se/~foo/
62
63 --
64 Brian <dol-sen@×××××.net>
65
66
67 --
68 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-portage-dev] Portage API Jason Stubbs <jstubbs@g.o>