summaryrefslogtreecommitdiffstats
path: root/meta/classes/create-spdx.bbclass
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-21 11:05:02 +0000
commit3b836f58171f83498d420e50412e38a5d9796fd9 (patch)
treecf398a528baf0e22cb013b001595e6710b00e9fc /meta/classes/create-spdx.bbclass
parente1e8531c64b2663767546adf0f46bc6c96c12360 (diff)
downloadpoky-3b836f58171f83498d420e50412e38a5d9796fd9.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: d6260decae6d2654f6e058f12ca02d582a8ef5a4) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/create-spdx.bbclass')
-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()