On Fri, 18 Nov 2005 19:13:13 +0100
jb benoit <[EMAIL PROTECTED]> wrote:

> $ diff -Naur portage.py.sav portage.py
> --- portage.py.sav      2005-11-17 15:32:20.000000000 +0100
> +++ portage.py  2005-11-17 15:15:24.000000000 +0100
> @@ -3866,6 +3866,42 @@
>                                 pmaskfile.close()
>         return None
> 
> +def getprintablemaskingstatus(mycpv):
> +
> +       #checking
> +       global portdb
> +       mysplit = catpkgsplit(mycpv)
> +       if not mysplit:
> +               raise ValueError("invalid CPV: %s" % mycpv)
> +       if not portdb.cpv_exists(mycpv):
> +               raise KeyError("CPV %s does not exist" % mycpv)
> +       mycp=mysplit[0]+"/"+mysplit[1]
> +
> +       #gathering data
> +       mygroups = portdb.aux_get(mycpv, ["KEYWORDS"])[0].split()
> +       myarch = settings["ARCH"]
> +       maskdict=settings.pmaskdict
> +
> +       rValue=[]
> +       test=0
> +
> +       # keyword chercking
> +       for gp in mygroups:
> +               if gp=="~"+myarch:
> +                       kmask="~"+myarch
> +                       rValue.append(kmask)
> +                       test = 1
> +
> +       # package.mask checking
> +        if test == 1:
> +               if maskdict.has_key(mycp):
> +                       for x in maskdict[mycp]:
> +                               if mycpv in
> portdb.xmatch("match-all", x):
> +                                       rValue.append("~M")
> +
> +       return rValue
> +
> +
>  def getmaskingstatus(mycpv):
>         global portdb
>         mysplit = catpkgsplit(mycpv)

- Doesn't work with binpkgs (though that's probably also a problem in
getmaskingstatus() itself)
- there is more than keyword and p.mask for masking (profiles)
- the function name is misleading (you're not checking the actual
masking status)
- you don't check for non-~arch and package.mask'ed packages
- you don't check for non-$ARCH ACCEPT_KEYWORDS/package.keywords entries
- other semantic issues I' not going to repeat
- completely useless without docs.

We didn't say "it's complicated" for no reason ;)

Marius

PS: But thanks anyway, looking at getmaskingstatus() reminds me of
removing the stupid -* message.

-- 
Public Key at http://www.genone.de/info/gpg-key.pub

In the beginning, there was nothing. And God said, 'Let there be
Light.' And there was still nothing, but you could see a bit better.

Attachment: signature.asc
Description: PGP signature

Reply via email to