@@ -584,7 +584,10 @@ addtask do_create_spdx_setscene
do_create_spdx[dirs] = "${SPDXWORK}"
do_create_spdx[cleandirs] = "${SPDXDEPLOY} ${SPDXWORK}"
-do_create_spdx[depends] += "${PATCHDEPENDENCY}"
+do_create_spdx[depends] += " \
+ ${PATCHDEPENDENCY} \
+ ${@create_spdx_source_deps(d)} \
+"
python do_create_runtime_spdx() {
from datetime import datetime, timezone
@@ -132,22 +132,8 @@ addtask do_create_spdx after \
do_collect_spdx_deps \
do_deploy_source_date_epoch \
do_populate_sysroot do_package do_packagedata \
- ${create_spdx_source_deps(d)} \
before do_populate_sdk do_populate_sdk_ext do_build do_rm_work
-def create_spdx_source_deps(d):
- deps = []
- if d.getVar("SPDX_INCLUDE_SOURCES") == "1":
- deps.extend([
- # do_unpack is a hack for now; we only need it to get the
- # dependencies do_unpack already has so we can extract the source
- # ourselves
- "do_unpack",
- # For kernel source code
- "do_shared_workdir",
- ])
- return " ".join(deps)
-
SSTATETASKS += "do_create_spdx"
do_create_spdx[sstate-inputdirs] = "${SPDXDEPLOY}"
do_create_spdx[sstate-outputdirs] = "${DEPLOY_DIR_SPDX}"
@@ -159,7 +145,10 @@ addtask do_create_spdx_setscene
do_create_spdx[dirs] = "${SPDXWORK}"
do_create_spdx[cleandirs] = "${SPDXDEPLOY} ${SPDXWORK}"
-do_create_spdx[depends] += "${PATCHDEPENDENCY}"
+do_create_spdx[depends] += " \
+ ${PATCHDEPENDENCY} \
+ ${@create_spdx_source_deps(d)} \
+"
python do_create_package_spdx() {
import oe.spdx30_tasks
@@ -39,6 +39,27 @@ SPDX_CUSTOM_ANNOTATION_VARS ??= ""
SPDX_MULTILIB_SSTATE_ARCHS ??= "${SSTATE_ARCHS}"
+def create_spdx_source_deps(d):
+ import oe.spdx_common
+
+ deps = []
+ if d.getVar("SPDX_INCLUDE_SOURCES") == "1":
+ pn = d.getVar('PN')
+ # do_unpack is a hack for now; we only need it to get the
+ # dependencies do_unpack already has so we can extract the source
+ # ourselves
+ if oe.spdx_common.has_task(d, "do_unpack"):
+ deps.append("%s:do_unpack" % pn)
+
+ if oe.spdx_common.is_work_shared_spdx(d) and \
+ oe.spdx_common.process_sources(d):
+ # For kernel source code
+ if oe.spdx_common.has_task(d, "do_shared_workdir"):
+ deps.append("%s:do_shared_workdir" % pn)
+
+ return " ".join(deps)
+
+
python do_collect_spdx_deps() {
# This task calculates the build time dependencies of the recipe, and is
# required because while a task can deptask on itself, those dependencies
@@ -226,6 +226,10 @@ def get_patched_src(d):
d.setVar("WORKDIR", workdir)
+def has_task(d, task):
+ return bool(d.getVarFlag(task, "task", False)) and not bool(d.getVarFlag(task, "noexec", False))
+
+
def fetch_data_to_uri(fd, name):
"""
Translates a bitbake FetchData to a string URI
Call function ${@create_spdx_source_deps(d)} or ${create_spdx_source_deps(d)} along with addtask not working, use task do_create_spdx flag 'depends' to instead Move function create_spdx_source_deps to spdx-common.bbclass for both of create-spdx-2.2.bbclass and create-spdx-3.0.bbclass Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/classes/create-spdx-2.2.bbclass | 5 ++++- meta/classes/create-spdx-3.0.bbclass | 19 ++++--------------- meta/classes/spdx-common.bbclass | 21 +++++++++++++++++++++ meta/lib/oe/spdx_common.py | 4 ++++ 4 files changed, 33 insertions(+), 16 deletions(-)