[PATCH 1/3] rteval: added code to download default kernel version if no version is specified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux