commit:     9d61dc4ca6b4a8f68806d336c5b6eb888332582e
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 19 12:29:40 2019 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Apr 19 12:29:45 2019 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=9d61dc4c

grs/Kernel.py: correctly parse vanilla-sources

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Kernel.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 82e6d04..3abea6a 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -67,10 +67,15 @@ class Kernel():
             pkg_name = flavor + '-sources-' + vanilla_version + '-' + revision
         except AttributeError:
             # Or the verison is of the form '4.0.6-hardened' with one -
-            _match = re.search(r'(\S+?)-(\S+)', gentoo_version)
-            vanilla_version = _match.group(1)
-            flavor = _match.group(2)
-            pkg_name = flavor + '-sources-' + vanilla_version
+            try:
+                _match = re.search(r'(\S+?)-(\S+)', gentoo_version)
+                vanilla_version = _match.group(1)
+                flavor = _match.group(2)
+                pkg_name = flavor + '-sources-' + vanilla_version
+            except AttributeError:
+                # Finally the verison is of the form '4.0.6' with no -
+                vanilla_version = gentoo_version
+                pkg_name = 'vanilla-sources-' + vanilla_version
         pkg_name = '=sys-kernel/' + pkg_name
         return (gentoo_version, pkg_name, has_modules)
 

Reply via email to