1 from regexes import re_parse_lintian
3 def parse_lintian_output(output):
5 Parses Lintian output and returns a generator with the data.
7 >>> list(parse_lintian_output('W: pkgname: some-tag path/to/file'))
8 [('W', 'pkgname', 'some-tag', 'path/to/file')]
11 for line in output.split('\n'):
12 m = re_parse_lintian.match(line)
16 def generate_reject_messages(parsed_tags, tag_definitions, log=lambda *args: args):
18 Generates package reject messages by comparing parsed lintian output with
25 for values in tag_definitions.values():
29 for etype, epackage, etag, etext in parsed_tags:
36 if etag in tag_definitions['nonfatal']:
37 # Overriding this tag is allowed.
40 elif etag in tag_definitions['fatal']:
41 # Overriding this tag is NOT allowed.
43 log('ftpmaster does not allow tag to be overridable', etag)
45 "%s: Overriden tag %s found, but this tag "
46 "may not be overridden." % (epackage, etag)
50 # Tag is known and not overridden; reject
52 "%s: Found lintian output: '%s %s', automatically "
53 "rejected package." % (epackage, etag, etext)
56 # Now tell if they *might* override it.
57 if etag in tag_definitions['nonfatal']:
58 log("auto rejecting", "overridable", etag)
60 "%s: If you have a good reason, you may override this "
61 "lintian tag." % epackage)
63 log("auto rejecting", "not overridable", etag)