While two projects share one sstate cache, the 1st project builds kernel-devsrc 
without
setting SPDX_INCLUDE_SOURCES, and 2nd project build kernel-devsrc with setting
SPDX_INCLUDE_SOURCES = "1". Then the 2nd build failed with kernel-source not 
found

1. In 1st build
$ cd path-to-first-build
$ bitbake kernel-devsrc

2. In 2nd build, share sstate cache of 1st build and SPDX_INCLUDE_SOURCES = "1"
$ cd path-to-second-build
$ echo 'SSTATE_DIR = "path-to-first-build/sstate-cache"' >> conf/local.conf
$ echo 'SPDX_INCLUDE_SOURCES = "1"'  >> conf/local.conf
$ bitbake kernel-devsrc
...
NOTE: copyhardlinktree 
path-to-second-build/tmp-glibc/work-shared/axxiaarm64/kernel-source to 
path-to-second-build/tmp-glibc/work/axxiaarm64-wrs-linux/kernel-devsrc/1.0/spdx/3.0.1/work/kernel-source
ERROR: Error executing a python function in exec_func_python() autogenerated:
...
     0208:            bb.note(f"copyhardlinktree {share_src} to {src_dir}")
 *** 0209:            oe.path.copyhardlinktree(share_src, src_dir)
...
tar: path-to-second-build/tmp-glibc/work-shared/axxiaarm64/kernel-source: 
Cannot open: No such file or directory
...

The recipe kernel-devsrc or the recipe to inherit kernelsrc.bbclass, they do not
have task do_shared_workdir but depends on virtual/kernel:do_shared_workdir.

In this situation(the ${S} == ${STAGING_KERNEL_DIR}), explicitly make 
do_create_spdx
depends on virtual/kernel:do_shared_workdir could fix the racing issue

Signed-off-by: Hongxu Jia <[email protected]>
---
 meta/classes/spdx-common.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes/spdx-common.bbclass b/meta/classes/spdx-common.bbclass
index d3cdc8b6ce..81ad4d3b7a 100644
--- a/meta/classes/spdx-common.bbclass
+++ b/meta/classes/spdx-common.bbclass
@@ -56,6 +56,8 @@ def create_spdx_source_deps(d):
             # For kernel source code
             if oe.spdx_common.has_task(d, "do_shared_workdir"):
                 deps.append("%s:do_shared_workdir" % pn)
+            elif d.getVar('S') == d.getVar('STAGING_KERNEL_DIR'):
+                deps.append("virtual/kernel:do_shared_workdir")
 
             # For gcc-source-${PV} source code
             if oe.spdx_common.has_task(d, "do_preconfigure"):
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#206836): 
https://lists.openembedded.org/g/openembedded-core/message/206836
Mute This Topic: https://lists.openembedded.org/mt/109445005/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to