Skip to contentSkip to conversation

create-sdpx-2.2.bbclass: Switch from exists to isfile checking debugsrc

PATCH New Mark Hatle 1 participant 1 message Sep 17, 2024

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH 1/1 create-sdpx-2.2.bbclass: Switch from exists to isfile checking debugsrc

From: Mark Hatle <[email protected]>

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.

(cherry picked from commit 02e262c291c0b2066132b4cb2ca5fda8145284a9)
---
 meta/classes/create-spdx-2.2.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/create-spdx-2.2.bbclass +2 -1
index d104668ffd..ade1a04be3 100644
@@ -315,7 +315,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)
Signature · 1 line
2.39.5 (Apple Git-154)