diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-05-28 18:10:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-14 11:23:48 +0100 |
commit | 78a5471a29fca1c61d1fbfe164e0ad3b34f5e8d2 (patch) | |
tree | b16eb087096b93f77f6b16dd3be9454e6e3c861a | |
parent | b30a243f3f9133b62a4003bc28374b0f931e6c41 (diff) | |
download | poky-78a5471a29fca1c61d1fbfe164e0ad3b34f5e8d2.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: 3788f9bcb36cca90ca8cf650c9d33f5485e3087b)
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.bbclass | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index 0c2fa04bcc..97556949e8 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass | |||
@@ -4,7 +4,16 @@ | |||
4 | 4 | ||
5 | SANITY_REQUIRED_UTILITIES ?= "patch diffstat texi2html makeinfo svn bzip2 tar gzip gawk chrpath wget cpio" | 5 | SANITY_REQUIRED_UTILITIES ?= "patch diffstat texi2html makeinfo svn bzip2 tar gzip gawk chrpath wget cpio" |
6 | 6 | ||
7 | def raise_sanity_error(msg): | 7 | def 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: |
@@ -219,7 +228,7 @@ def check_sanity(sanity_data): | |||
219 | return | 228 | return |
220 | 229 | ||
221 | if 0 == os.getuid(): | 230 | if 0 == os.getuid(): |
222 | raise_sanity_error("Do not use Bitbake as root.") | 231 | raise_sanity_error("Do not use Bitbake as root.", sanity_data) |
223 | 232 | ||
224 | messages = "" | 233 | messages = "" |
225 | 234 | ||
@@ -449,7 +458,7 @@ def check_sanity(sanity_data): | |||
449 | 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." | 458 | 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." |
450 | 459 | ||
451 | if messages != "": | 460 | if messages != "": |
452 | raise_sanity_error(messages) | 461 | raise_sanity_error(messages, sanity_data) |
453 | 462 | ||
454 | # Create a copy of the datastore and finalise it to ensure appends and | 463 | # Create a copy of the datastore and finalise it to ensure appends and |
455 | # overrides are set - the datastore has yet to be finalised at ConfigParsed | 464 | # overrides are set - the datastore has yet to be finalised at ConfigParsed |
@@ -465,6 +474,7 @@ python check_sanity_eventhandler() { | |||
465 | check_sanity(sanity_data) | 474 | check_sanity(sanity_data) |
466 | elif bb.event.getName(e) == "SanityCheck": | 475 | elif bb.event.getName(e) == "SanityCheck": |
467 | sanity_data = copy_data(e) | 476 | sanity_data = copy_data(e) |
477 | sanity_data.setVar("SANITY_USE_EVENTS", "1") | ||
468 | check_sanity(sanity_data) | 478 | check_sanity(sanity_data) |
469 | bb.event.fire(bb.event.SanityCheckPassed(), e.data) | 479 | bb.event.fire(bb.event.SanityCheckPassed(), e.data) |
470 | 480 | ||