[PATCH v2 15/18] spdx-common: Declare SPDX_FORCE_*_SCOPE override variables

Stefano Tondo
2026-02-21T05:10:43Z

Add bbclass variable declarations for SPDX_FORCE_BUILD_SCOPE,
SPDX_FORCE_TEST_SCOPE, and SPDX_FORCE_RUNTIME_SCOPE. These optional
variables allow recipes to override the automatic lifecycle scope
classification for dependency relationships.

The scope classification code in spdx30_tasks.py already handles these
variables gracefully when unset. These declarations provide discoverability
and documentation for users who need to correct edge cases in automatic
scope detection.

Signed-off-by: Stefano Tondo <stefano.tondo.ext@siemens.com>
---
meta/classes/spdx-common.bbclass | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/meta/classes/spdx-common.bbclass b/meta/classes/spdx-common.bbclass
index 81c61e10dc..99f0704caf 100644
--- a/meta/classes/spdx-common.bbclass
+++ b/meta/classes/spdx-common.bbclass
@@ -52,6 +52,19 @@ SPDX_CONCLUDED_LICENSE[doc] = "The license concluded by manual or external \
Example: SPDX_CONCLUDED_LICENSE = 'MIT & Apache-2.0' or \
SPDX_CONCLUDED_LICENSE:${PN} = 'MIT & Apache-2.0'"

+# Lifecycle scope override variables for dependency classification
+SPDX_FORCE_BUILD_SCOPE ??= ""
+SPDX_FORCE_BUILD_SCOPE[doc] = "Space-separated list of recipe names to force \
+ into build scope, overriding automatic dependency classification."
+
+SPDX_FORCE_TEST_SCOPE ??= ""
+SPDX_FORCE_TEST_SCOPE[doc] = "Space-separated list of recipe names to force \
+ into test scope. By default, test dependencies are classified as build."
+
+SPDX_FORCE_RUNTIME_SCOPE ??= ""
+SPDX_FORCE_RUNTIME_SCOPE[doc] = "Space-separated list of recipe names to force \
+ into runtime scope, overriding automatic dependency classification."
+
SPDX_MULTILIB_SSTATE_ARCHS ??= "${SSTATE_ARCHS}"

SPDX_FILES_INCLUDED ??= "all"
--
2.53.0