Currently the argument parser uses nargs=+ for both the layers (positional arguments) and machines/dependencies/addition layers (optional arguments). This means it's impossible to determine what is meant by:
$ yocto-check-layer --machines a b c Is this machines=(a,b) and layers=(c), or machines=(a) and layers=(b,c)? Or even machines=(a,b,c) and layers=(), which results in a parse failure as the layers are mandatory? The workaround is to re-order the arguments to an unambiguous form: $ yocto-check-layer b c --machines a However this means the user needs to know the problem and how to work around it. Instead, change the parser to require an explicit --layers argument: $ yocto-check-layer --machines a --layers b c Also improve the other arguments by adding clearer metavars and short options. [ YOCTO #14148 ] Signed-off-by: Ross Burton <[email protected]> --- scripts/yocto-check-layer | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer index b7c83c8b54..7c7d6013d8 100755 --- a/scripts/yocto-check-layer +++ b/scripts/yocto-check-layer @@ -45,15 +45,15 @@ def main(): parser = argparse.ArgumentParser( description="Yocto Project layer checking tool", add_help=False) - parser.add_argument('layers', metavar='LAYER_DIR', nargs='+', - help='Layer to check') + parser.add_argument('-l', '--layers', metavar='LAYER_DIR', nargs='+', + required=True, help='Layers to check') parser.add_argument('-o', '--output-log', help='File to output log (optional)', action='store') - parser.add_argument('--dependency', nargs="+", + parser.add_argument('-p', '--dependency', nargs="+", metavar='LAYER_DIR', help='Layers to process for dependencies', action='store') - parser.add_argument('--machines', nargs="+", + parser.add_argument('-m', '--machines', nargs="+", metavar='MACHINE', help='List of MACHINEs to be used during testing', action='store') - parser.add_argument('--additional-layers', nargs="+", + parser.add_argument('-a', '--additional-layers', nargs="+", metavar='LAYER_DIR', help='List of additional layers to add during testing', action='store') group = parser.add_mutually_exclusive_group() group.add_argument('--with-software-layer-signature-check', action='store_true', dest='test_software_layer_signatures', -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#145450): https://lists.openembedded.org/g/openembedded-core/message/145450 Mute This Topic: https://lists.openembedded.org/mt/78857660/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
