From: "Ross Burton" <ross@burtonini.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] yocto-check-layer: make argument parsing unambiguous
Date: Thu, 10 Dec 2020 16:20:23 +0000 [thread overview]
Message-ID: <20201210162023.3239592-1-ross.burton@arm.com> (raw)
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 <ross.burton@arm.com>
---
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
next reply other threads:[~2020-12-10 16:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-10 16:20 Ross Burton [this message]
2020-12-14 13:30 ` [OE-core] [PATCH] yocto-check-layer: make argument parsing unambiguous Richard Purdie
2020-12-14 17:30 ` Ross Burton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201210162023.3239592-1-ross.burton@arm.com \
--to=ross@burtonini.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox