diff options
author | Helmut Grohne <helmut@subdivi.de> | 2021-05-27 11:54:04 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2021-05-27 11:54:04 +0200 |
commit | 69fdfcdda423b55c7251e4d46e82563cda98a63d (patch) | |
tree | 4299a69f4ae7461065f3f1bb48ac9f2ba557f058 /mdbp/sbuild.py | |
parent | afff0dc73188ac323ec0265cc6b39c67f9fd7474 (diff) | |
download | mdbp-69fdfcdda423b55c7251e4d46e82563cda98a63d.tar.gz |
add new field .output.artifacts to schema
Using the field you can specify an ORed set of positive glob-style
patterns for artifacts to retain in the .output.directory. It defaults
to including all artifacts.
Diffstat (limited to 'mdbp/sbuild.py')
-rw-r--r-- | mdbp/sbuild.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/mdbp/sbuild.py b/mdbp/sbuild.py index edb3531..5309031 100644 --- a/mdbp/sbuild.py +++ b/mdbp/sbuild.py @@ -4,12 +4,13 @@ import argparse import contextlib +import pathlib import subprocess import sys import tempfile import typing -from .common import buildjson, compute_env, get_dsc +from .common import buildjson, clean_dir, compute_env, get_dsc PerlValue = typing.Union[None, str, typing.List[typing.Any], typing.Dict[str, typing.Any]] @@ -89,16 +90,18 @@ def main() -> None: except KeyError: thing = str(stack.enter_context(get_dsc(build)).absolute()) - proc = subprocess.Popen(["sbuild", thing], - env=dict(SBUILD_CONFIG=sbuildconf.name, - PATH="/usr/bin:/bin"), - 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()) + cproc = subprocess.run(["sbuild", thing], + env=dict(SBUILD_CONFIG=sbuildconf.name, + PATH="/usr/bin:/bin"), + 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) + clean_dir(pathlib.Path(build["output"]["directory"]), + build["output"].get("artifacts", ["*"])) + sys.exit(cproc.returncode) if __name__ == "__main__": main() |