diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2024-07-01 10:51:24 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-02 22:29:13 +0100 |
commit | 226ae9288e88bb67a6d48b64ab5a68dc1da12a7d (patch) | |
tree | b52e74bdb19b932d303d63cc1048ade39217fca9 /meta/classes | |
parent | cd000e08b87a78a2ac48e383f5c1e8c80a174132 (diff) | |
download | poky-226ae9288e88bb67a6d48b64ab5a68dc1da12a7d.tar.gz |
classes/create-spdx-2.2: Handle SemVer License List Versions
SPDX transitioned the license list to use SemVer visioning, (e.g.
"MAJOR.MINOR.MICRO"), but SPDX 2 only allows "MAJOR.MINOR". For maximum
compatibility, only keep the first two version numbers and discard the
rest which allows it to work with either scheme
(From OE-Core rev: 8757a5eaeaf2b9d7345212d003e5622289b123e6)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/create-spdx-2.2.bbclass | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass index 99061320e5..3bcde1acc8 100644 --- a/meta/classes/create-spdx-2.2.bbclass +++ b/meta/classes/create-spdx-2.2.bbclass | |||
@@ -376,6 +376,11 @@ def add_download_packages(d, doc, recipe): | |||
376 | # but this should be sufficient for now | 376 | # but this should be sufficient for now |
377 | doc.add_relationship(package, "BUILD_DEPENDENCY_OF", recipe) | 377 | doc.add_relationship(package, "BUILD_DEPENDENCY_OF", recipe) |
378 | 378 | ||
379 | def get_license_list_version(d): | ||
380 | # Newer versions of the SPDX license list are SemVer ("MAJOR.MINOR.MICRO"), | ||
381 | # but SPDX 2 only uses "MAJOR.MINOR". | ||
382 | return ".".join(d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"].split(".")[:2]) | ||
383 | |||
379 | 384 | ||
380 | python do_create_spdx() { | 385 | python do_create_spdx() { |
381 | from datetime import datetime, timezone | 386 | from datetime import datetime, timezone |
@@ -417,7 +422,7 @@ python do_create_spdx() { | |||
417 | doc.documentNamespace = get_namespace(d, doc.name) | 422 | doc.documentNamespace = get_namespace(d, doc.name) |
418 | doc.creationInfo.created = creation_time | 423 | doc.creationInfo.created = creation_time |
419 | doc.creationInfo.comment = "This document was created by analyzing recipe files during the build." | 424 | doc.creationInfo.comment = "This document was created by analyzing recipe files during the build." |
420 | doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"] | 425 | doc.creationInfo.licenseListVersion = get_license_list_version(d) |
421 | doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") | 426 | doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") |
422 | doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) | 427 | doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) |
423 | doc.creationInfo.creators.append("Person: N/A ()") | 428 | doc.creationInfo.creators.append("Person: N/A ()") |
@@ -521,7 +526,7 @@ python do_create_spdx() { | |||
521 | package_doc.documentNamespace = get_namespace(d, package_doc.name) | 526 | package_doc.documentNamespace = get_namespace(d, package_doc.name) |
522 | package_doc.creationInfo.created = creation_time | 527 | package_doc.creationInfo.created = creation_time |
523 | package_doc.creationInfo.comment = "This document was created by analyzing packages created during the build." | 528 | package_doc.creationInfo.comment = "This document was created by analyzing packages created during the build." |
524 | package_doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"] | 529 | package_doc.creationInfo.licenseListVersion = get_license_list_version(d) |
525 | package_doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") | 530 | package_doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") |
526 | package_doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) | 531 | package_doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) |
527 | package_doc.creationInfo.creators.append("Person: N/A ()") | 532 | package_doc.creationInfo.creators.append("Person: N/A ()") |
@@ -628,7 +633,7 @@ python do_create_runtime_spdx() { | |||
628 | runtime_doc.documentNamespace = get_namespace(localdata, runtime_doc.name) | 633 | runtime_doc.documentNamespace = get_namespace(localdata, runtime_doc.name) |
629 | runtime_doc.creationInfo.created = creation_time | 634 | runtime_doc.creationInfo.created = creation_time |
630 | runtime_doc.creationInfo.comment = "This document was created by analyzing package runtime dependencies." | 635 | runtime_doc.creationInfo.comment = "This document was created by analyzing package runtime dependencies." |
631 | runtime_doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"] | 636 | runtime_doc.creationInfo.licenseListVersion = get_license_list_version(d) |
632 | runtime_doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") | 637 | runtime_doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") |
633 | runtime_doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) | 638 | runtime_doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) |
634 | runtime_doc.creationInfo.creators.append("Person: N/A ()") | 639 | runtime_doc.creationInfo.creators.append("Person: N/A ()") |
@@ -793,7 +798,7 @@ def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages, spdx | |||
793 | doc.documentNamespace = get_namespace(d, doc.name) | 798 | doc.documentNamespace = get_namespace(d, doc.name) |
794 | doc.creationInfo.created = creation_time | 799 | doc.creationInfo.created = creation_time |
795 | doc.creationInfo.comment = "This document was created by analyzing the source of the Yocto recipe during the build." | 800 | doc.creationInfo.comment = "This document was created by analyzing the source of the Yocto recipe during the build." |
796 | doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"] | 801 | doc.creationInfo.licenseListVersion = get_license_list_version(d) |
797 | doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") | 802 | doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") |
798 | doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) | 803 | doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) |
799 | doc.creationInfo.creators.append("Person: N/A ()") | 804 | doc.creationInfo.creators.append("Person: N/A ()") |