from utils import parse_changes, check_dsc_files
from textutils import fix_maintainer
from binary import Binary
+from lintian import parse_lintian_output
###############################################################################
if self.logger:
self.logger.log([self.pkg.changes_file, "check_lintian"] + list(txt))
- # We have output of lintian, this package isn't clean. Lets parse it and see if we
- # are having a victim for a reject.
- # W: tzdata: binary-without-manpage usr/sbin/tzconfig
- for line in output.split('\n'):
- m = re_parse_lintian.match(line)
- if m is None:
- continue
-
- etype = m.group(1)
- epackage = m.group(2)
- etag = m.group(3)
- etext = m.group(4)
+ for etype, epackage, etag, etext in parse_lintian_output(output):
# So lets check if we know the tag at all.
if etag not in tags:
--- /dev/null
+#!/usr/bin/env python
+
+from base_test import DakTestCase
+
+import unittest
+
+from daklib.lintian import parse_lintian_output
+
+class ParseLintianTestCase(DakTestCase):
+ def assertParse(self, output, expected):
+ self.assertEqual(
+ list(parse_lintian_output(output)),
+ expected,
+ )
+
+ def testSimple(self):
+ self.assertParse(
+ 'W: pkgname: some-tag path/to/file',
+ [('W', 'pkgname', 'some-tag', 'path/to/file')],
+ )
+
+ self.assertParse('', [])
+ self.assertParse('\n\n', [])
+ self.assertParse('dummy error test', [])
+
+ def testBinaryNoDescription(self):
+ self.assertParse(
+ 'W: pkgname: some-tag',
+ [('W', 'pkgname', 'some-tag', '')],
+ )
+
+ def testSource(self):
+ self.assertParse(
+ 'W: pkgname source: some-tag',
+ [('W', 'pkgname source', 'some-tag', '')]
+ )
+
+ def testSourceNoDescription(self):
+ self.assertParse(
+ 'W: pkgname source: some-tag path/to/file',
+ [('W', 'pkgname source', 'some-tag', 'path/to/file')]
+ )
+
+if __name__ == '__main__':
+ unittest.main()