public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/3] sbom-cve-check: refactor do_sbom_cve_check
@ 2026-04-02 16:25 Ross Burton
  2026-04-02 16:25 ` [RFC PATCH 2/3] sbom-cve-check: move to classes from classes-recipe Ross Burton
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ross Burton @ 2026-04-02 16:25 UTC (permalink / raw)
  To: openembedded-core; +Cc: benjamin.robin

Extract the bulk of the logic to a separate function, so the task just
has to pass a few variables.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-recipe/sbom-cve-check.bbclass | 29 +++++++++++++---------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/meta/classes-recipe/sbom-cve-check.bbclass b/meta/classes-recipe/sbom-cve-check.bbclass
index 4abc427c58..fef6f0c2aa 100644
--- a/meta/classes-recipe/sbom-cve-check.bbclass
+++ b/meta/classes-recipe/sbom-cve-check.bbclass
@@ -43,28 +43,24 @@ SBOM_CVE_CHECK_EXPORT_SUMMARY[doc] = "Export configuration to generate a human-r
 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.
-    """
+
+def run_sbom_cve_check(d, recipe_name, link_name=None):
     import os
     import bb
-    from oe.cve_check import update_symlinks
 
     if not bb.data.inherits_class("create-spdx-3.0", d):
-        bb.fatal("Cannot execute sbom-cve-check missing create-spdx-3.0 inherit.")
+        bb.fatal("Cannot execute sbom-cve-check: missing create-spdx-3.0 inherit.")
 
-    sbom_path = d.expand("${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.spdx.json")
+    image_deploy_dir = d.getVar("DEPLOY_DIR_IMAGE")
+    sbom_path = d.expand(f"{image_deploy_dir}/{recipe_name}.spdx.json")
     dl_db_dir = d.getVar("SBOM_CVE_CHECK_DEPLOY_DB_DIR")
-    deploy_dir = d.getVar("SBOM_CVE_CHECK_DEPLOYDIR")
-    img_link_name = d.getVar("IMAGE_LINK_NAME")
-    img_name = d.getVar("IMAGE_NAME")
+    out_deploy_dir = d.getVar("SBOM_CVE_CHECK_DEPLOYDIR")
 
     export_files = []
     for export_var in d.getVar("SBOM_CVE_CHECK_EXPORT_VARS").split():
         export_ext = d.getVarFlag(export_var, "ext")
-        export_path = f"{deploy_dir}/{img_name}{export_ext}"
-        export_link = f"{deploy_dir}/{img_link_name}{export_ext}"
+        export_path = f"{out_deploy_dir}/{recipe_name}{export_ext}"
+        export_link = f"{out_deploy_dir}/{link_name}{export_ext}" if link_name else None
         export_type = d.getVarFlag(export_var, "type")
         export_files.append((export_type, export_path, export_link))
 
@@ -96,6 +92,15 @@ python do_sbom_cve_check() {
         bb.note(f"sbom-cve-check exported: {export_file}")
         if export_link:
             update_symlinks(export_file, export_link)
+
+
+python do_sbom_cve_check() {
+    """
+    Task: Run sbom-cve-check analysis on SBOM.
+    """
+    image_name = d.getVar("IMAGE_NAME")
+    link_name = d.getVar("IMAGE_LINK_NAME")
+    run_sbom_cve_check(d, image_name, link_name, sbom_path)
 }
 
 addtask do_sbom_cve_check after do_create_image_sbom_spdx before do_build
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-04-03  8:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 16:25 [RFC PATCH 1/3] sbom-cve-check: refactor do_sbom_cve_check Ross Burton
2026-04-02 16:25 ` [RFC PATCH 2/3] sbom-cve-check: move to classes from classes-recipe Ross Burton
2026-04-02 16:30   ` Patchtest results for " patchtest
2026-04-02 16:25 ` [RFC PATCH 3/3] sbom-cve-check: add prototype recipe scanning task Ross Burton
2026-04-03  8:24   ` Benjamin Robin
2026-04-03  8:19 ` [RFC PATCH 1/3] sbom-cve-check: refactor do_sbom_cve_check Benjamin Robin
2026-04-03  8:26 ` [OE-core] " Antonin Godard
2026-04-03  8:33   ` Benjamin Robin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox