From: Peter Marko Date: Thu, 11 Aug 2022 12:35:13 +0000 (+0200) Subject: create-spdx: handle links to inaccessible locations X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~3284 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e105befbe4ee0d85e94c2048a744f0373e2dbcdf;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git create-spdx: handle links to inaccessible locations 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 Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass index 383ca10bab3..47dd12c3834 100644 --- a/meta/classes/create-spdx.bbclass +++ b/meta/classes/create-spdx.bbclass @@ -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):