Gentoo Archives: gentoo-portage-dev

From: Marius Mauch <genone@g.o>
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:19:05
Message-Id: 20051122211810.604008d9@sven.genone.homeip.net
In Reply to: [gentoo-portage-dev] Display of keyword in emerge : code proposal by jb benoit
1 On Fri, 18 Nov 2005 19:13:13 +0100
2 jb benoit <benoitj@×××××.fr> wrote:
3
4 > $ diff -Naur portage.py.sav portage.py
5 > --- portage.py.sav 2005-11-17 15:32:20.000000000 +0100
6 > +++ portage.py 2005-11-17 15:15:24.000000000 +0100
7 > @@ -3866,6 +3866,42 @@
8 > pmaskfile.close()
9 > return None
10 >
11 > +def getprintablemaskingstatus(mycpv):
12 > +
13 > + #checking
14 > + global portdb
15 > + mysplit = catpkgsplit(mycpv)
16 > + if not mysplit:
17 > + raise ValueError("invalid CPV: %s" % mycpv)
18 > + if not portdb.cpv_exists(mycpv):
19 > + raise KeyError("CPV %s does not exist" % mycpv)
20 > + mycp=mysplit[0]+"/"+mysplit[1]
21 > +
22 > + #gathering data
23 > + mygroups = portdb.aux_get(mycpv, ["KEYWORDS"])[0].split()
24 > + myarch = settings["ARCH"]
25 > + maskdict=settings.pmaskdict
26 > +
27 > + rValue=[]
28 > + test=0
29 > +
30 > + # keyword chercking
31 > + for gp in mygroups:
32 > + if gp=="~"+myarch:
33 > + kmask="~"+myarch
34 > + rValue.append(kmask)
35 > + test = 1
36 > +
37 > + # package.mask checking
38 > + if test == 1:
39 > + if maskdict.has_key(mycp):
40 > + for x in maskdict[mycp]:
41 > + if mycpv in
42 > portdb.xmatch("match-all", x):
43 > + rValue.append("~M")
44 > +
45 > + return rValue
46 > +
47 > +
48 > def getmaskingstatus(mycpv):
49 > global portdb
50 > mysplit = catpkgsplit(mycpv)
51
52 - Doesn't work with binpkgs (though that's probably also a problem in
53 getmaskingstatus() itself)
54 - there is more than keyword and p.mask for masking (profiles)
55 - the function name is misleading (you're not checking the actual
56 masking status)
57 - you don't check for non-~arch and package.mask'ed packages
58 - you don't check for non-$ARCH ACCEPT_KEYWORDS/package.keywords entries
59 - other semantic issues I' not going to repeat
60 - completely useless without docs.
61
62 We didn't say "it's complicated" for no reason ;)
63
64 Marius
65
66 PS: But thanks anyway, looking at getmaskingstatus() reminds me of
67 removing the stupid -* message.
68
69 --
70 Public Key at http://www.genone.de/info/gpg-key.pub
71
72 In the beginning, there was nothing. And God said, 'Let there be
73 Light.' And there was still nothing, but you could see a bit better.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-portage-dev] Display of keyword in emerge : code proposal jb benoit <benoitj@×××××.fr>