Passing in 3.0 to autotest results in messages about being unable to
parse the major/minor version. This is because the code assumes a
3-digit verions number. Additionally, the 'raise' in this chunk of code
throws its own exception due to a raw string parameter.

Fix both by also checking against the 2-digit class of verions. Yes,
this means we'll parse 2.6 correctly, but seems like that's ok, as we
should fail elsewhere. Alternatively, we could hard-code the 3 as the
first part of the major version.

Signed-off-by: Nishanth Aravamudan <[email protected]>
---
 client/bin/kernelexpand.py |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/client/bin/kernelexpand.py b/client/bin/kernelexpand.py
index 871b053..c717b06 100755
--- a/client/bin/kernelexpand.py
+++ b/client/bin/kernelexpand.py
@@ -57,10 +57,16 @@ def decompose_kernel_once(kernel):
 
         match = re.search(r'^((\d+\.\d+)\.(\d+))', kernel)
         if not match:
-            raise "unable to determine major/minor version"
-        params['minor'] = match.group(1)
-        params['major'] = match.group(2)
-        params['minor-prev'] = match.group(2) + '.%d' % (int(match.group(3)) 
-1)
+            match = re.search(r'^(\d+\.\d+)', kernel)
+            if not match:
+                raise NameError("unable to determine major/minor version")
+            else:
+                params['minor'] = 0
+                params['major'] = match.group(1)
+        else:
+            params['minor'] = match.group(1)
+            params['major'] = match.group(2)
+            params['minor-prev'] = match.group(2) + '.%d' % 
(int(match.group(3)) -1)
 
         # Build the new kernel and patch list.
         new_kernel = becomes % params
-- 
1.7.5.4

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to