summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-09-15 14:21:26 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-16 15:24:03 +0100
commita24b2fa8f88a02f295f79e8d3b4215c8c4df265d (patch)
treec1f9cf2875500dd27fc27da93c3966624fb298d1 /meta/classes
parent5fc455ec9b058f53b61f6c071579c65366051743 (diff)
downloadpoky-a24b2fa8f88a02f295f79e8d3b4215c8c4df265d.tar.gz
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>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/sanity.bbclass27
1 files 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."""
135 bb.note("Your conf/bblayers.conf has been automatically updated.") 135 bb.note("Your conf/bblayers.conf has been automatically updated.")
136 return 136 return
137 137
138 if not status.reparse: 138 status.addresult()
139 status.addresult()
140 139
141 elif current_lconf == 6 and lconf_version > 6: 140 elif current_lconf == 6 and lconf_version > 6:
142 # Handle rename of meta-yocto -> meta-poky 141 # Handle rename of meta-yocto -> meta-poky
@@ -557,20 +556,17 @@ def check_perl_modules(sanity_data):
557 return "Required perl module(s) not found: %s\n\n%s\n" % (ret, errresult) 556 return "Required perl module(s) not found: %s\n\n%s\n" % (ret, errresult)
558 return None 557 return None
559 558
560def sanity_check_conffiles(status, d): 559def sanity_check_conffiles(d):
561 funcs = d.getVar('BBLAYERS_CONF_UPDATE_FUNCS', True).split() 560 funcs = d.getVar('BBLAYERS_CONF_UPDATE_FUNCS', True).split()
562 for func in funcs: 561 for func in funcs:
563 conffile, current_version, required_version, func = func.split(":") 562 conffile, current_version, required_version, func = func.split(":")
564 if check_conf_exists(conffile, d) and d.getVar(current_version, True) is not None and \ 563 if check_conf_exists(conffile, d) and d.getVar(current_version, True) is not None and \
565 d.getVar(current_version, True) != d.getVar(required_version, True): 564 d.getVar(current_version, True) != d.getVar(required_version, True):
566 success = True
567 try: 565 try:
568 bb.build.exec_func(func, d, pythonexception=True) 566 bb.build.exec_func(func, d, pythonexception=True)
569 except NotImplementedError as e: 567 except NotImplementedError as e:
570 success = False 568 bb.fatal(e)
571 status.addresult(str(e)) 569 d.setVar("BB_INVALIDCONF", True)
572 if success:
573 status.reparse = True
574 570
575def sanity_handle_abichanges(status, d): 571def sanity_handle_abichanges(status, d):
576 # 572 #
@@ -746,7 +742,7 @@ def check_sanity_version_change(status, d):
746 status.addresult("You have a 32-bit libc, but no 32-bit headers. You must install the 32-bit libc headers.\n") 742 status.addresult("You have a 32-bit libc, but no 32-bit headers. You must install the 32-bit libc headers.\n")
747 743
748 bbpaths = d.getVar('BBPATH', True).split(":") 744 bbpaths = d.getVar('BBPATH', True).split(":")
749 if ("." in bbpaths or "./" in bbpaths or "" in bbpaths) and not status.reparse: 745 if ("." in bbpaths or "./" in bbpaths or "" in bbpaths):
750 status.addresult("BBPATH references the current directory, either through " \ 746 status.addresult("BBPATH references the current directory, either through " \
751 "an empty entry, a './' or a '.'.\n\t This is unsafe and means your "\ 747 "an empty entry, a './' or a '.'.\n\t This is unsafe and means your "\
752 "layer configuration is adding empty elements to BBPATH.\n\t "\ 748 "layer configuration is adding empty elements to BBPATH.\n\t "\
@@ -796,8 +792,6 @@ def check_sanity_everybuild(status, d):
796 792
797 sanity_check_locale(d) 793 sanity_check_locale(d)
798 794
799 sanity_check_conffiles(status, d)
800
801 paths = d.getVar('PATH', True).split(":") 795 paths = d.getVar('PATH', True).split(":")
802 if "." in paths or "./" in paths or "" in paths: 796 if "." in paths or "./" in paths or "" in paths:
803 status.addresult("PATH contains '.', './' or '' (empty element), which will break the build, please remove this.\nParsed PATH is " + str(paths) + "\n") 797 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):
943 def __init__(self): 937 def __init__(self):
944 self.messages = "" 938 self.messages = ""
945 self.network_error = False 939 self.network_error = False
946 self.reparse = False
947 940
948 def addresult(self, message): 941 def addresult(self, message):
949 if message: 942 if message:
@@ -999,7 +992,6 @@ def check_sanity(sanity_data):
999 992
1000 if status.messages != "": 993 if status.messages != "":
1001 raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error) 994 raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error)
1002 return status.reparse
1003 995
1004# Create a copy of the datastore and finalise it to ensure appends and 996# Create a copy of the datastore and finalise it to ensure appends and
1005# overrides are set - the datastore has yet to be finalised at ConfigParsed 997# overrides are set - the datastore has yet to be finalised at ConfigParsed
@@ -1008,15 +1000,20 @@ def copy_data(e):
1008 sanity_data.finalize() 1000 sanity_data.finalize()
1009 return sanity_data 1001 return sanity_data
1010 1002
1003addhandler config_reparse_eventhandler
1004config_reparse_eventhandler[eventmask] = "bb.event.ConfigParsed"
1005python config_reparse_eventhandler() {
1006 sanity_check_conffiles(e.data)
1007}
1008
1011addhandler check_sanity_eventhandler 1009addhandler check_sanity_eventhandler
1012check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest" 1010check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest"
1013python check_sanity_eventhandler() { 1011python check_sanity_eventhandler() {
1014 if bb.event.getName(e) == "SanityCheck": 1012 if bb.event.getName(e) == "SanityCheck":
1015 sanity_data = copy_data(e) 1013 sanity_data = copy_data(e)
1014 check_sanity(sanity_data)
1016 if e.generateevents: 1015 if e.generateevents:
1017 sanity_data.setVar("SANITY_USE_EVENTS", "1") 1016 sanity_data.setVar("SANITY_USE_EVENTS", "1")
1018 reparse = check_sanity(sanity_data)
1019 e.data.setVar("BB_INVALIDCONF", reparse)
1020 bb.event.fire(bb.event.SanityCheckPassed(), e.data) 1017 bb.event.fire(bb.event.SanityCheckPassed(), e.data)
1021 elif bb.event.getName(e) == "NetworkTest": 1018 elif bb.event.getName(e) == "NetworkTest":
1022 sanity_data = copy_data(e) 1019 sanity_data = copy_data(e)