[OE-core] [PATCH] deprecated.bbclass: Add a PNDEPRECATED variable for recipes

Joe MacDonald joe_macdonald at mentor.com
Fri Feb 24 04:00:00 UTC 2017


Based on the blacklist behaviour, recipes can be tagged as deprecated.
Such recipes will produce a warning message when included in a build but
unlike blacklisted recipes, the build will continue.

Signed-off-by: Joe MacDonald <joe_macdonald at mentor.com>
---

I threw this together a long time ago and never got around to sending it out for
consideration, but after the excitement last week and this, I got thinking about
it again and thought it might be useful.  My specific use-case for this is
recipes I see in meta-networking that I know are largely abandonware but that I
don't want to completely throw out without giving some kind of heads up.
Obviously this is purely informational, there's no mechanism set up for purging
deprecated recipes, that's intended to be a maintainer activity, but the idea
would be that the maintainer would flag a recipe as deprecated (probably when
it's become more trouble than it seems to be worth) and thereafter users would
have fair warning that this thing is on notice.  If nobody speaks up within some
amount of time the maintainer considers reasonable (I'm thinking a Yocto release
cycle) then it's fair game to remove the recipe in question.

 meta/classes/deprecated.bbclass    | 16 ++++++++++++++++
 meta/conf/distro/defaultsetup.conf |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 meta/classes/deprecated.bbclass

diff --git a/meta/classes/deprecated.bbclass b/meta/classes/deprecated.bbclass
new file mode 100644
index 0000000..3dcdadb
--- /dev/null
+++ b/meta/classes/deprecated.bbclass
@@ -0,0 +1,16 @@
+# To use the deprecated recipe check, a distribution should
+# include this class in the INHERIT_DISTRO
+#
+# Features:
+#
+# * To add a package to the deprecated list, set:
+#   PNDEPRECATED[pn] = "message"
+#
+
+addtask check_deprecated before do_fetch
+python do_check_deprecated () {
+    deprecated = d.getVarFlag('PNDEPRECATED', d.getVar('PN', True), False)
+
+    if deprecated:
+        bb.warn("Recipe is deprecated: ", (deprecated))
+}
diff --git a/meta/conf/distro/defaultsetup.conf b/meta/conf/distro/defaultsetup.conf
index ca2f917..16ece3a 100644
--- a/meta/conf/distro/defaultsetup.conf
+++ b/meta/conf/distro/defaultsetup.conf
@@ -20,5 +20,6 @@ CACHE = "${TMPDIR}/cache/${TCMODE}-${TCLIBC}${@['', '/' + str(d.getVar('MACHINE'
 USER_CLASSES ?= ""
 PACKAGE_CLASSES ?= "package_ipk"
 INHERIT_BLACKLIST = "blacklist"
+INHERIT_DEPRECATED = "deprecated"
 INHERIT_DISTRO ?= "debian devshell sstate license remove-libtool"
-INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO} ${INHERIT_BLACKLIST}"
+INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO} ${INHERIT_BLACKLIST} ${INHERIT_DEPRECATED}"
-- 
1.9.1




More information about the Openembedded-core mailing list