Skip to content

Commit e6ff5f4

Browse files
hongxu-jiarpurdie
authored andcommitted
spdx3: support to override the version of a package in SBOM 3
By default, still use ${PV} as the the version of a package in SBOM 3 $ bitbake acl $ jq . tmp/deploy/spdx/3.0.1/core2-64/packages/package-acl.spdx.json ... { "type": "software_Package", ... "name": "acl", "software_packageVersion": "2.3.2" }, ... Support to override it by setting SPDX_PACKAGE_VERSION, such as set SPDX_PACKAGE_VERSION = "${EXTENDPKGV}" in local.conf to append PR to software_packageVersion in SBOM 3 $ echo 'SPDX_PACKAGE_VERSION = "${EXTENDPKGV}"' >> conf/local.conf $ bitbake acl $ jq . tmp/deploy/spdx/3.0.1/core2-64/packages/package-acl.spdx.json ... { "type": "software_Package", ... "name": "acl", "software_packageVersion": "2.3.2-r0" }, ... Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1 parent 15f2569 commit e6ff5f4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

meta/classes/create-spdx-3.0.bbclass

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ SPDX_ON_BEHALF_OF[doc] = "The base variable name to describe the Agent on who's
113113
SPDX_PACKAGE_SUPPLIER[doc] = "The base variable name to describe the Agent who \
114114
is supplying artifacts produced by the build"
115115

116+
SPDX_PACKAGE_VERSION ??= "${PV}"
117+
SPDX_PACKAGE_VERSION[doc] = "The version of a package, software_packageVersion \
118+
in software_Package"
116119

117120
IMAGE_CLASSES:append = " create-spdx-image-3.0"
118121
SDK_CLASSES += "create-spdx-sdk-3.0"

meta/lib/oe/spdx30_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def set_var_field(var, obj, name, package=None):
606606
_id=pkg_objset.new_spdxid("package", pkg_name),
607607
creationInfo=pkg_objset.doc.creationInfo,
608608
name=pkg_name,
609-
software_packageVersion=d.getVar("PV"),
609+
software_packageVersion=d.getVar("SPDX_PACKAGE_VERSION"),
610610
)
611611
)
612612
set_timestamp_now(d, spdx_package, "builtTime")

0 commit comments

Comments
 (0)