]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
create-sdpx-2.2.bbclass: Switch from exists to isfile checking debugsrc
authorMark Hatle <mark.hatle@amd.com>
Mon, 15 Jul 2024 19:56:06 +0000 (14:56 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 18 Jul 2024 16:21:01 +0000 (17:21 +0100)
While debugsrc is almost always a file (or link), there are apparently
cases where a directory could be returned from the dwarfsrcfiles
processing.  When this happens, the hashing fails and an error results
when building the SPDX documents.

Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/create-spdx-2.2.bbclass

index 865323d66a6bf90d382a926611bb1996d71c2913..12b78cb3f6299172424aa0fc3d3b6b3a5a6478f2 100644 (file)
@@ -230,7 +230,8 @@ def add_package_sources_from_debug(d, package_doc, spdx_package, package, packag
                     debugsrc_path = search / debugsrc.replace('/usr/src/kernel/', '')
                 else:
                     debugsrc_path = search / debugsrc.lstrip("/")
-                if not debugsrc_path.exists():
+                # We can only hash files below, skip directories, links, etc.
+                if not os.path.isfile(debugsrc_path):
                     continue
 
                 file_sha256 = bb.utils.sha256_file(debugsrc_path)