Bug 14148

Summary: yocto-check-layer argument parser is bad
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: Scripts and ToolsAssignee: Ross Burton <ross.burton>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Medium CC: denis, mingli.yu, randy.macleod, ross.burton
Version: 3.4   
Target Milestone: 5.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Ross Burton 2020-12-09 17:31:00 UTC
The yocto-check-layer argument parser has both optional parameters (--machine and --dependency) and mandatory positional arguments (layers) all using + for nargs, which means that parsing is non-deterministic and ambiguous:

$ yocto-check-layer --dependency /home/ross/Yocto/meta-arm/meta-arm-toolchain --machines qemuarm64-secureboot /home/ross/Yocto/meta-arm/meta-arm

yocto-check-layer: error: the following arguments are required: LAYER_DIR

It thought I was passing two machines and no layer, when instead I was passing a machine and a layer.

This can be easily solved by changing the positional layers to be --layers [LAYER DIR ...].
Comment 1 Ross Burton 2020-12-09 17:31:30 UTC
The workaround is to creatively order the arguments so the variables are not ambiguous, but this might not be always possible.
Comment 2 Randy MacLeod 2023-04-21 18:45:45 UTC
Moved en masse from 4.2 to 4.3 by Randy.
Comment 3 Randy MacLeod 2024-04-30 18:05:09 UTC
Add Mingli/Grace to CC since she might want to fix this small bug.