diff options
author | Mark Hatle <mark.hatle@amd.com> | 2024-07-24 18:39:18 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-26 12:28:42 +0100 |
commit | edc44fcf135d13e6c514c329ad4d0538ef8faf77 (patch) | |
tree | 9c39c7d0230ee50758dd8fbcd25926c10400ca1d | |
parent | 0328f2a585be350eee229dc05c0ed8163b61b47c (diff) | |
download | poky-edc44fcf135d13e6c514c329ad4d0538ef8faf77.tar.gz |
create-spdx-*: Support multilibs via SPDX_MULTILIB_SSTATE_ARCHS
When a create-spdx-* classes is processing documents, it needs to
find the document in a path that is related to the SSTATE_ARCH
when a packge is generated. The SSTATE_ARCH can be affected by
multilib configurations, resulting is something like armv8a-mlib.
When the image (or SDK) is being generated and the components are
collected, the system has no knowledge of the multilib arch and
will fail to find it, such as:
ERROR: meta-toolchain-1.0-r0 do_populate_sdk: No SPDX file found
for package libilp32-libgcc-dbg,
False sstate:libilp32-libgcc:armv8a-ilp32-mllibilp32-elf:14.1.0:r0:armv8a-ilp32:12:
sstate:libilp32-libgcc::14.1.0:r0::12:
Adding in the new SPDX_MULTILIB_SSTATE_ARCHS will provide a full
set of SSTATE_ARCHS including ones that contain the multilib
extension which will allow create-spdx-* to correctly find the
document it is looking for. This would also be valuable to any
other function doing a similar search through SSTATE_ARCH that may
have been extended with multilib configurations.
(From OE-Core rev: f1499c36c1054fc90f7b7268cc95285f2eca72f7)
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes-recipe/populate_sdk_base.bbclass | 4 | ||||
-rw-r--r-- | meta/classes/create-spdx-2.2.bbclass | 12 | ||||
-rw-r--r-- | meta/classes/create-spdx-3.0.bbclass | 4 | ||||
-rw-r--r-- | meta/classes/spdx-common.bbclass | 2 | ||||
-rw-r--r-- | meta/lib/oe/sbom30.py | 2 |
5 files changed, 15 insertions, 9 deletions
diff --git a/meta/classes-recipe/populate_sdk_base.bbclass b/meta/classes-recipe/populate_sdk_base.bbclass index 8d79d88ebe..61a8b5e300 100644 --- a/meta/classes-recipe/populate_sdk_base.bbclass +++ b/meta/classes-recipe/populate_sdk_base.bbclass | |||
@@ -6,6 +6,10 @@ | |||
6 | 6 | ||
7 | PACKAGES = "" | 7 | PACKAGES = "" |
8 | 8 | ||
9 | # This exists as an optimization for SPDX processing to only run in image and | ||
10 | # SDK processing context. This class happens to be common to these usages. | ||
11 | SPDX_MULTILIB_SSTATE_ARCHS = "${@all_multilib_tune_values(d, 'SSTATE_ARCHS')}" | ||
12 | |||
9 | inherit image-postinst-intercepts image-artifact-names | 13 | inherit image-postinst-intercepts image-artifact-names |
10 | 14 | ||
11 | # Wildcards specifying complementary packages to install for every package that has been explicitly | 15 | # Wildcards specifying complementary packages to install for every package that has been explicitly |
diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass index 12b78cb3f6..509d3b58b6 100644 --- a/meta/classes/create-spdx-2.2.bbclass +++ b/meta/classes/create-spdx-2.2.bbclass | |||
@@ -267,7 +267,7 @@ def collect_dep_recipes(d, doc, spdx_recipe): | |||
267 | import oe.spdx_common | 267 | import oe.spdx_common |
268 | 268 | ||
269 | deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX")) | 269 | deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX")) |
270 | package_archs = d.getVar("SSTATE_ARCHS").split() | 270 | package_archs = d.getVar("SPDX_MULTILIB_SSTATE_ARCHS").split() |
271 | package_archs.reverse() | 271 | package_archs.reverse() |
272 | 272 | ||
273 | dep_recipes = [] | 273 | dep_recipes = [] |
@@ -312,7 +312,7 @@ def collect_dep_recipes(d, doc, spdx_recipe): | |||
312 | 312 | ||
313 | return dep_recipes | 313 | return dep_recipes |
314 | 314 | ||
315 | collect_dep_recipes[vardepsexclude] = "SSTATE_ARCHS" | 315 | collect_dep_recipes[vardepsexclude] = "SPDX_MULTILIB_SSTATE_ARCHS" |
316 | 316 | ||
317 | def collect_dep_sources(d, dep_recipes): | 317 | def collect_dep_sources(d, dep_recipes): |
318 | import oe.sbom | 318 | import oe.sbom |
@@ -610,7 +610,7 @@ python do_create_runtime_spdx() { | |||
610 | 610 | ||
611 | providers = oe.spdx_common.collect_package_providers(d) | 611 | providers = oe.spdx_common.collect_package_providers(d) |
612 | pkg_arch = d.getVar("SSTATE_PKGARCH") | 612 | pkg_arch = d.getVar("SSTATE_PKGARCH") |
613 | package_archs = d.getVar("SSTATE_ARCHS").split() | 613 | package_archs = d.getVar("SPDX_MULTILIB_SSTATE_ARCHS").split() |
614 | package_archs.reverse() | 614 | package_archs.reverse() |
615 | 615 | ||
616 | if not is_native: | 616 | if not is_native: |
@@ -716,7 +716,7 @@ python do_create_runtime_spdx() { | |||
716 | oe.sbom.write_doc(d, runtime_doc, pkg_arch, "runtime", spdx_deploy, indent=get_json_indent(d)) | 716 | oe.sbom.write_doc(d, runtime_doc, pkg_arch, "runtime", spdx_deploy, indent=get_json_indent(d)) |
717 | } | 717 | } |
718 | 718 | ||
719 | do_create_runtime_spdx[vardepsexclude] += "OVERRIDES SSTATE_ARCHS" | 719 | do_create_runtime_spdx[vardepsexclude] += "OVERRIDES SPDX_MULTILIB_SSTATE_ARCHS" |
720 | 720 | ||
721 | addtask do_create_runtime_spdx after do_create_spdx before do_build do_rm_work | 721 | addtask do_create_runtime_spdx after do_create_spdx before do_build do_rm_work |
722 | SSTATETASKS += "do_create_runtime_spdx" | 722 | SSTATETASKS += "do_create_runtime_spdx" |
@@ -798,7 +798,7 @@ def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages, spdx | |||
798 | import bb.compress.zstd | 798 | import bb.compress.zstd |
799 | 799 | ||
800 | providers = oe.spdx_common.collect_package_providers(d) | 800 | providers = oe.spdx_common.collect_package_providers(d) |
801 | package_archs = d.getVar("SSTATE_ARCHS").split() | 801 | package_archs = d.getVar("SPDX_MULTILIB_SSTATE_ARCHS").split() |
802 | package_archs.reverse() | 802 | package_archs.reverse() |
803 | 803 | ||
804 | creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") | 804 | creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") |
@@ -950,4 +950,4 @@ def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages, spdx | |||
950 | 950 | ||
951 | tar.addfile(info, fileobj=index_str) | 951 | tar.addfile(info, fileobj=index_str) |
952 | 952 | ||
953 | combine_spdx[vardepsexclude] += "BB_NUMBER_THREADS SSTATE_ARCHS" | 953 | combine_spdx[vardepsexclude] += "BB_NUMBER_THREADS SPDX_MULTILIB_SSTATE_ARCHS" |
diff --git a/meta/classes/create-spdx-3.0.bbclass b/meta/classes/create-spdx-3.0.bbclass index 41840d9d1a..2eb44ba808 100644 --- a/meta/classes/create-spdx-3.0.bbclass +++ b/meta/classes/create-spdx-3.0.bbclass | |||
@@ -118,7 +118,7 @@ IMAGE_CLASSES:append = " create-spdx-image-3.0" | |||
118 | 118 | ||
119 | oe.spdx30_tasks.set_timestamp_now[vardepsexclude] = "SPDX_INCLUDE_TIMESTAMPS" | 119 | oe.spdx30_tasks.set_timestamp_now[vardepsexclude] = "SPDX_INCLUDE_TIMESTAMPS" |
120 | oe.spdx30_tasks.get_package_sources_from_debug[vardepsexclude] += "STAGING_KERNEL_DIR" | 120 | oe.spdx30_tasks.get_package_sources_from_debug[vardepsexclude] += "STAGING_KERNEL_DIR" |
121 | oe.spdx30_tasks.collect_dep_objsets[vardepsexclude] = "SSTATE_ARCHS" | 121 | oe.spdx30_tasks.collect_dep_objsets[vardepsexclude] = "SPDX_MULTILIB_SSTATE_ARCHS" |
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
@@ -164,7 +164,7 @@ python do_create_package_spdx() { | |||
164 | import oe.spdx30_tasks | 164 | import oe.spdx30_tasks |
165 | oe.spdx30_tasks.create_package_spdx(d) | 165 | oe.spdx30_tasks.create_package_spdx(d) |
166 | } | 166 | } |
167 | do_create_package_spdx[vardepsexclude] += "OVERRIDES SSTATE_ARCHS" | 167 | do_create_package_spdx[vardepsexclude] += "OVERRIDES SPDX_MULTILIB_SSTATE_ARCHS" |
168 | 168 | ||
169 | addtask do_create_package_spdx after do_create_spdx before do_build do_rm_work | 169 | addtask do_create_package_spdx after do_create_spdx before do_build do_rm_work |
170 | SSTATETASKS += "do_create_package_spdx" | 170 | SSTATETASKS += "do_create_package_spdx" |
diff --git a/meta/classes/spdx-common.bbclass b/meta/classes/spdx-common.bbclass index d3110a9bdb..e1528b6d0b 100644 --- a/meta/classes/spdx-common.bbclass +++ b/meta/classes/spdx-common.bbclass | |||
@@ -37,6 +37,8 @@ SPDX_LICENSES ??= "${COREBASE}/meta/files/spdx-licenses.json" | |||
37 | 37 | ||
38 | SPDX_CUSTOM_ANNOTATION_VARS ??= "" | 38 | SPDX_CUSTOM_ANNOTATION_VARS ??= "" |
39 | 39 | ||
40 | SPDX_MULTILIB_SSTATE_ARCHS ??= "${SSTATE_ARCHS}" | ||
41 | |||
40 | python() { | 42 | python() { |
41 | import oe.spdx_common | 43 | import oe.spdx_common |
42 | oe.spdx_common.load_spdx_license_data(d) | 44 | oe.spdx_common.load_spdx_license_data(d) |
diff --git a/meta/lib/oe/sbom30.py b/meta/lib/oe/sbom30.py index 2532d19dad..27ed74f810 100644 --- a/meta/lib/oe/sbom30.py +++ b/meta/lib/oe/sbom30.py | |||
@@ -921,7 +921,7 @@ def load_jsonld_by_arch(d, arch, subdir, name, *, required=False): | |||
921 | 921 | ||
922 | 922 | ||
923 | def find_jsonld(d, subdir, name, *, required=False): | 923 | def find_jsonld(d, subdir, name, *, required=False): |
924 | package_archs = d.getVar("SSTATE_ARCHS").split() | 924 | package_archs = d.getVar("SPDX_MULTILIB_SSTATE_ARCHS").split() |
925 | package_archs.reverse() | 925 | package_archs.reverse() |
926 | 926 | ||
927 | for arch in package_archs: | 927 | for arch in package_archs: |