[1/5] skip_recipe: remove old class and rename VarFlag to SKIP_RECIPE

Message ID 20220204170144.105536-2-saul.wold@windriver.com
State New
Headers show
Series Use more descriptive variable for skipping recipes | expand

Commit Message

Saul Wold Feb. 4, 2022, 5:01 p.m. UTC
This change better describes what the VarFlag is doing since it
is implemeted with the SkipRecipe() function.

By moving this into base.bbclass we simplify the distro inherit.

Signed-off-by: Saul Wold <saul.wold@windriver.com>
---
 meta/classes/base.bbclass          | 10 ++++++++++
 meta/classes/blacklist.bbclass     | 20 --------------------
 meta/conf/distro/defaultsetup.conf |  3 +--
 3 files changed, 11 insertions(+), 22 deletions(-)
 delete mode 100644 meta/classes/blacklist.bbclass

Comments

Peter Kjellerstedt Feb. 8, 2022, 4:02 p.m. UTC | #1
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Saul Wold
> Sent: den 4 februari 2022 18:02
> To: openembedded-core@lists.openembedded.org
> Cc: Saul Wold <saul.wold@windriver.com>
> Subject: [OE-core] [PATCH 1/5] skip_recipe: remove old class and rename VarFlag to SKIP_RECIPE
> 
> This change better describes what the VarFlag is doing since it
> is implemeted with the SkipRecipe() function.

Change "implemeted" to " implemented".

> 
> By moving this into base.bbclass we simplify the distro inherit.
> 
> Signed-off-by: Saul Wold <saul.wold@windriver.com>
> ---
>  meta/classes/base.bbclass          | 10 ++++++++++
>  meta/classes/blacklist.bbclass     | 20 --------------------
>  meta/conf/distro/defaultsetup.conf |  3 +--
>  3 files changed, 11 insertions(+), 22 deletions(-)
>  delete mode 100644 meta/classes/blacklist.bbclass
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 5f4956a1d31..854d14d8a51 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -438,6 +438,16 @@ python () {
>      if os.path.normpath(d.getVar("WORKDIR")) !=
> os.path.normpath(d.getVar("B")):
>          d.appendVar("PSEUDO_IGNORE_PATHS", ",${B}")
> 
> +    # To add a recipe to the skip list , set:
> +    #   SKIP_RECIPE[pn] = "message"
> +    pn = d.getVar('PN')
> +    if d.getVarFlag('PNBLACKLIST', pn) is not None:
> +        bb.error("PNBLACKLIST is deprecated, please convert to SKIP_RECIPE[%s]" % (pn))
> +    skip_msg = d.getVarFlag('SKIP_RECIPE', pn)

Is there any reason this is a varflag rather than an override? I.e., why 
is it SKIP_RECIPE[foo] rather than SKIP_RECIPE:foo or SKIP_RECIPE:pn-foo)?

> +    if skip_msg:
> +        bb.debug(1, "Skipping %s %s" % (pn, skip_msg))
> +        raise bb.parse.SkipRecipe("Recipe will be skipped because: %s" % (skip_msg))
> +
>      # Handle PACKAGECONFIG
>      #
>      # These take the form:
> diff --git a/meta/classes/blacklist.bbclass b/meta/classes/blacklist.bbclass
> deleted file mode 100644
> index dc794228ffe..00000000000
> --- a/meta/classes/blacklist.bbclass
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -# anonymous support class from originally from angstrom
> -#
> -# To use the blacklist, a distribution should include this
> -# class in the INHERIT_DISTRO
> -#
> -# No longer use ANGSTROM_BLACKLIST, instead use a table of
> -# recipes in PNBLACKLIST
> -#
> -# Features:
> -#
> -# * To add a package to the blacklist, set:
> -#   PNBLACKLIST[pn] = "message"
> -#
> -
> -python () {
> -    blacklist = d.getVarFlag('PNBLACKLIST', d.getVar('PN'))
> -
> -    if blacklist:
> -        raise bb.parse.SkipRecipe("Recipe is blacklisted: %s" % (blacklist))
> -}
> diff --git a/meta/conf/distro/defaultsetup.conf b/meta/conf/distro/defaultsetup.conf
> index b36a4ffffe5..f6894f3ab56 100644
> --- a/meta/conf/distro/defaultsetup.conf
> +++ b/meta/conf/distro/defaultsetup.conf
> @@ -14,9 +14,8 @@ TMPDIR .= "${TCLIBCAPPEND}"
> 
>  USER_CLASSES ?= ""
>  PACKAGE_CLASSES ?= "package_ipk"
> -INHERIT_BLACKLIST = "blacklist"
>  INHERIT_DISTRO ?= "debian devshell sstate license remove-libtool"
> -INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO} ${INHERIT_BLACKLIST}"
> +INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO}"
> 
>  INIT_MANAGER ??= "none"
>  require conf/distro/include/init-manager-${INIT_MANAGER}.inc
> --
> 2.31.1

//Peter

Patch

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 5f4956a1d31..854d14d8a51 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -438,6 +438,16 @@  python () {
     if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")):
         d.appendVar("PSEUDO_IGNORE_PATHS", ",${B}")
 
+    # To add a recipe to the skip list , set:
+    #   SKIP_RECIPE[pn] = "message"
+    pn = d.getVar('PN')
+    if d.getVarFlag('PNBLACKLIST', pn) is not None:
+        bb.error("PNBLACKLIST is deprecated, please convert to SKIP_RECIPE[%s]" % (pn))
+    skip_msg = d.getVarFlag('SKIP_RECIPE', pn)
+    if skip_msg:
+        bb.debug(1, "Skipping %s %s" % (pn, skip_msg))
+        raise bb.parse.SkipRecipe("Recipe will be skipped because: %s" % (skip_msg))
+
     # Handle PACKAGECONFIG
     #
     # These take the form:
diff --git a/meta/classes/blacklist.bbclass b/meta/classes/blacklist.bbclass
deleted file mode 100644
index dc794228ffe..00000000000
--- a/meta/classes/blacklist.bbclass
+++ /dev/null
@@ -1,20 +0,0 @@ 
-# anonymous support class from originally from angstrom
-# 
-# To use the blacklist, a distribution should include this
-# class in the INHERIT_DISTRO
-#
-# No longer use ANGSTROM_BLACKLIST, instead use a table of
-# recipes in PNBLACKLIST
-#
-# Features:
-#
-# * To add a package to the blacklist, set:
-#   PNBLACKLIST[pn] = "message"
-#
-
-python () {
-    blacklist = d.getVarFlag('PNBLACKLIST', d.getVar('PN'))
-
-    if blacklist:
-        raise bb.parse.SkipRecipe("Recipe is blacklisted: %s" % (blacklist))
-}
diff --git a/meta/conf/distro/defaultsetup.conf b/meta/conf/distro/defaultsetup.conf
index b36a4ffffe5..f6894f3ab56 100644
--- a/meta/conf/distro/defaultsetup.conf
+++ b/meta/conf/distro/defaultsetup.conf
@@ -14,9 +14,8 @@  TMPDIR .= "${TCLIBCAPPEND}"
 
 USER_CLASSES ?= ""
 PACKAGE_CLASSES ?= "package_ipk"
-INHERIT_BLACKLIST = "blacklist"
 INHERIT_DISTRO ?= "debian devshell sstate license remove-libtool"
-INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO} ${INHERIT_BLACKLIST}"
+INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO}"
 
 INIT_MANAGER ??= "none"
 require conf/distro/include/init-manager-${INIT_MANAGER}.inc