From bb164adca94b5a43751aabe6b6d702a3d60dfdc7 Mon Sep 17 00:00:00 2001 From: Mike Crowe Date: Fri, 15 Oct 2021 15:39:54 +0100 Subject: insane,license,license_image: Allow treating license problems as errors Use the same WARN_WA and ERROR_QA variables as insane.bbclass to allow individual recipes, the distro or other configuration to determine whether the various detected license errors should be treated as a warning (as now) or as an error. oe.qa.handle_error isn't immediately fatal, so oe.qa.exit_if_errors must be called at the end of do_populate_lic to fail the task. Signed-off-by: Mike Crowe Signed-off-by: Richard Purdie --- meta/classes/license_image.bbclass | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'meta/classes/license_image.bbclass') diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass index 5490d121f1..bf70bee99b 100644 --- a/meta/classes/license_image.bbclass +++ b/meta/classes/license_image.bbclass @@ -75,7 +75,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): pkg_dic[pkg]["LICENSES"] = re.sub(r' *', ' ', pkg_dic[pkg]["LICENSES"]) pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split() if pkg in whitelist: - bb.warn("Including %s with an incompatible license %s into the image, because it has been whitelisted." %(pkg, pkg_dic[pkg]["LICENSE"])) + oe.qa.handle_error('license-incompatible', "Including %s with an incompatible license %s into the image, because it has been whitelisted." %(pkg, pkg_dic[pkg]["LICENSE"]), d) if not "IMAGE_MANIFEST" in pkg_dic[pkg]: # Rootfs manifest @@ -105,10 +105,10 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): continue if not os.path.exists(lic_file): - bb.warn("The license listed %s was not in the "\ - "licenses collected for recipe %s" - % (lic, pkg_dic[pkg]["PN"])) - + oe.qa.handle_error('license-file-missing', + "The license listed %s was not in the "\ + "licenses collected for recipe %s" + % (lic, pkg_dic[pkg]["PN"]), d) # Two options here: # - Just copy the manifest # - Copy the manifest and the license directories @@ -274,6 +274,7 @@ do_rootfs[recrdeptask] += "do_populate_lic" python do_populate_lic_deploy() { license_deployed_manifest(d) + oe.qa.exit_if_errors(d) } addtask populate_lic_deploy before do_build after do_image_complete -- cgit 1.2.3-korg