From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: [RFC PATCH 3/3] base.bbclass: Add detection/sanity check of non-global class inheritance
Date: Wed, 26 Mar 2014 09:32:52 +0000 [thread overview]
Message-ID: <1395826372.24890.84.camel@ted> (raw)
Users are doing things like inheriting bootimg in local.conf and not understanding
that there are two types of class, "global" classes and "recipe" classes. This
patch starts to markup the recipe classes to tell the user when they're including
a "recipe" class in global context by mistake.
RFC: Only one class has markup here but we could go through them and mark the "recipe"
classes accordingly.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 360b112..08617e8 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -295,6 +295,9 @@ python base_eventhandler() {
preferred_ml_updates(e.data)
oe.utils.features_backfill("DISTRO_FEATURES", e.data)
oe.utils.features_backfill("MACHINE_FEATURES", e.data)
+ nonglobalclasses = e.data.getVar("NONGLOBALBBCLASS", True)
+ if nonglobalclasses:
+ bb.error("The following classes were inserted into the global namespace but are not designed for use like this. Please inherit them in the appropriate recipe instead: %s" % nonglobalclasses)
if isinstance(e, bb.event.BuildStarted):
localdata = bb.data.createCopy(e.data)
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index b13eef9..1562408 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -4,6 +4,8 @@
# Creates a bootable image using syslinux, your kernel and an optional
# initrd
+NONGLOBALBBCLASS += "bootimg"
+
#
# End result is two things:
#
reply other threads:[~2014-03-26 9:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395826372.24890.84.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox