summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--TODO.md1
-rw-r--r--mdbp/build_schema.json5
-rw-r--r--mdbp/mmdebstrap.py11
-rw-r--r--mdbp/pbuilder.py9
-rw-r--r--mdbp/sbuild.py7
6 files changed, 29 insertions, 7 deletions
diff --git a/README.md b/README.md
index 603d157..66b9fa7 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,8 @@ The output directory `out` is supposed to be an empty directory. Then run one
of the backends `mdbp-BACKEND [BACKENDOPTIONS] REQUEST.json`. The process
blocks until the build has finished and its return code signifies success or
failure of the operation. Usage of unsupported parameters of the particular
-backend result in a failure of the operation as a whole.
+backend result in a failure of the operation as a whole. The content of the
+stdout file descriptor is to be considered the build log.
When to use mdbp?
-----------------
diff --git a/TODO.md b/TODO.md
index b24415c..fbcd688 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,4 +1,3 @@
-* A build log should be supplied in a machine-consumable way.
* It should be requestable which build artifacts are to be retained.
* There should be a remote backend performing builds via ssh.
* There should be a backend supporting a container thingy (e.g. `debspawn`,
diff --git a/mdbp/build_schema.json b/mdbp/build_schema.json
index 138de76..85bcd00 100644
--- a/mdbp/build_schema.json
+++ b/mdbp/build_schema.json
@@ -123,6 +123,11 @@
"directory": {
"type": "string",
"description": "target directory to place output artifacts, can be specified relative to the location of this json file"
+ },
+ "log": {
+ "type": "boolean",
+ "default": true,
+ "description": "whether to output the build log on the stdout file descriptor"
}
}
}
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__":
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__":
diff --git a/mdbp/sbuild.py b/mdbp/sbuild.py
index 6b9c33d..ffaeaf2 100644
--- a/mdbp/sbuild.py
+++ b/mdbp/sbuild.py
@@ -47,7 +47,12 @@ def main() -> None:
with get_dsc(build) as dscpath:
cmd.append(str(dscpath.absolute()))
proc = subprocess.Popen(cmd, env=compute_env(build),
- cwd=build["output"]["directory"])
+ cwd=build["output"]["directory"],
+ stdout=None if build["output"].get("log", True)
+ else subprocess.DEVNULL,
+ stderr=subprocess.STDOUT
+ if build["output"].get("log", True)
+ else subprocess.DEVNULL)
sys.exit(proc.wait())
if __name__ == "__main__":