mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
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>
This commit is contained in:
@@ -77,69 +77,3 @@ python do_create_image_sbom_spdx_setscene() {
|
||||
sstate_setscene(d)
|
||||
}
|
||||
addtask do_create_image_sbom_spdx_setscene
|
||||
|
||||
do_populate_sdk[recrdeptask] += "do_create_spdx do_create_package_spdx"
|
||||
do_populate_sdk[cleandirs] += "${SPDXSDKWORK}"
|
||||
do_populate_sdk[postfuncs] += "sdk_create_sbom"
|
||||
POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " sdk_host_create_spdx"
|
||||
POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " sdk_target_create_spdx"
|
||||
|
||||
do_populate_sdk_ext[recrdeptask] += "do_create_spdx do_create_package_spdx"
|
||||
do_populate_sdk_ext[cleandirs] += "${SPDXSDKEXTWORK}"
|
||||
do_populate_sdk_ext[postfuncs] += "sdk_ext_create_sbom"
|
||||
POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk-ext = " sdk_ext_host_create_spdx"
|
||||
POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk-ext = " sdk_ext_target_create_spdx"
|
||||
|
||||
python sdk_host_create_spdx() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKWORK'))
|
||||
|
||||
oe.spdx30_tasks.sdk_create_spdx(d, "host", spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
python sdk_target_create_spdx() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKWORK'))
|
||||
|
||||
oe.spdx30_tasks.sdk_create_spdx(d, "target", spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
python sdk_ext_host_create_spdx() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK'))
|
||||
|
||||
# TODO: This doesn't seem to work
|
||||
oe.spdx30_tasks.sdk_create_spdx(d, "host", spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
python sdk_ext_target_create_spdx() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK'))
|
||||
|
||||
# TODO: This doesn't seem to work
|
||||
oe.spdx30_tasks.sdk_create_spdx(d, "target", spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
|
||||
python sdk_create_sbom() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
sdk_deploydir = Path(d.getVar("SDKDEPLOYDIR"))
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKWORK'))
|
||||
|
||||
oe.spdx30_tasks.create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
python sdk_ext_create_sbom() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
sdk_deploydir = Path(d.getVar("SDKEXTDEPLOYDIR"))
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK'))
|
||||
|
||||
oe.spdx30_tasks.create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
72
meta/classes-recipe/create-spdx-sdk-3.0.bbclass
Normal file
72
meta/classes-recipe/create-spdx-sdk-3.0.bbclass
Normal file
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# Copyright OpenEmbedded Contributors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# SPDX SDK tasks
|
||||
|
||||
do_populate_sdk[recrdeptask] += "do_create_spdx do_create_package_spdx"
|
||||
do_populate_sdk[cleandirs] += "${SPDXSDKWORK}"
|
||||
do_populate_sdk[postfuncs] += "sdk_create_sbom"
|
||||
POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " sdk_host_create_spdx"
|
||||
POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " sdk_target_create_spdx"
|
||||
|
||||
do_populate_sdk_ext[recrdeptask] += "do_create_spdx do_create_package_spdx"
|
||||
do_populate_sdk_ext[cleandirs] += "${SPDXSDKEXTWORK}"
|
||||
do_populate_sdk_ext[postfuncs] += "sdk_ext_create_sbom"
|
||||
POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk-ext = " sdk_ext_host_create_spdx"
|
||||
POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk-ext = " sdk_ext_target_create_spdx"
|
||||
|
||||
python sdk_host_create_spdx() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKWORK'))
|
||||
|
||||
oe.spdx30_tasks.sdk_create_spdx(d, "host", spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
python sdk_target_create_spdx() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKWORK'))
|
||||
|
||||
oe.spdx30_tasks.sdk_create_spdx(d, "target", spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
python sdk_ext_host_create_spdx() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK'))
|
||||
|
||||
# TODO: This doesn't seem to work
|
||||
oe.spdx30_tasks.sdk_create_spdx(d, "host", spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
python sdk_ext_target_create_spdx() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK'))
|
||||
|
||||
# TODO: This doesn't seem to work
|
||||
oe.spdx30_tasks.sdk_create_spdx(d, "target", spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
|
||||
python sdk_create_sbom() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
sdk_deploydir = Path(d.getVar("SDKDEPLOYDIR"))
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKWORK'))
|
||||
|
||||
oe.spdx30_tasks.create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, d.getVar("TOOLCHAIN_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
python sdk_ext_create_sbom() {
|
||||
from pathlib import Path
|
||||
import oe.spdx30_tasks
|
||||
sdk_deploydir = Path(d.getVar("SDKEXTDEPLOYDIR"))
|
||||
spdx_work_dir = Path(d.getVar('SPDXSDKEXTWORK'))
|
||||
|
||||
oe.spdx30_tasks.create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, d.getVar("TOOLCHAINEXT_OUTPUTNAME"))
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
SDK_CLASSES += "${@bb.utils.contains("IMAGE_CLASSES", "testimage", "testsdk", "", d)}"
|
||||
inherit_defer ${SDK_CLASSES}
|
||||
|
||||
PACKAGES = ""
|
||||
|
||||
# This exists as an optimization for SPDX processing to only run in image and
|
||||
|
||||
@@ -483,5 +483,3 @@ python () {
|
||||
if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"):
|
||||
bb.build.addtask("testimage", "do_build", "do_image_complete", d)
|
||||
}
|
||||
|
||||
inherit testsdk
|
||||
|
||||
@@ -115,6 +115,7 @@ SPDX_PACKAGE_SUPPLIER[doc] = "The base variable name to describe the Agent who \
|
||||
|
||||
|
||||
IMAGE_CLASSES:append = " create-spdx-image-3.0"
|
||||
SDK_CLASSES += "create-spdx-sdk-3.0"
|
||||
|
||||
oe.spdx30_tasks.set_timestamp_now[vardepsexclude] = "SPDX_INCLUDE_TIMESTAMPS"
|
||||
oe.spdx30_tasks.get_package_sources_from_debug[vardepsexclude] += "STAGING_KERNEL_DIR"
|
||||
|
||||
@@ -112,6 +112,9 @@ INHIBIT_DEFAULT_DEPS = "1"
|
||||
# Directory in testsdk that contains testcases
|
||||
TESTSDK_CASES = "buildtools-cases"
|
||||
|
||||
# We have our own code, avoid deferred inherit
|
||||
SDK_CLASSES:remove = "testsdk"
|
||||
|
||||
python do_testsdk() {
|
||||
import oeqa.sdk.testsdk
|
||||
testsdk = oeqa.sdk.testsdk.TestSDK()
|
||||
|
||||
Reference in New Issue
Block a user