X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Flintian.py;fp=daklib%2Flintian.py;h=32c63db0d2e3199f41650b66444e6a2767a300ad;hb=bd2f59abe3833efd703db5e075c8ce67f0b7864a;hp=c0ee316a6e4a172e7690fd7a9991e73b04afe0ab;hpb=c91496e85403f61439ffce6326ddd8c32cad5751;p=dak.git diff --git a/daklib/lintian.py b/daklib/lintian.py index c0ee316a..32c63db0 100644 --- a/daklib/lintian.py +++ b/daklib/lintian.py @@ -12,3 +12,49 @@ def parse_lintian_output(output): m = re_parse_lintian.match(line) if m: yield m.groups() + +def generate_reject_messages(parsed_tags, tag_definitions, log=lambda *args: args): + rejects = [] + + tags = set() + for values in tag_definitions.values(): + for tag in values: + tags.add(tag) + + for etype, epackage, etag, etext in parsed_tags: + if etag not in tags: + continue + + # Was tag overridden? + if etype == 'O': + + if etag in tag_definitions['nonfatal']: + # Overriding this tag is allowed. + pass + + elif etag in tag_definitions['fatal']: + # Overriding this tag is NOT allowed. + + log('ftpmaster does not allow tag to be overridable', etag) + rejects.append( + "%s: Overriden tag %s found, but this tag " + "may not be overridden." % (epackage, etag) + ) + + else: + # Tag is known and not overridden; reject + rejects.append( + "%s: Found lintian output: '%s %s', automatically " + "rejected package." % (epackage, etag, etext) + ) + + # Now tell if they *might* override it. + if etag in tag_definitions['nonfatal']: + log("auto rejecting", "overridable", etag) + rejects.append( + "%s: If you have a good reason, you may override this " + "lintian tag." % epackage) + else: + log("auto rejecting", "not overridable", etag) + + return rejects