From b26a6df7efdaf640c612f6d557a2e74b4dc58af3 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 27 Aug 2020 13:54:03 -0400 Subject: kernel-yocto: allow promotion of configuration warnings to errors It was requested to add the ability to upgrade configuration warnings to errors, so that they can't be missed in a build. Add a flag KMETA_AUDIT_WERROR, that when set, triggers a bb.fatal at the end of configuration checking if any warnings are found. This is off by default, but is available for those that want to enable it in their kernel recipe or bbappend. Signed-off-by: Bruce Ashfield Signed-off-by: Richard Purdie --- meta/classes/kernel-yocto.bbclass | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'meta/classes/kernel-yocto.bbclass') diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index 96ea612258..cb7614d64a 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass @@ -18,6 +18,7 @@ SRCREV_FORMAT ?= "meta_machine" KCONF_AUDIT_LEVEL ?= "1" KCONF_BSP_AUDIT_LEVEL ?= "0" KMETA_AUDIT ?= "yes" +KMETA_AUDIT_WERROR ?= "" # returns local (absolute) path names for all valid patches in the # src_uri @@ -507,6 +508,8 @@ python do_kernel_configcheck() { config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0) bsp_check_visibility = int(d.getVar("KCONF_BSP_AUDIT_LEVEL") or 0) + kmeta_audit_werror = d.getVar("KMETA_AUDIT_WERROR") or "" + warnings_detected = False # if config check visibility is "1", that's the lowest level of audit. So # we add the --classify option to the run, since classification will @@ -533,6 +536,7 @@ python do_kernel_configcheck() { with open (outfile, "r") as myfile: results = myfile.read() bb.warn( "[kernel config]: specified values did not make it into the kernel's final configuration:\n\n%s" % results) + warnings_detected = True # category #2: invalid fragment elements extra_params = "" @@ -552,8 +556,9 @@ python do_kernel_configcheck() { if bsp_check_visibility and os.stat(outfile).st_size > 0: with open (outfile, "r") as myfile: - results = myfile.read() - bb.warn( "[kernel config]: This BSP contains fragments with warnings:\n\n%s" % results) + results = myfile.read() + bb.warn( "[kernel config]: This BSP contains fragments with warnings:\n\n%s" % results) + warnings_detected = True # category #3: redefined options (this is pretty verbose and is debug only) try: @@ -574,6 +579,10 @@ python do_kernel_configcheck() { with open (outfile, "r") as myfile: results = myfile.read() bb.warn( "[kernel config]: This BSP has configuration options defined in more than one config, with differing values:\n\n%s" % results) + warnings_detected = True + + if warnings_detected and kmeta_audit_werror: + bb.fatal( "configuration warnings detected, werror is set, promoting to fatal" ) } # Ensure that the branches (BSP and meta) are on the locations specified by -- cgit 1.2.3-korg