mirror of
https://git.yoctoproject.org/poky
synced 2026-03-30 17:02:22 +02:00
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>
80 lines
2.7 KiB
Plaintext
80 lines
2.7 KiB
Plaintext
#
|
|
# Copyright OpenEmbedded Contributors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
# SPDX image tasks
|
|
|
|
SPDX_ROOTFS_PACKAGES = "${SPDXDIR}/rootfs-packages.json"
|
|
SPDXIMAGEDEPLOYDIR = "${SPDXDIR}/image-deploy"
|
|
SPDXROOTFSDEPLOY = "${SPDXDIR}/rootfs-deploy"
|
|
|
|
python spdx_collect_rootfs_packages() {
|
|
import json
|
|
from pathlib import Path
|
|
from oe.rootfs import image_list_installed_packages
|
|
|
|
root_packages_file = Path(d.getVar("SPDX_ROOTFS_PACKAGES"))
|
|
|
|
packages = image_list_installed_packages(d)
|
|
if not packages:
|
|
packages = {}
|
|
|
|
root_packages_file.parent.mkdir(parents=True, exist_ok=True)
|
|
with root_packages_file.open("w") as f:
|
|
json.dump(packages, f)
|
|
}
|
|
ROOTFS_POSTUNINSTALL_COMMAND =+ "spdx_collect_rootfs_packages"
|
|
|
|
python do_create_rootfs_spdx() {
|
|
import oe.spdx30_tasks
|
|
oe.spdx30_tasks.create_rootfs_spdx(d)
|
|
}
|
|
addtask do_create_rootfs_spdx after do_rootfs before do_image
|
|
SSTATETASKS += "do_create_rootfs_spdx"
|
|
do_create_rootfs_spdx[sstate-inputdirs] = "${SPDXROOTFSDEPLOY}"
|
|
do_create_rootfs_spdx[sstate-outputdirs] = "${DEPLOY_DIR_SPDX}"
|
|
do_create_rootfs_spdx[recrdeptask] += "do_create_spdx do_create_package_spdx"
|
|
do_create_rootfs_spdx[cleandirs] += "${SPDXROOTFSDEPLOY}"
|
|
|
|
python do_create_rootfs_spdx_setscene() {
|
|
sstate_setscene(d)
|
|
}
|
|
addtask do_create_rootfs_spdx_setscene
|
|
|
|
python do_create_image_spdx() {
|
|
import oe.spdx30_tasks
|
|
oe.spdx30_tasks.create_image_spdx(d)
|
|
}
|
|
addtask do_create_image_spdx after do_image_complete do_create_rootfs_spdx before do_build
|
|
SSTATETASKS += "do_create_image_spdx"
|
|
SSTATE_SKIP_CREATION:task-combine-image-type-spdx = "1"
|
|
do_create_image_spdx[sstate-inputdirs] = "${SPDXIMAGEWORK}"
|
|
do_create_image_spdx[sstate-outputdirs] = "${DEPLOY_DIR_SPDX}"
|
|
do_create_image_spdx[cleandirs] = "${SPDXIMAGEWORK}"
|
|
do_create_image_spdx[dirs] = "${SPDXIMAGEWORK}"
|
|
|
|
python do_create_image_spdx_setscene() {
|
|
sstate_setscene(d)
|
|
}
|
|
addtask do_create_image_spdx_setscene
|
|
|
|
|
|
python do_create_image_sbom_spdx() {
|
|
import oe.spdx30_tasks
|
|
oe.spdx30_tasks.create_image_sbom_spdx(d)
|
|
}
|
|
addtask do_create_image_sbom_spdx after do_create_rootfs_spdx do_create_image_spdx before do_build
|
|
SSTATETASKS += "do_create_image_sbom_spdx"
|
|
SSTATE_SKIP_CREATION:task-create-image-sbom = "1"
|
|
do_create_image_sbom_spdx[sstate-inputdirs] = "${SPDXIMAGEDEPLOYDIR}"
|
|
do_create_image_sbom_spdx[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
|
|
do_create_image_sbom_spdx[stamp-extra-info] = "${MACHINE_ARCH}"
|
|
do_create_image_sbom_spdx[cleandirs] = "${SPDXIMAGEDEPLOYDIR}"
|
|
do_create_image_sbom_spdx[recrdeptask] += "do_create_spdx do_create_package_spdx"
|
|
|
|
python do_create_image_sbom_spdx_setscene() {
|
|
sstate_setscene(d)
|
|
}
|
|
addtask do_create_image_sbom_spdx_setscene
|