Package: lintian-brush Version: 0.72 Severity: wishlist Tags: patch Hi there,
While it's difficult to change the default value for Rules-Requires-Root: in dpkg-buildpackage, it's arguably less intrusive to do it in lintian-brush (at least in opinionated mode) as the maintainer has a chance to review the changes and compare binary packages before uploading. The attached fixer can be used to unconditionally set ‘Rules-Requires-Root: no’. I suppose it would be better to have some heuristics to try to guess whether d/rules requires root privileges, but for packages with simple d/rules and where upstream tests don't require privileged access the fixer is probably good enough :-) Thanks for maintaining lintian-brush! -- Guilhem.
#!/usr/bin/python3 from debmutate.control import ( ControlEditor ) from lintian_brush.fixer import report_result require_root = "no" updated = False with ControlEditor() as updater: if "Rules-Requires-Root" not in updater.source: # XXX add some heuristics to set require_root = "yes" in common # cases, like `debian/rules binary` chown(1)'ing stuff updater.source["Rules-Requires-Root"] = require_root updated = True report_result( "Set Rules-Requires-Root: %s." % require_root, fixed_lintian_tags=["rules-requires-root-missing"]) if require_root == "no" and updated == True: with open("/dev/tty", "w") as p: # ugly work around lintian-brush capturing the error output p.write("NOTE: Don't forget to verify that the binaries built with this field present are identical!\n")
signature.asc
Description: PGP signature