diff options
-rw-r--r-- | mdbp/pbuilder.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/mdbp/pbuilder.py b/mdbp/pbuilder.py index d408533..64d218d 100644 --- a/mdbp/pbuilder.py +++ b/mdbp/pbuilder.py @@ -23,8 +23,6 @@ def main() -> None: if "sourcename" in build["input"]: raise ValueError("building a source package by name is not supported") enablelog = build["output"].get("log", True) - if build.get("lintian", {}).get("run"): - raise ValueError("running lintian not supported") if "bd-uninstallable-explainer" in build: raise ValueError("bd-uninstallable-explainer %r not supported" % build["bd-uinstallable-explainer"]) @@ -62,15 +60,24 @@ def main() -> None: cmd.extend(["--buildresult", build["output"]["directory"]]) if not enablelog: cmd.extend(["--loglevel", "E"]) + apt_get = ["apt-get", "-oAPT::Keep-Downloaded-Path=false", "--yes"] with tempfile.TemporaryDirectory() as hookdirn, get_dsc(build) as dscpath: hookdir = pathlib.Path(hookdirn) hook = hookdir / "D50aptupdate" hook.write_text("""#/bin/sh set -e apt-get update -apt-get -oAPT::Keep-Downloaded-Path=false --yes dist-upgrade -""") +%s dist-upgrade +""" % shlex.join(apt_get)) hook.chmod(0o755) + if build["lintian"].get("run", False): + hook = hookdir / "B90lintian" + hook.write_text("""#!/bin/sh +set -e +%s install lintian +runuser -u pbuilder -- lintian %s "${BUILDDIR:-/tmp/buildd}"/*.changes +""" % (shlex.join(apt_get), shlex.join(build["lintian"].get("options", [])))) + hook.chmod(0o755) cmd.extend(["--hookdir", hookdirn, str(dscpath)]) proc = subprocess.Popen(cmd, env=compute_env(build), stdout=None if enablelog |