diff mbox series

yocto-check-layer: don't skip entries when dropping invalid layers

Message ID 20261029112443.1734921-1-vinicius.eduardo.pedrosa@gmail.com
State Under Review
Headers show
Series yocto-check-layer: don't skip entries when dropping invalid layers | expand

Commit Message

Vinicius Pedrosa Oct. 29, 2026, 11:24 a.m. UTC
The "Detected layers" loop removes invalid entries from the list it's
iterating over. When two invalid layers are next to each other,
removing the first one skips the second.

A skipped entry without conf/layer.conf makes the dependency pass fail
with KeyError: 'collections'. A skipped BSP+DISTRO entry isn't
reported at all. If no other layer is left to test, the script exits 0.

Iterate over a copy of the list so every entry gets checked. Keep
removing from the original list, since dep_layers refers to that same
list when --dependency isn't used.

Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
---
Hit it on a layer that had a few subdirectories with an empty conf/ in
them.

Tested on master (fa83da7) with small synthetic layers, same tree and
command before/after:
- two adjacent dirs with an empty conf/: KeyError before; after, both
  get the "ignoring" line and the real layer is tested
- two adjacent BSP+DISTRO dirs only: exit 0 before, exit 1 after
- valid layer + one stray conf/ dir: same test results before/after

Applies to master-next too (offset 2), not tested there.

 scripts/yocto-check-layer | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer
index 8c8b4db..a580a8f 100755
--- a/scripts/yocto-check-layer
+++ b/scripts/yocto-check-layer
@@ -125,7 +125,7 @@  def main():
         return 1
 
     logger.info("Detected layers:")
-    for layer in layers:
+    for layer in layers[:]:
         if layer['type'] == LayerType.ERROR_BSP_DISTRO:
             logger.error("%s: Can't be DISTRO and BSP type at the same time."\
                      " Both conf/distro and conf/machine folders were found."\