Patchwork [2/2] blacklist.bbclass: Rename to OE_BLACKLIST and minor cleanup

login
register
mail settings
Submitter Mark Hatle
Date May 9, 2012, 4:08 p.m.
Message ID <230ca87131ff1d90b63c277422b4c2386b638654.1336579481.git.mark.hatle@windriver.com>
Download mbox | patch
Permalink /patch/27379/
State New
Headers show

Comments

Mark Hatle - May 9, 2012, 4:08 p.m.
Revise the handling from ANGSTROM_BLACKLIST to OE_BLACKLIST.  Preserved
references to ANGSTROM_BLACKLIST for compatibility with existing users.

Rearrange a bit of the code to avoid unncessary steps if the package does
not have a blacklist.

Change the message generation from a note to debug, adjust the SkipPackage
message from:

<distro> DOES NOT support <recipe> because <reason>

to:

Recipe <recipe> is blacklisted: <reason>

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta/classes/blacklist.bbclass |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
Richard Purdie - May 9, 2012, 7:25 p.m.
On Wed, 2012-05-09 at 11:08 -0500, Mark Hatle wrote:
> Revise the handling from ANGSTROM_BLACKLIST to OE_BLACKLIST.  Preserved
> references to ANGSTROM_BLACKLIST for compatibility with existing users.
> 
> Rearrange a bit of the code to avoid unncessary steps if the package does
> not have a blacklist.
> 
> Change the message generation from a note to debug, adjust the SkipPackage
> message from:
> 
> <distro> DOES NOT support <recipe> because <reason>
> 
> to:
> 
> Recipe <recipe> is blacklisted: <reason>
> 
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  meta/classes/blacklist.bbclass |   21 ++++++++++++---------
>  1 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/meta/classes/blacklist.bbclass b/meta/classes/blacklist.bbclass
> index 7bf4a73..4bf6629 100644
> --- a/meta/classes/blacklist.bbclass
> +++ b/meta/classes/blacklist.bbclass
> @@ -1,20 +1,23 @@
>  # anonymous support class from angstrom
>  # 
> +# To use the blacklist, a distribution should include this
> +# class in the INHERIT_DISTRO
> +#
> +# Modified to allow default to OE_BLACKLIST, with a fallback
> +# to ANGSTROM_BLACKLIST for compatibility
> +#
>  # Features:
>  #
> -# * blacklist handling, set ANGSTROM_BLACKLIST_pn-blah = "message"
> +# * blacklist handling, set OE_BLACKLIST_pn-blah = "message"
>  #
>  
>  python () {
> -    import bb
> -
> -    blacklist = bb.data.getVar("ANGSTROM_BLACKLIST", d, 1)
> -    pkgnm = bb.data.getVar("PN", d, 1)
> -    distro = bb.data.getVar("DISTRO", d, 1)
> +    blacklist = d.getVar("OE_BLACKLIST", True) or d.getVar("ANGSTROM_BLACKLIST", True)

OE is pointless as a prefix here.

How about PNBLACKLIST?

I'm also adversed to underscores, particularly on short sets of letter
due to overrides (note to self about considering changing the override
character).

>      if blacklist:
> -	bb.note("%s DOES NOT support %s because %s" % (distro,pkgnm, blacklist))
> -        raise bb.parse.SkipPackage("%s DOES NOT support %s because %s" % (distro,pkgnm, blacklist))
> -
> +        distro = d.getVar("DISTRO", True)
> +        pkgnm = d.getVar("PN", True)
> +        bb.debug(2, "%s DOES NOT support %s because %s" % (distro, pkgnm, blacklist))
> +        raise bb.parse.SkipPackage("Recipe %s is blacklisted: %s" % (pkgnm, blacklist))
>  }

Lets also drop the distro bit and just say "Configured policy does not
support %s since %s".

We should also add a proper reason in here so how about we make
PNBLACKLIST a set of flags? This breaks compatibility but improves
usability and the message is a big part why we need this class in the
first place.

So the usage would be:

PNBLACKLIST[gconf-dbus] = "dbus support was merged into gconf"

Cheers,

