Gentoo Archives: gentoo-portage-dev

From: jb benoit <benoitj@×××××.fr>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Display of keyword in emerge : code proposal
Date: Tue, 22 Nov 2005 20:49:19
Message-Id: 438383EC.3000900@esiee.fr
In Reply to: Re: [gentoo-portage-dev] Display of keyword in emerge : code proposal by Marius Mauch
1 Marius Mauch wrote:
2
3 >On Fri, 18 Nov 2005 19:13:13 +0100
4 >jb benoit <benoitj@×××××.fr> wrote:
5 >
6 >
7 >
8 >>$ diff -Naur portage.py.sav portage.py
9 >>--- portage.py.sav 2005-11-17 15:32:20.000000000 +0100
10 >>+++ portage.py 2005-11-17 15:15:24.000000000 +0100
11 >>@@ -3866,6 +3866,42 @@
12 >> pmaskfile.close()
13 >> return None
14 >>
15 >>+def getprintablemaskingstatus(mycpv):
16 >>+
17 >>+ #checking
18 >>+ global portdb
19 >>+ mysplit = catpkgsplit(mycpv)
20 >>+ if not mysplit:
21 >>+ raise ValueError("invalid CPV: %s" % mycpv)
22 >>+ if not portdb.cpv_exists(mycpv):
23 >>+ raise KeyError("CPV %s does not exist" % mycpv)
24 >>+ mycp=mysplit[0]+"/"+mysplit[1]
25 >>+
26 >>+ #gathering data
27 >>+ mygroups = portdb.aux_get(mycpv, ["KEYWORDS"])[0].split()
28 >>+ myarch = settings["ARCH"]
29 >>+ maskdict=settings.pmaskdict
30 >>+
31 >>+ rValue=[]
32 >>+ test=0
33 >>+
34 >>+ # keyword chercking
35 >>+ for gp in mygroups:
36 >>+ if gp=="~"+myarch:
37 >>+ kmask="~"+myarch
38 >>+ rValue.append(kmask)
39 >>+ test = 1
40 >>+
41 >>+ # package.mask checking
42 >>+ if test == 1:
43 >>+ if maskdict.has_key(mycp):
44 >>+ for x in maskdict[mycp]:
45 >>+ if mycpv in
46 >>portdb.xmatch("match-all", x):
47 >>+ rValue.append("~M")
48 >>+
49 >>+ return rValue
50 >>+
51 >>+
52 >> def getmaskingstatus(mycpv):
53 >> global portdb
54 >> mysplit = catpkgsplit(mycpv)
55 >>
56 >>
57 >
58 >- Doesn't work with binpkgs (though that's probably also a problem in
59 >getmaskingstatus() itself)
60 >- there is more than keyword and p.mask for masking (profiles)
61 >- the function name is misleading (you're not checking the actual
62 >masking status)
63 >- you don't check for non-~arch and package.mask'ed packages
64 >- you don't check for non-$ARCH ACCEPT_KEYWORDS/package.keywords entries
65 >- other semantic issues I' not going to repeat
66 >- completely useless without docs.
67 >
68 >
69 >
70 If this can help, i'll respond to some of your question :
71 My aims is very different to the one of getmaskingstatus().
72
73 I don't have to check everywere for the status :
74 The package which status I'm searching were already checked by
75 getmaskingstatus().
76 This is very important.
77
78 The only 2 thinks I implemented was to search :
79
80 if the package beeing checked is an unstable version,
81 which can be done only by looking at the supported keywords in the ebuild.
82
83 if the package beeing checked is a masked version.
84 I only need to check is the package was masked in packages.mask,
85 don't mind the reason for which it's now unmasked.
86
87 If you thinks this can be usefull, I can made the corection needed.
88 If you think this is just a bunch of trash, just tell me to forget, but
89 i'll miss this feature.
90
91 Jb
92
93 >We didn't say "it's complicated" for no reason ;)
94 >
95 >Marius
96 >
97 >PS: But thanks anyway, looking at getmaskingstatus() reminds me of
98 >removing the stupid -* message.
99 >
100 >
101 >
102
103 --
104 gentoo-portage-dev@g.o mailing list

Replies