diff options
author | Helmut Grohne <helmut@subdivi.de> | 2021-05-09 07:50:18 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2021-05-09 07:50:18 +0200 |
commit | 15fa5e5b555fdc1aad10f51822de877cde71294d (patch) | |
tree | 6c072ade8fda146e32503fc4afc0414c8263e822 /mdbp/mmdebstrap.py | |
parent | bf30d5dd03503f776127c42d3f1d8b2ea529b150 (diff) | |
download | mdbp-15fa5e5b555fdc1aad10f51822de877cde71294d.tar.gz |
the stdout fd contains the build log
Using a pipe enables streaming of logs, which would not be possible with
a regular file output.
Diffstat (limited to 'mdbp/mmdebstrap.py')
-rw-r--r-- | mdbp/mmdebstrap.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mdbp/mmdebstrap.py b/mdbp/mmdebstrap.py index 4538067..21862c6 100644 --- a/mdbp/mmdebstrap.py +++ b/mdbp/mmdebstrap.py @@ -76,6 +76,7 @@ def main() -> None: "libc-dev:" + hostarch, "libstdc++-dev:" + hostarch)) buildpath = pathlib.PurePath(build.get("buildpath", "/build/build")) + enablelog = build["output"].get("log", True) with get_dsc(build) as dscpath, \ tempfile.NamedTemporaryFile("w+") as script: @@ -91,7 +92,7 @@ def main() -> None: all=["--indep-only"]).get(build.get("type"), [])) cmd.extend(profile_option(build, "--build-profiles")) cmd.append(str(buildpath.parent / dscpath.name)) - if build.get("bd-uninstallable-explainer") == "apt": + if build.get("bd-uninstallable-explainer") == "apt" and enablelog: script.write("if ! %s\nthen\n" % priv_drop(cmd, chroot=True)) cmd[-1:-1] = ['-oDebug::pkgProblemResolver=true', '-oDebug::pkgDepCache::Marker=1', @@ -132,7 +133,7 @@ def main() -> None: pathlib.Path(script.name).chmod(0o755) cmd = [ "mmdebstrap", - "--verbose", + "--verbose" if enablelog else "--quiet", "--mode=unshare", "--variant=apt", "--architectures=" + @@ -153,7 +154,11 @@ def main() -> None: args.mirror, ] cmd.extend(build.get("extrarepositories", ())) - proc = subprocess.Popen(cmd) + proc = subprocess.Popen(cmd, + stdout=None if enablelog + else subprocess.DEVNULL, + stderr=subprocess.STDOUT if enablelog + else subprocess.DEVNULL) sys.exit(proc.wait()) if __name__ == "__main__": |