From: Saul Wold Date: Wed, 17 Nov 2021 18:08:14 +0000 (-0800) Subject: create-spdx: Protect against None from LICENSE_PATH X-Git-Tag: uninative-3.5~770 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=d6260decae6d2654f6e058f12ca02d582a8ef5a4;p=openembedded-core.git create-spdx: Protect against None from LICENSE_PATH If LICENSE_PATH is not set, then the split() will fail on a NoneType. Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass index 1d5c8b3bc1..d0cc5b1ca2 100644 --- a/meta/classes/create-spdx.bbclass +++ b/meta/classes/create-spdx.bbclass @@ -92,7 +92,7 @@ def convert_license_to_spdx(lic, document, d, existing={}): extracted_info.extractedText = "Software released to the public domain" elif name in available_licenses: # This license can be found in COMMON_LICENSE_DIR or LICENSE_PATH - for directory in [d.getVar('COMMON_LICENSE_DIR')] + d.getVar('LICENSE_PATH').split(): + for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split(): try: with (Path(directory) / name).open(errors="replace") as f: extracted_info.extractedText = f.read() @@ -145,7 +145,6 @@ def convert_license_to_spdx(lic, document, d, existing={}): return ' '.join(convert(l) for l in lic_split) - def process_sources(d): pn = d.getVar('PN') assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()