Commit 3d51db32 authored by Jelmer Vernooij's avatar Jelmer Vernooij

Add fixer transitional-package-should-be-oldlibs-optional.

parent 45aa3fd6
#!/usr/bin/python3
from lintian_brush.control import update_control
packages = []
default_priority = None
def get_source_section(control):
global default_priority
default_priority = control["Priority"]
def oldlibs_priority_optional(control):
# TODO(jelmer): needs higher certainty?
if "transitional package" in control["Description"]:
packages.append(control["Package"])
control["Section"] = "oldlibs"
if default_priority != "optional":
control["Priority"] = "optional"
update_control(binary_package_cb=oldlibs_priority_optional, source_package_cb=get_source_section)
print("Move transitional package%s %s to oldlibs/optional per policy 4.0.1." % (("s" if len(packages) > 1 else ""), ", ".join(packages)))
......@@ -112,6 +112,9 @@ def run_lintian_fixer(local_tree, fixer, update_changelog=True):
description = description.decode('utf-8')
if not description:
raise Exception("Fixer %s did not provide a description" % fixer.script_path)
summary = description.splitlines()[0]
if not list(local_tree.iter_changes(local_tree.basis_tree())):
......
......@@ -58,9 +58,11 @@ def update_control_file(inf, outf, source_package_cb=None, binary_package_cb=Non
first = True
for paragraph in Deb822.iter_paragraphs(inf, encoding='utf-8'):
if paragraph.get("Source"):
source_package_cb(paragraph)
if source_package_cb is not None:
source_package_cb(paragraph)
else:
binary_package_cb(paragraph)
if binary_package_cb is not None:
binary_package_cb(paragraph)
if paragraph:
if not first:
outf.write(b'\n')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment