Skip to contentSkip to conversation

lib: oe: sbom: Improve SPDX parsing error debugging

PATCH New Joshua Watt 1 participant 1 message Jul 24

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: oe: sbom: Improve SPDX parsing error debugging

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.

---
 meta/lib/oe/sbom30.py | 3 +++
 1 file changed, 3 insertions(+)
meta/lib/oe/sbom30.py +3 -0
index 28778651d5..e02382c3cc 100644
@@ -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)
Signature · 1 line
2.54.0