rteval/rteval-kcompile-Fix-regular-expression-to-match-kern.patch

44 lines
1.8 KiB
Diff
Raw Normal View History

From ddbff5f40845c64dbf40f8cbed018242d20abfcb Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Fri, 3 Jun 2022 11:16:59 -0400
Subject: [PATCH 15/17] rteval: kcompile: Fix regular expression to match
kernel prefix
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@redhat.com>
---
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