[PATCH 6/7] rteval: kcompile: Fix regular expression to match kernel prefix

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

 



If the user specifies a kernel to compile as a load other than the
default kernel, the kernel prefix is obtained with a regular expression.

Currently the regular expression does not accomodate two digit numbers
in the kernel version.
Fix that regular expression to accomodate different kernel versions,
with room to grow for the future.

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
 rteval/modules/loads/kcompile.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 2701a0dcba91..3d9b882d8810 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -169,7 +169,7 @@ class Kcompile(CommandLineLoad):
             if not os.path.exists(tarfile):
                 raise rtevalRuntimeError(self, " tarfile %s does not exist!" % tarfile)
             self.source = tarfile
-            kernel_prefix = re.search(r"linux-\d\.\d", self.source).group(0)
+            kernel_prefix = re.search(r"linux-\d{1,2}\.\d{1,3}", self.source).group(0)
         else:
             tarfiles = glob.glob(os.path.join(self.srcdir, "%s*" % DEFAULT_KERNEL_PREFIX))
             if tarfiles:
@@ -177,6 +177,7 @@ class Kcompile(CommandLineLoad):
             else:
                 raise rtevalRuntimeError(self, " no kernel tarballs found in %s" % self.srcdir)
             kernel_prefix = DEFAULT_KERNEL_PREFIX
+        self._log(Log.DEBUG, f"kernel_prefix = {kernel_prefix}")
 
         # check for existing directory
         kdir = None
-- 
2.36.1




[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