diff mbox series

lib/oe/sbom: Improve SPDX parsing error debugging

Message ID 20260727090900.81755-1-HimaniRamesh.Barde@windriver.com
State Accepted, archived
Commit 9a25b3e72051a30794e147564028487a598ce82d
Headers show
Series lib/oe/sbom: Improve SPDX parsing error debugging | expand

Commit Message

Himani Barde July 27, 2026, 9:09 a.m. UTC
From: Joshua Watt <JPEWhacker@gmail.com>

Improves the debugging output when parsing an SPDX file fails by
reporting the file name (since this is not normally visible from the
backtrace). Continue to raise the exception after reporting the file
name to get the full backtrace.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oe/sbom30.py | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oe/sbom30.py b/meta/lib/oe/sbom30.py
index 28778651d5..e02382c3cc 100644
--- a/meta/lib/oe/sbom30.py
+++ b/meta/lib/oe/sbom30.py
@@ -977,6 +977,9 @@  def load_jsonld(d, path, required=False):
         if required:
             bb.fatal("No SPDX document named %s found" % path)
         return None
+    except Exception as e:
+        bb.error(f"Unable to parse SPDX document {path}: {e}")
+        raise e
 
     if not objset.doc:
         bb.fatal("SPDX Document %s has no SPDXDocument element" % path)