浏览代码

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>
Saul Wold 3 年之前
父节点
当前提交
3b836f5817
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      meta/classes/create-spdx.bbclass

+ 1 - 2
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()