[OE-core][PATCH v5 12/13] spdx3: Use common variable for vardeps

Joshua Watt
2026-03-04T16:48:57Z

Instead of repeating the vardeps for each SPDX task with the necessary
variables, use a common variable to make it easier to manage

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
meta/classes/create-spdx-3.0.bbclass | 33 ++++++++++------------------
1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/meta/classes/create-spdx-3.0.bbclass b/meta/classes/create-spdx-3.0.bbclass
index 88b7ef9f42..6df66c193b 100644
--- a/meta/classes/create-spdx-3.0.bbclass
+++ b/meta/classes/create-spdx-3.0.bbclass
@@ -174,6 +174,14 @@ SPDX3_DEP_FILES = "\
${SPDX_LICENSES}:True \
"

+SPDX3_VAR_DEPS = "\
+ SPDX_INCLUDE_BITBAKE_PARENT_BUILD \
+ SPDX_PACKAGE_ADDITIONAL_PURPOSE \
+ SPDX_PROFILES \
+ SPDX_NAMESPACE_PREFIX \
+ SPDX_UUID_NAMESPACE \
+ "
+
python do_create_recipe_spdx() {
import oe.spdx30_tasks
oe.spdx30_tasks.create_recipe_spdx(d)
@@ -185,13 +193,7 @@ do_create_recipe_spdx[sstate-inputdirs] = "${SPDXRECIPEDEPLOY}"
do_create_recipe_spdx[sstate-outputdirs] = "${DEPLOY_DIR_SPDX}"
do_create_recipe_spdx[file-checksums] += "${SPDX3_DEP_FILES}"
do_create_recipe_spdx[cleandirs] = "${SPDXRECIPEDEPLOY}"
-do_create_recipe_spdx[vardeps] += "\
- SPDX_INCLUDE_BITBAKE_PARENT_BUILD \
- SPDX_PACKAGE_ADDITIONAL_PURPOSE \
- SPDX_PROFILES \
- SPDX_NAMESPACE_PREFIX \
- SPDX_UUID_NAMESPACE \
- "
+do_create_recipe_spdx[vardeps] += "${SPDX3_VAR_DEPS}"

python do_create_recipe_spdx_setscene () {
sstate_setscene(d)
@@ -222,13 +224,7 @@ do_create_spdx[depends] += " \
${PATCHDEPENDENCY} \
${@create_spdx_source_deps(d)} \
"
-do_create_spdx[vardeps] += "\
- SPDX_INCLUDE_BITBAKE_PARENT_BUILD \
- SPDX_PACKAGE_ADDITIONAL_PURPOSE \
- SPDX_PROFILES \
- SPDX_NAMESPACE_PREFIX \
- SPDX_UUID_NAMESPACE \
- "
+do_create_spdx[vardeps] += "${SPDX3_VAR_DEPS}"

python do_create_spdx_setscene () {
sstate_setscene(d)
@@ -249,6 +245,7 @@ do_create_package_spdx[file-checksums] += "${SPDX3_DEP_FILES}"
do_create_package_spdx[dirs] = "${SPDXRUNTIMEDEPLOY}"
do_create_package_spdx[cleandirs] = "${SPDXRUNTIMEDEPLOY}"
do_create_package_spdx[rdeptask] = "do_create_spdx"
+do_create_package_spdx[vardeps] += "${SPDX3_VAR_DEPS}"

python do_create_package_spdx_setscene () {
sstate_setscene(d)
@@ -270,13 +267,7 @@ do_create_recipe_sbom[sstate-inputdirs] = "${SPDXRECIPESBOMDEPLOY}"
do_create_recipe_sbom[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
do_create_recipe_sbom[file-checksums] += "${SPDX3_DEP_FILES}"
do_create_recipe_sbom[cleandirs] = "${SPDXRECIPESBOMDEPLOY}"
-do_create_recipe_sbom[vardeps] += "\
- SPDX_INCLUDE_BITBAKE_PARENT_BUILD \
- SPDX_PACKAGE_ADDITIONAL_PURPOSE \
- SPDX_PROFILES \
- SPDX_NAMESPACE_PREFIX \
- SPDX_UUID_NAMESPACE \
- "
+do_create_recipe_sbom[vardeps] += "${SPDX3_VAR_DEPS}"

python do_create_recipe_sbom_setscene () {
sstate_setscene(d)
--
2.53.0