mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
create-spdx: Use function rather than AVAILABLE_LICENSES
We can directly call the function rather than using the variable indirection. As this is the last user of the variable, it then allows removal of it in a followup patch. (From OE-Core rev: 3ed84651b2f4eff9409bfecba2a080e244124880) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -94,7 +94,7 @@ def convert_license_to_spdx(lic, document, d, existing={}):
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import oe.spdx
|
import oe.spdx
|
||||||
|
|
||||||
available_licenses = d.getVar("AVAILABLE_LICENSES").split()
|
avail_licenses = available_licenses(d)
|
||||||
license_data = d.getVar("SPDX_LICENSE_DATA")
|
license_data = d.getVar("SPDX_LICENSE_DATA")
|
||||||
extracted = {}
|
extracted = {}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ def convert_license_to_spdx(lic, document, d, existing={}):
|
|||||||
if name == "PD":
|
if name == "PD":
|
||||||
# Special-case this.
|
# Special-case this.
|
||||||
extracted_info.extractedText = "Software released to the public domain"
|
extracted_info.extractedText = "Software released to the public domain"
|
||||||
elif name in available_licenses:
|
elif name in avail_licenses:
|
||||||
# This license can be found in COMMON_LICENSE_DIR or LICENSE_PATH
|
# This license can be found in COMMON_LICENSE_DIR or LICENSE_PATH
|
||||||
for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split():
|
for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split():
|
||||||
try:
|
try:
|
||||||
@@ -122,11 +122,11 @@ def convert_license_to_spdx(lic, document, d, existing={}):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
if extracted_info.extractedText is None:
|
if extracted_info.extractedText is None:
|
||||||
# Error out, as the license was in available_licenses so should
|
# Error out, as the license was in avail_licenses so should
|
||||||
# be on disk somewhere.
|
# be on disk somewhere.
|
||||||
bb.error("Cannot find text for license %s" % name)
|
bb.error("Cannot find text for license %s" % name)
|
||||||
else:
|
else:
|
||||||
# If it's not SPDX, or PD, or in available licenses, then NO_GENERIC_LICENSE must be set
|
# If it's not SPDX, or PD, or in avail_licenses, then NO_GENERIC_LICENSE must be set
|
||||||
filename = d.getVarFlag('NO_GENERIC_LICENSE', name)
|
filename = d.getVarFlag('NO_GENERIC_LICENSE', name)
|
||||||
if filename:
|
if filename:
|
||||||
filename = d.expand("${S}/" + filename)
|
filename = d.expand("${S}/" + filename)
|
||||||
|
|||||||
Reference in New Issue
Block a user