mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 00:39:46 +00:00
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] (From OE-Core rev: 8fda70bb74f7c63d393d5424436d034d2cc6c05e) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
5fc455ec9b
commit
a24b2fa8f8
+12
-15
@@ -135,8 +135,7 @@ is a good way to visualise the changes."""
|
|||||||
bb.note("Your conf/bblayers.conf has been automatically updated.")
|
bb.note("Your conf/bblayers.conf has been automatically updated.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not status.reparse:
|
status.addresult()
|
||||||
status.addresult()
|
|
||||||
|
|
||||||
elif current_lconf == 6 and lconf_version > 6:
|
elif current_lconf == 6 and lconf_version > 6:
|
||||||
# Handle rename of meta-yocto -> meta-poky
|
# 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 "Required perl module(s) not found: %s\n\n%s\n" % (ret, errresult)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def sanity_check_conffiles(status, d):
|
def sanity_check_conffiles(d):
|
||||||
funcs = d.getVar('BBLAYERS_CONF_UPDATE_FUNCS', True).split()
|
funcs = d.getVar('BBLAYERS_CONF_UPDATE_FUNCS', True).split()
|
||||||
for func in funcs:
|
for func in funcs:
|
||||||
conffile, current_version, required_version, func = func.split(":")
|
conffile, current_version, required_version, func = func.split(":")
|
||||||
if check_conf_exists(conffile, d) and d.getVar(current_version, True) is not None and \
|
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):
|
d.getVar(current_version, True) != d.getVar(required_version, True):
|
||||||
success = True
|
|
||||||
try:
|
try:
|
||||||
bb.build.exec_func(func, d, pythonexception=True)
|
bb.build.exec_func(func, d, pythonexception=True)
|
||||||
except NotImplementedError as e:
|
except NotImplementedError as e:
|
||||||
success = False
|
bb.fatal(e)
|
||||||
status.addresult(str(e))
|
d.setVar("BB_INVALIDCONF", True)
|
||||||
if success:
|
|
||||||
status.reparse = True
|
|
||||||
|
|
||||||
def sanity_handle_abichanges(status, d):
|
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")
|
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(":")
|
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 " \
|
status.addresult("BBPATH references the current directory, either through " \
|
||||||
"an empty entry, a './' or a '.'.\n\t This is unsafe and means your "\
|
"an empty entry, a './' or a '.'.\n\t This is unsafe and means your "\
|
||||||
"layer configuration is adding empty elements to BBPATH.\n\t "\
|
"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_locale(d)
|
||||||
|
|
||||||
sanity_check_conffiles(status, d)
|
|
||||||
|
|
||||||
paths = d.getVar('PATH', True).split(":")
|
paths = d.getVar('PATH', True).split(":")
|
||||||
if "." in paths or "./" in paths or "" in paths:
|
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")
|
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):
|
def __init__(self):
|
||||||
self.messages = ""
|
self.messages = ""
|
||||||
self.network_error = False
|
self.network_error = False
|
||||||
self.reparse = False
|
|
||||||
|
|
||||||
def addresult(self, message):
|
def addresult(self, message):
|
||||||
if message:
|
if message:
|
||||||
@@ -999,7 +992,6 @@ def check_sanity(sanity_data):
|
|||||||
|
|
||||||
if status.messages != "":
|
if status.messages != "":
|
||||||
raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error)
|
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
|
# 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
|
# overrides are set - the datastore has yet to be finalised at ConfigParsed
|
||||||
@@ -1008,15 +1000,20 @@ def copy_data(e):
|
|||||||
sanity_data.finalize()
|
sanity_data.finalize()
|
||||||
return sanity_data
|
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
|
addhandler check_sanity_eventhandler
|
||||||
check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest"
|
check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest"
|
||||||
python check_sanity_eventhandler() {
|
python check_sanity_eventhandler() {
|
||||||
if bb.event.getName(e) == "SanityCheck":
|
if bb.event.getName(e) == "SanityCheck":
|
||||||
sanity_data = copy_data(e)
|
sanity_data = copy_data(e)
|
||||||
|
check_sanity(sanity_data)
|
||||||
if e.generateevents:
|
if e.generateevents:
|
||||||
sanity_data.setVar("SANITY_USE_EVENTS", "1")
|
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)
|
bb.event.fire(bb.event.SanityCheckPassed(), e.data)
|
||||||
elif bb.event.getName(e) == "NetworkTest":
|
elif bb.event.getName(e) == "NetworkTest":
|
||||||
sanity_data = copy_data(e)
|
sanity_data = copy_data(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user