Patchwork [kteam-tools] ktl: update debian.py to deal with two-number kernel versions

login
register
mail settings
Submitter Seth Forshee
Date July 6, 2011, 3:10 p.m.
Message ID <1309965035-14302-1-git-send-email-seth.forshee@canonical.com>
Download mbox | patch
Permalink /patch/103497/
State New
Headers show

Comments

Seth Forshee - July 6, 2011, 3:10 p.m.
The version string parsing assumes a kernel version with three
numbers. This isn't currently the case for oneiric, so update the
regexes to make the third number optional.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 ktl/debian.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Brad Figg - July 12, 2011, 2:28 p.m.
On 07/06/2011 08:10 AM, Seth Forshee wrote:
> The version string parsing assumes a kernel version with three
> numbers. This isn't currently the case for oneiric, so update the
> regexes to make the third number optional.
>
> Signed-off-by: Seth Forshee<seth.forshee@canonical.com>
> ---
>   ktl/debian.py |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/ktl/debian.py b/ktl/debian.py
> index 35dd182..809817e 100644
> --- a/ktl/debian.py
> +++ b/ktl/debian.py
> @@ -25,11 +25,11 @@ class DebianError(Exception):
>   class Debian:
>       verbose = False
>       debug = False
> -    version_line_rc = compile("^(linux[-\S]*) \(([0-9]+\.[0-9]+\.[0-9]+[-\.][0-9]+\.[0-9]+[~\S]*)\) (\S+); urgency=\S+$")
> -    version_rc      = compile("^([0-9]+\.[0-9]+\.[0-9]+)[-\.]([0-9]+)\.([0-9]+)([~\S]*)$")
> +    version_line_rc = compile("^(linux[-\S]*) \(([0-9]+\.[0-9]+(?:\.[0-9]+)?[-\.][0-9]+\.[0-9]+[~\S]*)\) (\S+); urgency=\S+$")
> +    version_rc      = compile("^([0-9]+\.[0-9]+(?:\.[0-9]+)?)[-\.]([0-9]+)\.([0-9]+)([~\S]*)$")
>
>       package_rc = compile("^(linux[-\S])*.*$")
> -    ver_rc     = compile("^linux[-\S]* \(([0-9]+\.[0-9]+\.[0-9]+[-\.][0-9]+\.[0-9]+[~a-z0-9]*)\).*$")
> +    ver_rc     = compile("^linux[-\S]* \(([0-9]+\.[0-9]+(?:\.[0-9]+)?[-\.][0-9]+\.[0-9]+[~a-z0-9]*)\).*$")
>
>       # debian_directories
>       #

Acked-by: Brad Figg <brad.figg@canonical.com>

Patch

diff --git a/ktl/debian.py b/ktl/debian.py
index 35dd182..809817e 100644
--- a/ktl/debian.py
+++ b/ktl/debian.py
@@ -25,11 +25,11 @@  class DebianError(Exception):
 class Debian:
     verbose = False
     debug = False
-    version_line_rc = compile("^(linux[-\S]*) \(([0-9]+\.[0-9]+\.[0-9]+[-\.][0-9]+\.[0-9]+[~\S]*)\) (\S+); urgency=\S+$")
-    version_rc      = compile("^([0-9]+\.[0-9]+\.[0-9]+)[-\.]([0-9]+)\.([0-9]+)([~\S]*)$")
+    version_line_rc = compile("^(linux[-\S]*) \(([0-9]+\.[0-9]+(?:\.[0-9]+)?[-\.][0-9]+\.[0-9]+[~\S]*)\) (\S+); urgency=\S+$")
+    version_rc      = compile("^([0-9]+\.[0-9]+(?:\.[0-9]+)?)[-\.]([0-9]+)\.([0-9]+)([~\S]*)$")
 
     package_rc = compile("^(linux[-\S])*.*$")
-    ver_rc     = compile("^linux[-\S]* \(([0-9]+\.[0-9]+\.[0-9]+[-\.][0-9]+\.[0-9]+[~a-z0-9]*)\).*$")
+    ver_rc     = compile("^linux[-\S]* \(([0-9]+\.[0-9]+(?:\.[0-9]+)?[-\.][0-9]+\.[0-9]+[~a-z0-9]*)\).*$")
 
     # debian_directories
     #