On 5/28/26 3:22 PM, Richard Purdie wrote:
On Tue, 2026-05-26 at 06:00 +0000, Niko Mauno via lists.openembedded.org wrote:
Avoid following build breakage when IMAGE_LINK_NAME is set as empty
string:

   sbom-cve-check: error: [Errno 2] No such file or directory: 
'/build/layers/openembedded-core/build/tmp/deploy/images/qemuarm/.spdx.json'

Signed-off-by: Niko Mauno <[email protected]>
---
  meta/classes-recipe/sbom-cve-check.bbclass | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/sbom-cve-check.bbclass 
b/meta/classes-recipe/sbom-cve-check.bbclass
index fe145a2212..39719d51dd 100644
--- a/meta/classes-recipe/sbom-cve-check.bbclass
+++ b/meta/classes-recipe/sbom-cve-check.bbclass
@@ -14,9 +14,11 @@ python do_sbom_cve_check() {
      """
      Task: Run sbom-cve-check analysis on SBOM.
      """
-    sbom_path = d.expand("${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.spdx.json")
      image_name = d.getVar("IMAGE_NAME")
      link_name = d.getVar("IMAGE_LINK_NAME")
+    sbom_path = d.expand("${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.spdx.json") \
+                if link_name else \
+                d.expand("${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.spdx.json")
      run_sbom_cve_check(d, sbom_path, image_name, link_name)
  }

Whilst that works, is there any reason we shouldn't just always use IMAGE_NAME?

Conditional code is harder to maintain/test...

Cheers,

Richard

Thanks Richard,

briefly build-tested both empty and non-empty IMAGE_LINK_NAME cases with more trivial IMAGE_NAME adaptation in place ==> failed to find any issues and resulting DEPLOY_DIR_IMAGE/ contents looked good to me in both cases, so submitted v2 based on your suggestion.

-Niko
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#237718): 
https://lists.openembedded.org/g/openembedded-core/message/237718
Mute This Topic: https://lists.openembedded.org/mt/119492393/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to