diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-15 15:04:05 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-16 10:31:41 +0000 |
| commit | 0ca67e4d97692c25b6154938cee7a228cca7fa60 (patch) | |
| tree | 21b45bf6718fc1958fcdf4ef9c88444a2b32092c /meta/classes/create-spdx.bbclass | |
| parent | 10d9a8ba7a6ab2ce0e434e83f44727c160d26982 (diff) | |
| download | poky-0ca67e4d97692c25b6154938cee7a228cca7fa60.tar.gz | |
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>
Diffstat (limited to 'meta/classes/create-spdx.bbclass')
| -rw-r--r-- | meta/classes/create-spdx.bbclass | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass index daf99ca676..1a4804a7c5 100644 --- a/meta/classes/create-spdx.bbclass +++ b/meta/classes/create-spdx.bbclass | |||
| @@ -94,7 +94,7 @@ def convert_license_to_spdx(lic, document, d, existing={}): | |||
| 94 | from pathlib import Path | 94 | from pathlib import Path |
| 95 | import oe.spdx | 95 | import oe.spdx |
| 96 | 96 | ||
| 97 | available_licenses = d.getVar("AVAILABLE_LICENSES").split() | 97 | avail_licenses = available_licenses(d) |
| 98 | license_data = d.getVar("SPDX_LICENSE_DATA") | 98 | license_data = d.getVar("SPDX_LICENSE_DATA") |
| 99 | extracted = {} | 99 | extracted = {} |
| 100 | 100 | ||
| @@ -112,7 +112,7 @@ def convert_license_to_spdx(lic, document, d, existing={}): | |||
| 112 | if name == "PD": | 112 | if name == "PD": |
| 113 | # Special-case this. | 113 | # Special-case this. |
| 114 | extracted_info.extractedText = "Software released to the public domain" | 114 | extracted_info.extractedText = "Software released to the public domain" |
| 115 | elif name in available_licenses: | 115 | elif name in avail_licenses: |
| 116 | # This license can be found in COMMON_LICENSE_DIR or LICENSE_PATH | 116 | # This license can be found in COMMON_LICENSE_DIR or LICENSE_PATH |
| 117 | for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split(): | 117 | for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split(): |
| 118 | try: | 118 | try: |
| @@ -122,11 +122,11 @@ def convert_license_to_spdx(lic, document, d, existing={}): | |||
| 122 | except FileNotFoundError: | 122 | except FileNotFoundError: |
| 123 | pass | 123 | pass |
| 124 | if extracted_info.extractedText is None: | 124 | if extracted_info.extractedText is None: |
| 125 | # Error out, as the license was in available_licenses so should | 125 | # Error out, as the license was in avail_licenses so should |
| 126 | # be on disk somewhere. | 126 | # be on disk somewhere. |
| 127 | bb.error("Cannot find text for license %s" % name) | 127 | bb.error("Cannot find text for license %s" % name) |
| 128 | else: | 128 | else: |
| 129 | # If it's not SPDX, or PD, or in available licenses, then NO_GENERIC_LICENSE must be set | 129 | # If it's not SPDX, or PD, or in avail_licenses, then NO_GENERIC_LICENSE must be set |
| 130 | filename = d.getVarFlag('NO_GENERIC_LICENSE', name) | 130 | filename = d.getVarFlag('NO_GENERIC_LICENSE', name) |
| 131 | if filename: | 131 | if filename: |
| 132 | filename = d.expand("${S}/" + filename) | 132 | filename = d.expand("${S}/" + filename) |
