From: Chris Lamb Date: Wed, 28 Oct 2009 09:13:38 +0000 (+0000) Subject: Fix lintian regex. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf95947fa726554611637159e14e0a44ff7ce50a;p=dak Fix lintian regex. Signed-off-by: Chris Lamb --- diff --git a/daklib/regexes.py b/daklib/regexes.py index cc5d1be6..6be99977 100755 --- a/daklib/regexes.py +++ b/daklib/regexes.py @@ -112,4 +112,4 @@ re_user_mails = re.compile(r"^(pub|uid):[^rdin].*<(.*@.*)>.*$", re.MULTILINE); re_user_name = re.compile(r"^pub:.*:(.*)<.*$", re.MULTILINE); re_re_mark = re.compile(r'^RE:') -re_parse_lintian = re.compile(r"^(W|E|O): (.*?): (.*?) (.*)$") +re_parse_lintian = re.compile(r"^(W|E|O): (.*?): ([^ ]*) ?(.*)$") diff --git a/tests/test_regexes.py b/tests/test_regexes.py index 2f8fed1e..766e73e4 100755 --- a/tests/test_regexes.py +++ b/tests/test_regexes.py @@ -35,10 +35,28 @@ class re_single_line_field(unittest.TestCase): class re_parse_lintian(unittest.TestCase): MATCH = regexes.re_parse_lintian.match - def testSimple(self): + def testBinary(self): + self.assertEqual( + self.MATCH('W: pkgname: some-tag path/to/file').groups(), + ('W', 'pkgname', 'some-tag', 'path/to/file') + ) + + def testBinaryNoDescription(self): + self.assertEqual( + self.MATCH('W: pkgname: some-tag').groups(), + ('W', 'pkgname', 'some-tag', '') + ) + + def testSource(self): + self.assertEqual( + self.MATCH('W: pkgname source: some-tag').groups(), + ('W', 'pkgname source', 'some-tag', '') + ) + + def testSourceNoDescription(self): self.assertEqual( - self.MATCH('W: tzdata: binary-without-manpage usr/sbin/tzconfig').groups(), - ('W', 'tzdata', 'binary-without-manpage', 'usr/sbin/tzconfig') + self.MATCH('W: pkgname source: some-tag path/to/file').groups(), + ('W', 'pkgname source', 'some-tag', 'path/to/file') ) if __name__ == '__main__':