From: Ross Burton <ross.burton@arm.com>
To: openembedded-core@lists.openembedded.org
Cc: benjamin.robin@bootlin.com
Subject: [RFC PATCH 1/3] sbom-cve-check: refactor do_sbom_cve_check
Date: Thu, 2 Apr 2026 17:25:08 +0100 [thread overview]
Message-ID: <20260402162510.1945892-1-ross.burton@arm.com> (raw)
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
next reply other threads:[~2026-04-02 16:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 16:25 Ross Burton [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260402162510.1945892-1-ross.burton@arm.com \
--to=ross.burton@arm.com \
--cc=benjamin.robin@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox