[Collab-qa-commits] r2094 - udd/udd

Iain Lane laney at alioth.debian.org
Mon Nov 28 13:43:09 UTC 2011


Author: laney
Date: 2011-11-28 13:43:09 +0000 (Mon, 28 Nov 2011)
New Revision: 2094

Modified:
   udd/udd/lintian_gatherer.py
Log:
Update regex to parse values from newer Lintian output

Lintian's output will soon output tags in the format

  C: pkg type (version) [arch]: tag extra

as opposed to

  C: pkg type: tag extra

that is currently used. Update the parser to support both formats. Thanks to
Niels Thykier for supplying the original regular expression.

TODO: Add new pkg_version pkg_arch columns to table to make use of this
additional data (so we know which package was tested).

Bug #647917.



Modified: udd/udd/lintian_gatherer.py
===================================================================
--- udd/udd/lintian_gatherer.py	2011-11-27 17:17:05 UTC (rev 2093)
+++ udd/udd/lintian_gatherer.py	2011-11-28 13:43:09 UTC (rev 2094)
@@ -14,9 +14,12 @@
 
 class lintian_gatherer(gatherer):
   #RE to parse lintian output, pushing the tag code to $1, package name
-  #to $2, pkg type to $3, tag name to $4 and extra info to $5
-  # (stolen from Russ Allbery, thanks dude)
-  output_re = re.compile("([EWIXOP]): (\S+)(?: (\S+))?: (\S+)(?:\s+(.*))?");
+  #to $2, pkg type to $3, pkg version to $4, pkg arch to $5, tag name to $6 and
+  # extra info to $7. Taken from Niels Thykier in #647917
+  verarch = "(?: \s*\(([^)]+?)\)\s*\[([^)]+?)\])"
+                #  vers               arch
+  output_re = re.compile("([EWIXOP]): (\S+)(?: (\S+)(?:%s)?)?: (\S+)(?:\s+(.*))?" % verarch)
+                         #  code      pkg      type  verarch:  tag     extra
 
   ignore_re = re.compile("^((gpg|secmem usage|warning|(/bin/)?tar|internal error|/usr/bin/xgettext|ERROR): |     |Use of uninitialized value in numeric lt .*)");
 
@@ -58,7 +61,7 @@
 
       match = lintian_gatherer.output_re.match(line)
       if match:
-        (code, pkg, pkg_type, tag, extra) = match.groups();
+        (code, pkg, pkg_type, vers, arch, tag, extra) = match.groups();
         #this one is optional:
         if pkg_type:
           pkg_type = quote(pkg_type)




More information about the Collab-qa-commits mailing list