]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
spdx30: handle links to inaccessible locations
authorPeter Marko <peter.marko@siemens.com>
Thu, 20 Mar 2025 12:15:33 +0000 (13:15 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 20 Mar 2025 17:47:55 +0000 (17:47 +0000)
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.

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/spdx30_tasks.py

index 1841b0de4ae91c5775101339f933f25aeee4c946..1629ed69cee6dbf5a1e94bb289832f63c83290bc 100644 (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))