summaryrefslogtreecommitdiffstats
path: root/meta/classes/sanity.bbclass
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 12:04:48 +0100
commit7a619c235f17a2e55b25d7e12984bfb61ec964fb (patch)
treecf1b5fd3277fefea5ba13b485d384d9750409e2d /meta/classes/sanity.bbclass
parent0fd6a47ddf3f6140e25856028dee33b2045e0f55 (diff)
downloadpoky-7a619c235f17a2e55b25d7e12984bfb61ec964fb.tar.gz
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]. (From OE-Core rev: 49d8b7b8c3b18da64583637db207f1f064a5bdb2) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sanity.bbclass')
-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 @@
4 4
5SANITY_REQUIRED_UTILITIES ?= "patch diffstat texi2html makeinfo svn bzip2 tar gzip gawk chrpath wget cpio" 5SANITY_REQUIRED_UTILITIES ?= "patch diffstat texi2html makeinfo svn bzip2 tar gzip gawk chrpath wget cpio"
6 6
7def raise_sanity_error(msg): 7def raise_sanity_error(msg, d):
8 if d.getVar("SANITY_USE_EVENTS", True) == "1":
9 # FIXME: handle when BitBake version is too old to support bb.event.SanityCheckFailed
10 # We can just fire the event directly once the minimum version is bumped beyond 1.15.1
11 try:
12 bb.event.fire(bb.event.SanityCheckFailed(msg), d)
13 return
14 except AttributeError:
15 pass
16
8 bb.fatal(""" OE-core's config sanity checker detected a potential misconfiguration. 17 bb.fatal(""" OE-core's config sanity checker detected a potential misconfiguration.
9 Either fix the cause of this error or at your own risk disable the checker (see sanity.conf). 18 Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
10 Following is the list of potential problems / advisories: 19 Following is the list of potential problems / advisories:
@@ -295,7 +304,7 @@ def check_sanity(sanity_data):
295 return 304 return
296 305
297 if 0 == os.getuid(): 306 if 0 == os.getuid():
298 raise_sanity_error("Do not use Bitbake as root.") 307 raise_sanity_error("Do not use Bitbake as root.", sanity_data)
299 308
300 messages = "" 309 messages = ""
301 310
@@ -529,7 +538,7 @@ def check_sanity(sanity_data):
529 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." 538 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."
530 539
531 if messages != "": 540 if messages != "":
532 raise_sanity_error(messages) 541 raise_sanity_error(messages, sanity_data)
533 542
534# Create a copy of the datastore and finalise it to ensure appends and 543# Create a copy of the datastore and finalise it to ensure appends and
535# overrides are set - the datastore has yet to be finalised at ConfigParsed 544# overrides are set - the datastore has yet to be finalised at ConfigParsed
@@ -545,6 +554,7 @@ python check_sanity_eventhandler() {
545 check_sanity(sanity_data) 554 check_sanity(sanity_data)
546 elif bb.event.getName(e) == "SanityCheck": 555 elif bb.event.getName(e) == "SanityCheck":
547 sanity_data = copy_data(e) 556 sanity_data = copy_data(e)
557 sanity_data.setVar("SANITY_USE_EVENTS", "1")
548 check_sanity(sanity_data) 558 check_sanity(sanity_data)
549 bb.event.fire(bb.event.SanityCheckPassed(), e.data) 559 bb.event.fire(bb.event.SanityCheckPassed(), e.data)
550 560