spdx30: handle links to inaccessible locations

This is the same as e105befbe4ee0d85e94c2048a744f0373e2dbcdf on
additional place in the code.

When a link is pointing to location inaccessible to build user (e.g. "/root/something"),
filepath.is_file() throws "PermissionError: [Errno 13] Permission denied".
Fix this by first checking if it is a link.

(From OE-Core rev: 26f35f866cf7888431963cf4fc5d2019cd28de74)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Peter Marko
2025-03-20 13:15:33 +01:00
committed by Richard Purdie
parent e1a6ae2309
commit 769a4479e1

View File

@@ -1067,7 +1067,7 @@ def create_rootfs_spdx(d):
filenames.sort()
for fn in filenames:
fpath = Path(dirpath) / fn
if not fpath.is_file() or fpath.is_symlink():
if fpath.is_symlink() or not fpath.is_file():
continue
relpath = str(fpath.relative_to(image_rootfs))