From: Zhang Qiang <[email protected]> add KCONF_WARN_TO_ERROR variable. in do_kernel_configcheck function use the value of this variable to determine whether to treat the warning as an error.
Signed-off-by: Zhang Qiang <[email protected]> --- meta/classes/kernel-yocto.bbclass | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index 5bc627066e..ce88606eb6 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass @@ -18,6 +18,8 @@ SRCREV_FORMAT ?= "meta_machine" KCONF_AUDIT_LEVEL ?= "1" KCONF_BSP_AUDIT_LEVEL ?= "0" KMETA_AUDIT ?= "yes" +# 1: Warnings are handled as errors when kconf check find mismatch config +KCONF_WARN_TO_ERROR ?= "0" # returns local (absolute) path names for all valid patches in the # src_uri @@ -392,13 +394,17 @@ python do_kernel_configcheck() { except subprocess.CalledProcessError as e: bb.fatal( "Cannot gather config fragments for audit: %s" % e.output.decode("utf-8") ) + Werror = int(d.getVar("KCONF_WARN_TO_ERROR") or 0) + exit_code = 0 + try: subprocess.check_call(['kconf_check', '--report', '-o', - '%s/%s/cfg' % (s, kmeta), d.getVar('B') + '/.config', s, configs], cwd=s, env=env) - except subprocess.CalledProcessError: + '%s/%s/cfg' % (s, kmeta), '%d' % Werror, d.getVar('B') + '/.config', s, configs], cwd=s, env=env) + except subprocess.CalledProcessError as e: # The configuration gathering can return different exit codes, but # we interpret them based on the KCONF_AUDIT_LEVEL variable, so we catch # everything here, and let the run continue. + exit_code = int(e.returncode) pass config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0) @@ -432,6 +438,10 @@ python do_kernel_configcheck() { with open (redefinition_file, "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) + + if Werror > 0: + if exit_code > 0: + bb.fatal( "[kernel config]: Kconf_check find mismatch config" ) } # Ensure that the branches (BSP and meta) are on the locations specified by -- 2.24.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#8640): https://lists.yoctoproject.org/g/linux-yocto/message/8640 Mute This Topic: https://lists.yoctoproject.org/mt/74067165/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
