From 15fa5e5b555fdc1aad10f51822de877cde71294d Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 9 May 2021 07:50:18 +0200 Subject: the stdout fd contains the build log Using a pipe enables streaming of logs, which would not be possible with a regular file output. --- mdbp/pbuilder.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mdbp/pbuilder.py') diff --git a/mdbp/pbuilder.py b/mdbp/pbuilder.py index 8e2556d..a5f734a 100644 --- a/mdbp/pbuilder.py +++ b/mdbp/pbuilder.py @@ -18,6 +18,7 @@ def main() -> None: args = parser.parse_args() build = args.buildjson + enablelog = build["output"].get("log", True) if build.get("lintian", {}).get("run"): raise ValueError("running lintian not supported") if "bd-uninstallable-explainer" in build: @@ -55,9 +56,15 @@ def main() -> None: build.get("type", "binary")]) cmd.extend(profile_option(build, "--profiles")) cmd.extend(["--buildresult", build["output"]["directory"]]) + if not enablelog: + cmd.extend(["--loglevel", "E"]) with get_dsc(build) as dscpath: cmd.append(str(dscpath)) - proc = subprocess.Popen(cmd, env=compute_env(build)) + proc = subprocess.Popen(cmd, env=compute_env(build), + stdout=None if enablelog + else subprocess.DEVNULL, + stderr=subprocess.STDOUT if enablelog + else subprocess.DEVNULL) sys.exit(proc.wait()) if __name__ == "__main__": -- cgit v1.2.3