* [PATCH 0/1] v2: make sanity check failure perhaps-surviveable
@ 2013-11-20 23:26 Peter Seebach
2013-11-20 23:26 ` [PATCH 1/1] sanity.bbclass: Failure might be an option Peter Seebach
0 siblings, 1 reply; 2+ messages in thread
From: Peter Seebach @ 2013-11-20 23:26 UTC (permalink / raw)
To: openembedded-core
Sanity checks are changed to happen when a SanityCheck event shows up,
rather than sometimes but not always on a ConfigParsed; there is a
corresponding bitbake patch to actually send the event.
SanityCheck events do not strictly imply that the response should be
handled through the event system; that's now an optional setting in the
SanityCheck event.
So is whether a failure should be a fatal error.
The following changes since commit ee3e2e5ce15a3bf78c7e9d76d7bf68131f2d3ef7:
librsvg: upgrade to 2.40.0 (2013-11-20 14:03:06 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib seebs/insanity_revisited
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/insanity_revisited
Peter Seebach (1):
sanity.bbclass: Failure might be an option.
meta/classes/sanity.bbclass | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] sanity.bbclass: Failure might be an option.
2013-11-20 23:26 [PATCH 0/1] v2: make sanity check failure perhaps-surviveable Peter Seebach
@ 2013-11-20 23:26 ` Peter Seebach
0 siblings, 0 replies; 2+ messages in thread
From: Peter Seebach @ 2013-11-20 23:26 UTC (permalink / raw)
To: openembedded-core
Matching up with corresponding changes in bitbake, we now use
the SanityCheck event instead of piggybacking the sanity checks
on ConfigParsed. The SanityCheck event can indicate to us whether
we should use events to provide feedback, and whether failures
are acceptable. This allows a build tool which wants to evaluate
a configuration even if it fails sanity testing to do so; the
most obvious example is bitbake -e, but bitbake-layers show_layers
might also want to be adapted to use this.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
---
meta/classes/sanity.bbclass | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 6807a23..ca9e146 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -74,7 +74,7 @@ python oecore_update_bblayers() {
sys.exit()
}
-def raise_sanity_error(msg, d, network_error=False):
+def raise_sanity_error(msg, d, network_error=False, failure_is_an_option=False):
if d.getVar("SANITY_USE_EVENTS", True) == "1":
try:
bb.event.fire(bb.event.SanityCheckFailed(msg, network_error), d)
@@ -82,11 +82,15 @@ def raise_sanity_error(msg, d, network_error=False):
bb.event.fire(bb.event.SanityCheckFailed(msg), d)
return
- bb.fatal(""" OE-core's config sanity checker detected a potential misconfiguration.
+ msg = (""" 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:
%s""" % msg)
+ if failure_is_an_option:
+ bb.error(msg)
+ else:
+ bb.fatal(msg)
# Check a single tune for validity.
def check_toolchain_tune(data, tune, multilib):
@@ -677,7 +681,7 @@ def check_sanity_everybuild(status, d):
with open(checkfile, "w") as f:
f.write(tmpdir)
-def check_sanity(sanity_data):
+def check_sanity(sanity_data, failure_is_an_option = False):
import subprocess
class SanityStatus(object):
@@ -730,7 +734,10 @@ def check_sanity(sanity_data):
sanity_handle_abichanges(status, sanity_data)
if status.messages != "":
- raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error)
+ sanity_data.setVar("SANITY_CHECK_FAILED", "1")
+ raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error, failure_is_an_option)
+ else:
+ sanity_data.setVar("SANITY_CHECK_FAILED", "0")
return status.reparse
# Create a copy of the datastore and finalise it to ensure appends and
@@ -741,18 +748,23 @@ def copy_data(e):
return sanity_data
addhandler check_sanity_eventhandler
-check_sanity_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.SanityCheck bb.event.NetworkTest"
+check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest"
python check_sanity_eventhandler() {
- if bb.event.getName(e) == "ConfigParsed" and e.data.getVar("BB_WORKERCONTEXT", True) != "1" and e.data.getVar("DISABLE_SANITY_CHECKS", True) != "1":
+ if bb.event.getName(e) == "SanityCheck":
sanity_data = copy_data(e)
- reparse = check_sanity(sanity_data)
+ if e._use_events:
+ sanity_data.setVar("SANITY_USE_EVENTS", "1")
+ reparse = check_sanity(sanity_data, e._failure_is_an_option)
e.data.setVar("BB_INVALIDCONF", reparse)
- elif bb.event.getName(e) == "SanityCheck":
- sanity_data = copy_data(e)
- sanity_data.setVar("SANITY_USE_EVENTS", "1")
- reparse = check_sanity(sanity_data)
- e.data.setVar("BB_INVALIDCONF", reparse)
- bb.event.fire(bb.event.SanityCheckPassed(), e.data)
+ failed = sanity_data.getVar("SANITY_CHECK_FAILED", True)
+ if e._use_events:
+ if failed == "0":
+ bb.event.fire(bb.event.SanityCheckPassed(), e.data)
+ else:
+ # If we got here, failure must have been an option,
+ # so we are continuing, we'd better make sure the caller
+ # can see what happened.
+ e.data.setVar("SANITY_CHECK_FAILED", failed)
elif bb.event.getName(e) == "NetworkTest":
sanity_data = copy_data(e)
bb.event.fire(bb.event.NetworkTestFailed() if check_connectivity(sanity_data) else bb.event.NetworkTestPassed(), e.data)
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-20 23:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 23:26 [PATCH 0/1] v2: make sanity check failure perhaps-surviveable Peter Seebach
2013-11-20 23:26 ` [PATCH 1/1] sanity.bbclass: Failure might be an option Peter Seebach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox