[PATCH 1/1] Fixed bug in kcompile where run would fail if kcompile-source version had the form x.y instead of x.y.z

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

 



Fixed bug in kcompile where run would fail if kcompile-source version
had the form x.y instead of x.y.z

Signed-off-by: Anubhav Shelat <ashelat@xxxxxxxxxx>
---
 rteval/modules/loads/kcompile.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 35ee5cbbb52d..445575fb137a 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -175,8 +175,11 @@ class Kcompile(CommandLineLoad):
         if 'rc' in self._cfg.source:
             tarfile_prefix = re.search(r"\d{1,2}\.\d{1,3}\-[a-z]*\d{1,2}", self._cfg.source).group(0)
         else:
-            tarfile_prefix = re.search(r"\d{1,2}\.\d{1,3}\.*\d{1,2}", self._cfg.source).group(0)
-
+            try:
+                tarfile_prefix = re.search(r"\d{1,2}\.\d{1,3}\.*\d{1,2}", self._cfg.source).group(0)
+            except AttributeError:
+                # if the kernel version has the form x.x instead of x.x.x
+                tarfile_prefix = re.search(r"\d{1,2}\.\d{1,3}", self._cfg.source).group(0)
         # either a tar.xz or tar.gz might exist. Check for both.
         xz_file = os.path.join(self.srcdir,"linux-" + tarfile_prefix + ".tar.xz" )
         gz_file = os.path.join(self.srcdir,"linux-" + tarfile_prefix + ".tar.gz" )
@@ -193,7 +196,11 @@ class Kcompile(CommandLineLoad):
         # find our source tarball
         if self._cfg.source:
             self.source = self._find_tarball()
-            kernel_prefix = re.search(r"linux-\d{1,2}\.\d{1,3}\.*\d{1,2}", self.source).group(0)
+            try:
+                kernel_prefix = re.search(r"linux-\d{1,2}\.\d{1,3}\.*\d{1,2}", self.source).group(0)
+            except AttributeError:
+                # if the kernel version has the form x.x instead of x.x.x
+                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, f"{DEFAULT_KERNEL_PREFIX}*"))
             if tarfiles:
-- 
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