From 8fda70bb74f7c63d393d5424436d034d2cc6c05e Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 15 Sep 2016 14:21:26 +0300 Subject: sanity.bbclass: split out config re-parse check Split out the functionality doing configuration re-parse check into a separate event handler that is hooked into ConfigParsed event. This will make config re-parsing actually work. Re-parsing in bitbake is triggered by setting BB_INVALIDCONF whose value is checked after configuration has been parsed (after ConfigParsed event). However, previously BB_INVALIDCONF was set in SanityCheck event handler which caused re-parsing never to happen. [YOCTO #10188] Signed-off-by: Markus Lehtonen Signed-off-by: Richard Purdie --- meta/classes/sanity.bbclass | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index f17e2d4cd0..7682ffbb8c 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass @@ -135,8 +135,7 @@ is a good way to visualise the changes.""" bb.note("Your conf/bblayers.conf has been automatically updated.") return - if not status.reparse: - status.addresult() + status.addresult() elif current_lconf == 6 and lconf_version > 6: # Handle rename of meta-yocto -> meta-poky @@ -557,20 +556,17 @@ def check_perl_modules(sanity_data): return "Required perl module(s) not found: %s\n\n%s\n" % (ret, errresult) return None -def sanity_check_conffiles(status, d): +def sanity_check_conffiles(d): funcs = d.getVar('BBLAYERS_CONF_UPDATE_FUNCS', True).split() for func in funcs: conffile, current_version, required_version, func = func.split(":") if check_conf_exists(conffile, d) and d.getVar(current_version, True) is not None and \ d.getVar(current_version, True) != d.getVar(required_version, True): - success = True try: bb.build.exec_func(func, d, pythonexception=True) except NotImplementedError as e: - success = False - status.addresult(str(e)) - if success: - status.reparse = True + bb.fatal(e) + d.setVar("BB_INVALIDCONF", True) def sanity_handle_abichanges(status, d): # @@ -746,7 +742,7 @@ def check_sanity_version_change(status, d): status.addresult("You have a 32-bit libc, but no 32-bit headers. You must install the 32-bit libc headers.\n") bbpaths = d.getVar('BBPATH', True).split(":") - if ("." in bbpaths or "./" in bbpaths or "" in bbpaths) and not status.reparse: + if ("." in bbpaths or "./" in bbpaths or "" in bbpaths): status.addresult("BBPATH references the current directory, either through " \ "an empty entry, a './' or a '.'.\n\t This is unsafe and means your "\ "layer configuration is adding empty elements to BBPATH.\n\t "\ @@ -796,8 +792,6 @@ def check_sanity_everybuild(status, d): sanity_check_locale(d) - sanity_check_conffiles(status, d) - paths = d.getVar('PATH', True).split(":") if "." in paths or "./" in paths or "" in paths: status.addresult("PATH contains '.', './' or '' (empty element), which will break the build, please remove this.\nParsed PATH is " + str(paths) + "\n") @@ -943,7 +937,6 @@ def check_sanity(sanity_data): def __init__(self): self.messages = "" self.network_error = False - self.reparse = False def addresult(self, message): if message: @@ -999,7 +992,6 @@ def check_sanity(sanity_data): if status.messages != "": raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error) - return status.reparse # 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 @@ -1008,15 +1000,20 @@ def copy_data(e): sanity_data.finalize() return sanity_data +addhandler config_reparse_eventhandler +config_reparse_eventhandler[eventmask] = "bb.event.ConfigParsed" +python config_reparse_eventhandler() { + sanity_check_conffiles(e.data) +} + addhandler check_sanity_eventhandler check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest" python check_sanity_eventhandler() { if bb.event.getName(e) == "SanityCheck": sanity_data = copy_data(e) + check_sanity(sanity_data) if e.generateevents: 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) elif bb.event.getName(e) == "NetworkTest": sanity_data = copy_data(e) -- cgit 1.2.3-korg