1 |
On Sun, 2004-10-17 at 20:01 +0900, Jason Stubbs wrote: |
2 |
|
3 |
> So, let the suggestions roll. :) |
4 |
> |
5 |
> Regards, |
6 |
> Jason Stubbs |
7 |
|
8 |
Dan has been the porthole developer that has done the most integrating |
9 |
portage modules for porthole's use, but it looks like we are loosing him |
10 |
from gentoo for now. I have not had much reason to think about how much |
11 |
more we might need from portage. |
12 |
|
13 |
|
14 |
|
15 |
Portage modules/variables currently used directly by Porthole: |
16 |
|
17 |
portage.grabfile():: used for obtaining [keywords.desc, use.desc, use.local.desc] |
18 |
|
19 |
portage.config(clone=portage.settings).environ()[var] :: where var = 1 of ['PORTDIR_OVERLAY','PORTDIR', "USE"] |
20 |
|
21 |
portage.auxdbkeys |
22 |
|
23 |
"""Extract installed versions from full name.""" |
24 |
return portage.db['/']['vartree'].dep_match(full_name) |
25 |
|
26 |
portage.db['/']['porttree'].getallnodes() |
27 |
|
28 |
portage.db['/']['vartree'].getallnodes() |
29 |
|
30 |
portage.catpkgsplit(ebuild) |
31 |
|
32 |
portage.portdb.aux_get(ebuild, [property])[0] |
33 |
|
34 |
portage.best(versions) |
35 |
|
36 |
# showing complete porthole function for (possibly) more clarity |
37 |
def get_properties(ebuild): |
38 |
"""Get all ebuild variables in one chunk.""" |
39 |
return Properties(dict(zip(keys, |
40 |
portage.portdb.aux_get(ebuild, |
41 |
portage.auxdbkeys)))) |
42 |
|
43 |
|
44 |
def get_versions(self, include_masked = True): |
45 |
"""Returns all versions of the available ebuild""" |
46 |
# Note: this slow, especially when include_masked is false |
47 |
criterion = include_masked and 'match-all' or 'match-visible' |
48 |
return portage.portdb.xmatch(criterion, self.full_name) |
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
Wish list: |
55 |
|
56 |
Portages version comparison/handling code from bug: http://bugs.gentoo.org/show_bug.cgi?id=37406 |
57 |
was would be implemented soon. I see browsing thru 2.0.51_rc9 that it is not yet implemented. |
58 |
If it is being implemented Porthole should use the following from portage's code: |
59 |
|
60 |
ver_regexp = re.compile("^(cvs-)?(\\d+)((\\.\\d+)*)([a-zA-Z]?)((_(pre|p|beta|alpha|rc)\\d*)*)(-r(\\d+))?$") |
61 |
suffix_regexp = re.compile("^(alpha|beta|rc|pre|p)(\\d*)$") |
62 |
# modified portage comparison suffix values for sorting in desired precedence |
63 |
suffix_value = {"alpha": '0', "beta": '1', "pre": '2', "rc": '3', "p": '4'} |
64 |
|
65 |
That would allow porthole's modified version of that code to follow any changes in portage's values. |
66 |
|
67 |
-- |
68 |
Brian <dol-sen@×××××.net> |
69 |
|
70 |
|
71 |
-- |
72 |
gentoo-portage-dev@g.o mailing list |