diff mbox series

[1/2] classes/cargo-update-recipe-crates: fix unreachable Cargo.lock check

Message ID 20261021-mfe-multi-cargo-lock-files-v1-1-d3510d4ad963@pengutronix.de
State New
Headers show
Series Add support for multi Cargo.lock files | expand

Commit Message

Marco Felsch Oct. 21, 2026, 6:46 p.m. UTC
The 'crates is None' check can never trigger since crates is always
initialised to the header string. Use the previously unused 'found'
flag to detect a run where no Cargo.lock yielded any crates.io crate
and fail the task in that case instead of silently writing an empty
crate list.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 meta/classes-recipe/cargo-update-recipe-crates.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/cargo-update-recipe-crates.bbclass b/meta/classes-recipe/cargo-update-recipe-crates.bbclass
index e62039208c161cf0f2f6fc56ba5ef2e9c807de5f..0767b566ee287d11dc2e1e6d0aeea0a0d3b225b8 100644
--- a/meta/classes-recipe/cargo-update-recipe-crates.bbclass
+++ b/meta/classes-recipe/cargo-update-recipe-crates.bbclass
@@ -75,8 +75,9 @@  python do_update_crates() {
                 c = get_crates(cargo_lock_path)
                 if c is not None:
                     crates += c
+                    found = True
 
-    if crates is None:
+    if not found:
         raise ValueError(f"Unable to find any Cargo.lock in {cargo_lock_src_dir}")
 
     target_file = d.expand("${THISDIR}/${BPN}-crates.inc")