Richard
Mark Hatle - May 9, 2012, 7:33 p.m.
On 5/9/12 2:25 PM, Richard Purdie wrote:
> On Wed, 2012-05-09 at 11:08 -0500, Mark Hatle wrote:
>> Revise the handling from ANGSTROM_BLACKLIST to OE_BLACKLIST.  Preserved
>> references to ANGSTROM_BLACKLIST for compatibility with existing users.
>>
>> Rearrange a bit of the code to avoid unncessary steps if the package does
>> not have a blacklist.
>>
>> Change the message generation from a note to debug, adjust the SkipPackage
>> message from:
>>
>> <distro>  DOES NOT support<recipe>  because<reason>
>>
>> to:
>>
>> Recipe<recipe>  is blacklisted:<reason>
>>
>> Signed-off-by: Mark Hatle<mark.hatle@windriver.com>
>> ---
>>   meta/classes/blacklist.bbclass |   21 ++++++++++++---------
>>   1 files changed, 12 insertions(+), 9 deletions(-)
>>
>> diff --git a/meta/classes/blacklist.bbclass b/meta/classes/blacklist.bbclass
>> index 7bf4a73..4bf6629 100644
>> --- a/meta/classes/blacklist.bbclass
>> +++ b/meta/classes/blacklist.bbclass
>> @@ -1,20 +1,23 @@
>>   # anonymous support class from angstrom
>>   #
>> +# To use the blacklist, a distribution should include this
>> +# class in the INHERIT_DISTRO
>> +#
>> +# Modified to allow default to OE_BLACKLIST, with a fallback
>> +# to ANGSTROM_BLACKLIST for compatibility
>> +#
>>   # Features:
>>   #
>> -# * blacklist handling, set ANGSTROM_BLACKLIST_pn-blah = "message"
>> +# * blacklist handling, set OE_BLACKLIST_pn-blah = "message"
>>   #
>>
>>   python () {
>> -    import bb
>> -
>> -    blacklist = bb.data.getVar("ANGSTROM_BLACKLIST", d, 1)
>> -    pkgnm = bb.data.getVar("PN", d, 1)
>> -    distro = bb.data.getVar("DISTRO", d, 1)
>> +    blacklist = d.getVar("OE_BLACKLIST", True) or d.getVar("ANGSTROM_BLACKLIST", True)
>
> OE is pointless as a prefix here.
>
> How about PNBLACKLIST?

I was wondering about that, but was only thinking "BLACKLIST" and I thought that 
was way to generic.. PNBLACKLIST it is..

> I'm also adversed to underscores, particularly on short sets of letter
> due to overrides (note to self about considering changing the override
> character).
>
>>       if blacklist:
>> -	bb.note("%s DOES NOT support %s because %s" % (distro,pkgnm, blacklist))
>> -        raise bb.parse.SkipPackage("%s DOES NOT support %s because %s" % (distro,pkgnm, blacklist))
>> -
>> +        distro = d.getVar("DISTRO", True)
>> +        pkgnm = d.getVar("PN", True)
>> +        bb.debug(2, "%s DOES NOT support %s because %s" % (distro, pkgnm, blacklist))
>> +        raise bb.parse.SkipPackage("Recipe %s is blacklisted: %s" % (pkgnm, blacklist))
>>   }
>
> Lets also drop the distro bit and just say "Configured policy does not
> support %s since %s".
>
> We should also add a proper reason in here so how about we make
> PNBLACKLIST a set of flags? This breaks compatibility but improves
> usability and the message is a big part why we need this class in the
> first place.
>
> So the usage would be:
>
> PNBLACKLIST[gconf-dbus] = "dbus support was merged into gconf"

So stop using the override and switch to using the flags?  Should be easy to do.

> Cheers,
>
> Richard
>
>
>
>
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/blacklist.bbclass b/meta/classes/blacklist.bbclass
index 7bf4a73..4bf6629 100644
--- a/meta/classes/blacklist.bbclass
+++ b/meta/classes/blacklist.bbclass
@@ -1,20 +1,23 @@ 
 # anonymous support class from angstrom
 # 
+# To use the blacklist, a distribution should include this
+# class in the INHERIT_DISTRO
+#
+# Modified to allow default to OE_BLACKLIST, with a fallback
+# to ANGSTROM_BLACKLIST for compatibility
+#
 # Features:
 #
-# * blacklist handling, set ANGSTROM_BLACKLIST_pn-blah = "message"
+# * blacklist handling, set OE_BLACKLIST_pn-blah = "message"
 #
 
 python () {
-    import bb
-
-    blacklist = bb.data.getVar("ANGSTROM_BLACKLIST", d, 1)
-    pkgnm = bb.data.getVar("PN", d, 1)
-    distro = bb.data.getVar("DISTRO", d, 1)
+    blacklist = d.getVar("OE_BLACKLIST", True) or d.getVar("ANGSTROM_BLACKLIST", True)
 
     if blacklist:
-	bb.note("%s DOES NOT support %s because %s" % (distro,pkgnm, blacklist))
-        raise bb.parse.SkipPackage("%s DOES NOT support %s because %s" % (distro,pkgnm, blacklist))
-
+        distro = d.getVar("DISTRO", True)
+        pkgnm = d.getVar("PN", True)
+        bb.debug(2, "%s DOES NOT support %s because %s" % (distro, pkgnm, blacklist))
+        raise bb.parse.SkipPackage("Recipe %s is blacklisted: %s" % (pkgnm, blacklist))
 }