]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
create-spdx: handle links to inaccessible locations
authorPeter Marko <peter.marko@siemens.com>
Thu, 11 Aug 2022 12:35:13 +0000 (14:35 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 14 Aug 2022 07:11:14 +0000 (08:11 +0100)
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: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/create-spdx.bbclass

index 383ca10bab30f2c2d5c348bf89c7575930536945..47dd12c3834b8090958a2c1acaba141898ebdc55 100644 (file)
@@ -218,7 +218,7 @@ def add_package_files(d, doc, spdx_pkg, topdir, get_spdxid, get_types, *, archiv
             filepath = Path(subdir) / file
             filename = str(filepath.relative_to(topdir))
 
-            if filepath.is_file() and not filepath.is_symlink():
+            if not filepath.is_symlink() and filepath.is_file():
                 spdx_file = oe.spdx.SPDXFile()
                 spdx_file.SPDXID = get_spdxid(file_counter)
                 for t in get_types(filepath):