* [PATCH] yocto-check-layer: make argument parsing unambiguous
@ 2020-12-10 16:20 Ross Burton
2020-12-14 13:30 ` [OE-core] " Richard Purdie
0 siblings, 1 reply; 3+ messages in thread
From: Ross Burton @ 2020-12-10 16:20 UTC (permalink / raw)
To: openembedded-core
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [OE-core] [PATCH] yocto-check-layer: make argument parsing unambiguous
2020-12-10 16:20 [PATCH] yocto-check-layer: make argument parsing unambiguous Ross Burton
@ 2020-12-14 13:30 ` Richard Purdie
2020-12-14 17:30 ` Ross Burton
0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2020-12-14 13:30 UTC (permalink / raw)
To: Ross Burton, openembedded-core; +Cc: Alejandro Hernandez
On Thu, 2020-12-10 at 16:20 +0000, Ross Burton wrote:
> 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(-)
https://autobuilder.yoctoproject.org/typhoon/#/builders/39/builds/2825
Do we need to update the way we're calling it on the autobuilder?
Cheers,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [OE-core] [PATCH] yocto-check-layer: make argument parsing unambiguous
2020-12-14 13:30 ` [OE-core] " Richard Purdie
@ 2020-12-14 17:30 ` Ross Burton
0 siblings, 0 replies; 3+ messages in thread
From: Ross Burton @ 2020-12-14 17:30 UTC (permalink / raw)
To: Richard Purdie; +Cc: OE-core, Alejandro Hernandez
On Mon, 14 Dec 2020 at 13:31, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> https://autobuilder.yoctoproject.org/typhoon/#/builders/39/builds/2825
>
> Do we need to update the way we're calling it on the autobuilder?
Yes. Sorry, forgot this was on the autobuilder. Patch incoming.
Ross
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-14 17:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 16:20 [PATCH] yocto-check-layer: make argument parsing unambiguous Ross Burton
2020-12-14 13:30 ` [OE-core] " Richard Purdie
2020-12-14 17:30 ` Ross Burton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.