diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-25 11:40:00 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-26 12:28:42 +0100 |
commit | 7c1de3118fef96fa899ae5365f80ea8ccb1a5876 (patch) | |
tree | 2e349c781ace5293048f618f8fa296b55eec99b9 | |
parent | 3e29ba2205e2cef66b24af33b76c49148ee4146e (diff) | |
download | poky-7c1de3118fef96fa899ae5365f80ea8ccb1a5876.tar.gz |
create-spdx-3.0/populate_sdk_base: Add SDK_CLASSES inherit mechanism to fix tarball SPDX manifests
Currently, "tarball" sdk based recipes don't generate SPDX manifests as they
don't include the rootfs generation classes. Split the SPDX 3.0 image class into
two so the SDK components can be included where needed.
To do this, introduce an SDK_CLASSES variable similar to IMAGE_CLASSES which
the SDK code can use.
Migrate testsdk usage to this.
Also move the image/sdk spdx classes to classes-recipe rather than the general classes
directory since they'd never be included on a global level.
For buildtools-tarball, it has its own testsdk functions so disable the class there as
a deferred inherit would overwrite it.
(From OE-Core rev: 662396533177b72cc1d83e95841b27f7e42dcb20)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes-recipe/create-spdx-image-3.0.bbclass (renamed from meta/classes/create-spdx-image-3.0.bbclass) | 66 | ||||
-rw-r--r-- | meta/classes-recipe/create-spdx-sdk-3.0.bbclass | 72 | ||||
-rw-r--r-- | meta/classes-recipe/populate_sdk_base.bbclass | 3 | ||||
-rw-r--r-- | meta/classes-recipe/testimage.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/create-spdx-3.0.bbclass | 1 | ||||
-rw-r--r-- | meta/recipes-core/meta/buildtools-tarball.bb | 3 |
6 files changed, 79 insertions, 68 deletions
diff --git a/meta/classes/create-spdx-image-3.0.bbclass b/meta/classes-recipe/create-spdx-image-3.0.bbclass index 1cad8537d1..fcae134d66 100644 --- a/meta/classes/create-spdx-image-3.0.bbclass +++ b/meta/classes-recipe/create-spdx-image-3.0.bbclass | |||
@@ -77,69 +77,3 @@ python do_create_image_sbom_spdx_setscene() { | |||
77 | sstate_setscene(d) | 77 | sstate_setscene(d) |
78 | } | 78 | } |
79 | addtask do_create_image_sbom_spdx_setscene | 79 | addtask do_create_image_sbom_spdx_setscene |
80 | |||
81 | do_populate_sdk[recrdeptask] += "do_create_spdx do_create_package_spdx" | ||
82 | do_populate_sdk[cleandirs] += "${SPDXSDKWORK}" | ||
83 | do_populate_sdk[postfuncs] += "sdk_create_sbom" | ||
84 | POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " sdk_host_create_spdx" | ||
85 | POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " sdk_target_create_spdx" | ||
86 | |||
87 | do_populate_sdk_ext[recrdeptask] += "do_create_spdx do_create_package_spdx" | ||
88 | do_populate_sdk_ext[cleandirs] += "${SPDXSDKEXTWORK}" | ||
89 | do_populate_sdk_ext[postfuncs] += "sdk_ext_create_sbom" | ||
90 | POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk-ext = " sdk_ext_host_create_spdx" | ||
91 | POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk-ext = " sdk_ext_target_create_spdx" | ||
92 | |||
93 | python sdk_host_create_spdx() { | ||
94 | from pathlib import Path | ||
95 | import oe.spdx30_tasks | ||
96 | spdx_work_dir = Path(d.getVar('SPDXSDKWORK')) | ||
97 | |||
98 | oe.spdx30_tasks.sdk_create_spdx(d, "host", spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME")) | ||
99 | } | ||
100 | |||
101 | python sdk_target_create_spdx() { | ||
102 | from pathlib import Path | ||
103 | import oe.spdx30_tasks | ||
104 | spdx_work_dir = Path(d.getVar('SPDXSDKWORK')) | ||
105 | |||
106 | oe.spdx30_tasks.sdk_create_spdx(d, "target", spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME")) | ||
107 | } | ||
108 | |||
109 | python sdk_ext_host_create_spdx() { | ||
110 | from pathlib import Path | ||
111 | import oe.spdx30_tasks | ||
112 | spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK')) | ||
113 | |||
114 | # TODO: This doesn't seem to work | ||
115 | oe.spdx30_tasks.sdk_create_spdx(d, "host", spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME")) | ||
116 | } | ||
117 | |||
118 | python sdk_ext_target_create_spdx() { | ||
119 | from pathlib import Path | ||
120 | import oe.spdx30_tasks | ||
121 | spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK')) | ||
122 | |||
123 | # TODO: This doesn't seem to work | ||
124 | oe.spdx30_tasks.sdk_create_spdx(d, "target", spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME")) | ||
125 | } | ||
126 | |||
127 | |||
128 | python sdk_create_sbom() { | ||
129 | from pathlib import Path | ||
130 | import oe.spdx30_tasks | ||
131 | sdk_deploydir = Path(d.getVar("SDKDEPLOYDIR")) | ||
132 | spdx_work_dir = Path(d.getVar('SPDXSDKWORK')) | ||
133 | |||
134 | oe.spdx30_tasks.create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME")) | ||
135 | } | ||
136 | |||
137 | python sdk_ext_create_sbom() { | ||
138 | from pathlib import Path | ||
139 | import oe.spdx30_tasks | ||
140 | sdk_deploydir = Path(d.getVar("SDKEXTDEPLOYDIR")) | ||
141 | spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK')) | ||
142 | |||
143 | oe.spdx30_tasks.create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME")) | ||
144 | } | ||
145 | |||
diff --git a/meta/classes-recipe/create-spdx-sdk-3.0.bbclass b/meta/classes-recipe/create-spdx-sdk-3.0.bbclass new file mode 100644 index 0000000000..ea01a21cc5 --- /dev/null +++ b/meta/classes-recipe/create-spdx-sdk-3.0.bbclass | |||
@@ -0,0 +1,72 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: GPL-2.0-only | ||
5 | # | ||
6 | # SPDX SDK tasks | ||
7 | |||
8 | do_populate_sdk[recrdeptask] += "do_create_spdx do_create_package_spdx" | ||
9 | do_populate_sdk[cleandirs] += "${SPDXSDKWORK}" | ||
10 | do_populate_sdk[postfuncs] += "sdk_create_sbom" | ||
11 | POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " sdk_host_create_spdx" | ||
12 | POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " sdk_target_create_spdx" | ||
13 | |||
14 | do_populate_sdk_ext[recrdeptask] += "do_create_spdx do_create_package_spdx" | ||
15 | do_populate_sdk_ext[cleandirs] += "${SPDXSDKEXTWORK}" | ||
16 | do_populate_sdk_ext[postfuncs] += "sdk_ext_create_sbom" | ||
17 | POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk-ext = " sdk_ext_host_create_spdx" | ||
18 | POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk-ext = " sdk_ext_target_create_spdx" | ||
19 | |||
20 | python sdk_host_create_spdx() { | ||
21 | from pathlib import Path | ||
22 | import oe.spdx30_tasks | ||
23 | spdx_work_dir = Path(d.getVar('SPDXSDKWORK')) | ||
24 | |||
25 | oe.spdx30_tasks.sdk_create_spdx(d, "host", spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME")) | ||
26 | } | ||
27 | |||
28 | python sdk_target_create_spdx() { | ||
29 | from pathlib import Path | ||
30 | import oe.spdx30_tasks | ||
31 | spdx_work_dir = Path(d.getVar('SPDXSDKWORK')) | ||
32 | |||
33 | oe.spdx30_tasks.sdk_create_spdx(d, "target", spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME")) | ||
34 | } | ||
35 | |||
36 | python sdk_ext_host_create_spdx() { | ||
37 | from pathlib import Path | ||
38 | import oe.spdx30_tasks | ||
39 | spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK')) | ||
40 | |||
41 | # TODO: This doesn't seem to work | ||
42 | oe.spdx30_tasks.sdk_create_spdx(d, "host", spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME")) | ||
43 | } | ||
44 | |||
45 | python sdk_ext_target_create_spdx() { | ||
46 | from pathlib import Path | ||
47 | import oe.spdx30_tasks | ||
48 | spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK')) | ||
49 | |||
50 | # TODO: This doesn't seem to work | ||
51 | oe.spdx30_tasks.sdk_create_spdx(d, "target", spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME")) | ||
52 | } | ||
53 | |||
54 | |||
55 | python sdk_create_sbom() { | ||
56 | from pathlib import Path | ||
57 | import oe.spdx30_tasks | ||
58 | sdk_deploydir = Path(d.getVar("SDKDEPLOYDIR")) | ||
59 | spdx_work_dir = Path(d.getVar('SPDXSDKWORK')) | ||
60 | |||
61 | oe.spdx30_tasks.create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME")) | ||
62 | } | ||
63 | |||
64 | python sdk_ext_create_sbom() { | ||
65 | from pathlib import Path | ||
66 | import oe.spdx30_tasks | ||
67 | sdk_deploydir = Path(d.getVar("SDKEXTDEPLOYDIR")) | ||
68 | spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK')) | ||
69 | |||
70 | oe.spdx30_tasks.create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME")) | ||
71 | } | ||
72 | |||
diff --git a/meta/classes-recipe/populate_sdk_base.bbclass b/meta/classes-recipe/populate_sdk_base.bbclass index 61a8b5e300..50bb81cd04 100644 --- a/meta/classes-recipe/populate_sdk_base.bbclass +++ b/meta/classes-recipe/populate_sdk_base.bbclass | |||
@@ -4,6 +4,9 @@ | |||
4 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
5 | # | 5 | # |
6 | 6 | ||
7 | SDK_CLASSES += "${@bb.utils.contains("IMAGE_CLASSES", "testimage", "testsdk", "", d)}" | ||
8 | inherit_defer ${SDK_CLASSES} | ||
9 | |||
7 | PACKAGES = "" | 10 | PACKAGES = "" |
8 | 11 | ||
9 | # This exists as an optimization for SPDX processing to only run in image and | 12 | # This exists as an optimization for SPDX processing to only run in image and |
diff --git a/meta/classes-recipe/testimage.bbclass b/meta/classes-recipe/testimage.bbclass index 531330f384..6d1e1a107a 100644 --- a/meta/classes-recipe/testimage.bbclass +++ b/meta/classes-recipe/testimage.bbclass | |||
@@ -483,5 +483,3 @@ python () { | |||
483 | if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"): | 483 | if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"): |
484 | bb.build.addtask("testimage", "do_build", "do_image_complete", d) | 484 | bb.build.addtask("testimage", "do_build", "do_image_complete", d) |
485 | } | 485 | } |
486 | |||
487 | inherit testsdk | ||
diff --git a/meta/classes/create-spdx-3.0.bbclass b/meta/classes/create-spdx-3.0.bbclass index 2eb44ba808..c1241e5856 100644 --- a/meta/classes/create-spdx-3.0.bbclass +++ b/meta/classes/create-spdx-3.0.bbclass | |||
@@ -115,6 +115,7 @@ SPDX_PACKAGE_SUPPLIER[doc] = "The base variable name to describe the Agent who \ | |||
115 | 115 | ||
116 | 116 | ||
117 | IMAGE_CLASSES:append = " create-spdx-image-3.0" | 117 | IMAGE_CLASSES:append = " create-spdx-image-3.0" |
118 | SDK_CLASSES += "create-spdx-sdk-3.0" | ||
118 | 119 | ||
119 | oe.spdx30_tasks.set_timestamp_now[vardepsexclude] = "SPDX_INCLUDE_TIMESTAMPS" | 120 | oe.spdx30_tasks.set_timestamp_now[vardepsexclude] = "SPDX_INCLUDE_TIMESTAMPS" |
120 | oe.spdx30_tasks.get_package_sources_from_debug[vardepsexclude] += "STAGING_KERNEL_DIR" | 121 | oe.spdx30_tasks.get_package_sources_from_debug[vardepsexclude] += "STAGING_KERNEL_DIR" |
diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb index 92fbda335d..e2ce5b3ecf 100644 --- a/meta/recipes-core/meta/buildtools-tarball.bb +++ b/meta/recipes-core/meta/buildtools-tarball.bb | |||
@@ -112,6 +112,9 @@ INHIBIT_DEFAULT_DEPS = "1" | |||
112 | # Directory in testsdk that contains testcases | 112 | # Directory in testsdk that contains testcases |
113 | TESTSDK_CASES = "buildtools-cases" | 113 | TESTSDK_CASES = "buildtools-cases" |
114 | 114 | ||
115 | # We have our own code, avoid deferred inherit | ||
116 | SDK_CLASSES:remove = "testsdk" | ||
117 | |||
115 | python do_testsdk() { | 118 | python do_testsdk() { |
116 | import oeqa.sdk.testsdk | 119 | import oeqa.sdk.testsdk |
117 | testsdk = oeqa.sdk.testsdk.TestSDK() | 120 | testsdk = oeqa.sdk.testsdk.TestSDK() |