summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@windriver.com>2021-11-17 10:08:14 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-24 21:12:50 +0000
commit5bcb2b17321c7f9ea84989426cd16f0dca073bb9 (patch)
treec294389abb140b5e6b87eedc7baf77dcafd31379
parent07c12415c6b7af0bfca8e5d5d06b437f2f631f8b (diff)
downloadpoky-5bcb2b17321c7f9ea84989426cd16f0dca073bb9.tar.gz
create-spdx: Protect against None from LICENSE_PATH
If LICENSE_PATH is not set, then the split() will fail on a NoneType. (From OE-Core rev: 123ee0fc0d1470427cc563f512f621e0172cc232) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit d6260decae6d2654f6e058f12ca02d582a8ef5a4) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/create-spdx.bbclass3
1 files changed, 1 insertions, 2 deletions
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={}):
92 extracted_info.extractedText = "Software released to the public domain" 92 extracted_info.extractedText = "Software released to the public domain"
93 elif name in available_licenses: 93 elif name in available_licenses:
94 # This license can be found in COMMON_LICENSE_DIR or LICENSE_PATH 94 # This license can be found in COMMON_LICENSE_DIR or LICENSE_PATH
95 for directory in [d.getVar('COMMON_LICENSE_DIR')] + d.getVar('LICENSE_PATH').split(): 95 for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split():
96 try: 96 try:
97 with (Path(directory) / name).open(errors="replace") as f: 97 with (Path(directory) / name).open(errors="replace") as f:
98 extracted_info.extractedText = f.read() 98 extracted_info.extractedText = f.read()
@@ -145,7 +145,6 @@ def convert_license_to_spdx(lic, document, d, existing={}):
145 145
146 return ' '.join(convert(l) for l in lic_split) 146 return ' '.join(convert(l) for l in lic_split)
147 147
148
149def process_sources(d): 148def process_sources(d):
150 pn = d.getVar('PN') 149 pn = d.getVar('PN')
151 assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split() 150 assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()