Skip to contentSkip to conversation

classes/sbom-cve-check: use named variables when iterating

PATCH New Ross Burton 1 participant 2 messages Apr 1

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 classes/sbom-cve-check: use named variables when iterating

Little cleanups: unpack when iterating to avoid needing to use indexes, and only update symlinks if update_link is not None.

---
 meta/classes-recipe/sbom-cve-check.bbclass | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
meta/classes-recipe/sbom-cve-check.bbclass +6 -5
index 2e79dee5716..4244ee657a8 100644
@@ -71,9 +71,9 @@ python do_sbom_cve_check() {
         "--disable-auto-updates"
     ]
 
-    for export_file in export_files:
+    for export_type, export_file, export_link in export_files:
         cmd_args.extend(
-            ["--export-type", export_file[0], "--export-path", export_file[1]]
+            ["--export-type", export_type, "--export-path", export_file]
         )
 
     cmd_args.extend(d.getVar("SBOM_CVE_CHECK_EXTRA_ARGS").split())
@@ -85,9 +85,10 @@ python do_sbom_cve_check() {
         bb.error(f"sbom-cve-check failed: {e}")
         return
 
-    for export_file in export_files:
-        bb.note(f"sbom-cve-check exported: {export_file[1]}")
-        update_symlinks(export_file[1], export_file[2])
+    for export_type, export_file, export_link in export_files:
+        bb.note(f"sbom-cve-check exported: {export_file}")
+        if export_link:
+            update_symlinks(export_file, export_link)
 }
 
 addtask do_sbom_cve_check after do_create_image_sbom_spdx before do_build
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 classes/sbom-cve-check: add summary export type

Add an export type for the human-readable summary report.

---
 meta/classes-recipe/sbom-cve-check.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
meta/classes-recipe/sbom-cve-check.bbclass +7 -0
index 4244ee657a8..4abc427c58f 100644
@@ -36,6 +36,13 @@ SBOM_CVE_CHECK_EXPORT_CVECHECK[doc] = "Export configuration to generate a JSON m
 SBOM_CVE_CHECK_EXPORT_CVECHECK[type] ?= "yocto-cve-check-manifest"
 SBOM_CVE_CHECK_EXPORT_CVECHECK[ext] ?= ".sbom-cve-check.yocto.json"
 
+SBOM_CVE_CHECK_EXPORT_SUMMARY[doc] = "Export configuration to generate a human-readable \
+    summary report, with the following name: \
+    ${IMAGE_NAME}.cve.txt \
+"
+SBOM_CVE_CHECK_EXPORT_SUMMARY[type] ?= "summary"
+SBOM_CVE_CHECK_EXPORT_SUMMARY[ext] ?= ".cve.txt"
+
 python do_sbom_cve_check() {
     """
     Task: Run sbom-cve-check analysis on SBOM.
Signature · 1 line
2.43.0