summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhongxu <hongxu.jia@eng.windriver.com>2025-03-18 19:32:54 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-03-19 09:48:14 +0000
commitd029e4e033d7bb57e0d02eca6c112e7722c6d262 (patch)
treeb2e5f524b20b5995dd237ea4d94722561425055e
parent6ee4b8dd33e5d0727a7f8af35018ba50fe740a4b (diff)
downloadpoky-d029e4e033d7bb57e0d02eca6c112e7722c6d262.tar.gz
spdx30: test the existence of directory before walking
Due to commit [spdx30: Improve os.walk() handling][1] applied, it reported an error if walk directory failed While SPDX_INCLUDE_SOURCES = "1", if recipe does not provide sysroots, the walk in function add_package_files is broken $ echo 'SPDX_INCLUDE_SOURCES = "1"' >> conf/local.conf $ bitbake packagegroup-core-boot |DEBUG: Adding sysroot files to SPDX |ERROR: packagegroup-core-boot-1.0-r0 do_create_spdx: ERROR walking tmp/sysroots-components/intel_x86_64/packagegroup-core-boot: [Errno 2] | No such file or directory: 'tmp/sysroots-components/intel_x86_64/packagegroup-core-boot' Test the existence of directory before walking [1] https://git.openembedded.org/openembedded-core/commit/?id=86b581e80637cd8136ce7a7e95db94d9553d2f60 (From OE-Core rev: cb1792e4950d5075be9bbe4c5337a5215db9669e) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/spdx30_tasks.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index 3d80f05612..0618f2f139 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -152,6 +152,10 @@ def add_package_files(
152 spdx_files = set() 152 spdx_files = set()
153 153
154 file_counter = 1 154 file_counter = 1
155 if not os.path.exists(topdir):
156 bb.note(f"Skip {topdir}")
157 return spdx_files
158
155 for subdir, dirs, files in os.walk(topdir, onerror=walk_error): 159 for subdir, dirs, files in os.walk(topdir, onerror=walk_error):
156 dirs[:] = [d for d in dirs if d not in ignore_dirs] 160 dirs[:] = [d for d in dirs if d not in ignore_dirs]
157 if subdir == str(topdir): 161 if subdir == str(topdir):