mbox series

[0/3] Updates for converting optparse to argparse in

Message ID 20230628195145.636652-1-ashelat@redhat.com
Headers show
Series Updates for converting optparse to argparse in | expand

Message

Anubhav Shelat June 28, 2023, 7:51 p.m. UTC
These commits can be pulled from the "argparse" branch in
https://github.com/AnubhavS1/rteval. 

Anubhav Shelat (3):
  rteval: added code to download default kernel version if no version is
    specified
  rteval: fixed comments
  rteval/server: edited files to use optparse instead of argparse

 rteval-cmd                       | 12 ++++++++++--
 rteval/modules/__init__.py       |  4 ++--
 rteval/rtevalConfig.py           |  2 +-
 server/remove_rtevalrun          | 16 ++++++++--------
 server/rteval_testserver.py      |  1 -
 server/testclient_sendreportfile | 10 +++++-----
 6 files changed, 26 insertions(+), 19 deletions(-)

Comments

John Kacur June 28, 2023, 8:34 p.m. UTC | #1
On Wed, 28 Jun 2023, Anubhav Shelat wrote:

> Previously, the usuage was "./rteval-cmd -S [KERNEL_VERSION]", and
> rteval-cmd would throw an error if no kernel version was provided.
> Now, rteval-cmd will download the default kernel version, as specified
> in rteval/modules/loads/kcompile.py.
> 
> Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
> ---
>  rteval-cmd | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/rteval-cmd b/rteval-cmd
> index f715fec1e21c..ae94bd98cc11 100755
> --- a/rteval-cmd
> +++ b/rteval-cmd
> @@ -166,7 +166,7 @@ def parse_options(cfg, parser, cmdargs):
>      parser.add_argument("-V", "--version", dest="rteval___version",
>                        action='store_true', default=False,
>                        help='print rteval version and exit')
> -    parser.add_argument("-S", "--source-download", dest="rteval___srcdownload",
> +    parser.add_argument("-S", "--source-download", nargs="*", dest="rteval___srcdownload",
>                          type=str, default=None, metavar="KERNEL_VERSION",
>                          help='download a source kernel from kernel.org and exit')
>  
> @@ -191,8 +191,16 @@ def parse_options(cfg, parser, cmdargs):
>              ind = cmdargs.index('--raw-histogram')
>          cmd_args = cmdargs[ind+1:]
>          cmdargs = cmdargs[:ind+1]
> +
>      cmd_opts = parser.parse_args(args=cmdargs)
>  
> +    # if no kernel version was provided for --source-download, set version to default
> +    if (sys.argv.count('-S')+sys.argv.count('--source-download')) > 0:
> +        if cmd_opts.rteval___srcdownload == []:
> +            cmd_opts.rteval___srcdownload = ModuleParameters()["source"]["default"].replace(".tar.xz", "")
> +        else:
> +            cmd_opts.rteval___srcdownload = cmd_opts.rteval___srcdownload[0]
> +
>      if cmd_opts.rteval___version:
>          print(f"rteval version {RTEVAL_VERSION}")
>          sys.exit(0)
> -- 
> 2.39.3
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>