summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-05-28 18:10:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-30 11:09:41 +0100
commit49d8b7b8c3b18da64583637db207f1f064a5bdb2 (patch)
treeaaec66ffb6d593b10d03a7f382947a0bc825ade4
parent8bfec8bf80b111174e4a6cf01db019b38638b31a (diff)
downloadopenembedded-core-49d8b7b8c3b18da64583637db207f1f064a5bdb2.tar.gz
openembedded-core-49d8b7b8c3b18da64583637db207f1f064a5bdb2.tar.bz2
openembedded-core-49d8b7b8c3b18da64583637db207f1f064a5bdb2.zip
classes/sanity: send sanity check failure as a separate event for Hob
In order to show a friendlier error message within Hob that does not bury the actual sanity error in our typical preamble about disabling sanity checks, use a separate event to indicate that sanity checks failed. This change is intended to work together with the related change to BitBake, however it has a check to ensure that it does not fail with older versions that do not include that change. Fixes [YOCTO #2336]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/sanity.bbclass16
1 files changed, 13 insertions, 3 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index b58e23fe69..7c1533e846 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -4,7 +4,16 @@
SANITY_REQUIRED_UTILITIES ?= "patch diffstat texi2html makeinfo svn bzip2 tar gzip gawk chrpath wget cpio"
-def raise_sanity_error(msg):
+def raise_sanity_error(msg, d):
+ if d.getVar("SANITY_USE_EVENTS", True) == "1":
+ # FIXME: handle when BitBake version is too old to support bb.event.SanityCheckFailed
+ # We can just fire the event directly once the minimum version is bumped beyond 1.15.1
+ try:
+ bb.event.fire(bb.event.SanityCheckFailed(msg), d)
+ return
+ except AttributeError:
+ pass
+
bb.fatal(""" OE-core's config sanity checker detected a potential misconfiguration.
Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
Following is the list of potential problems / advisories:
@@ -295,7 +304,7 @@ def check_sanity(sanity_data):
return
if 0 == os.getuid():
- raise_sanity_error("Do not use Bitbake as root.")
+ raise_sanity_error("Do not use Bitbake as root.", sanity_data)
messages = ""
@@ -529,7 +538,7 @@ def check_sanity(sanity_data):
messages = messages + "Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space."
if messages != "":
- raise_sanity_error(messages)
+ raise_sanity_error(messages, sanity_data)
# Create a copy of the datastore and finalise it to ensure appends and
# overrides are set - the datastore has yet to be finalised at ConfigParsed
@@ -545,6 +554,7 @@ python check_sanity_eventhandler() {
check_sanity(sanity_data)
elif bb.event.getName(e) == "SanityCheck":
sanity_data = copy_data(e)
+ sanity_data.setVar("SANITY_USE_EVENTS", "1")
check_sanity(sanity_data)
bb.event.fire(bb.event.SanityCheckPassed(), e.data)