summaryrefslogtreecommitdiff
path: root/mdbp/sbuild.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2021-06-15 13:36:34 +0200
committerHelmut Grohne <helmut@subdivi.de>2021-06-15 13:36:34 +0200
commit511c49acc13803d851a4d0d2ef17647e3e2144b4 (patch)
tree66604f5addb56b2502106ed1c764598aeea53d33 /mdbp/sbuild.py
parentd8b36aca8725b36411298961aa2494e995426417 (diff)
downloadmdbp-511c49acc13803d851a4d0d2ef17647e3e2144b4.tar.gz
allow passing custom options to pbuilder and sbuild
Diffstat (limited to 'mdbp/sbuild.py')
-rw-r--r--mdbp/sbuild.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/mdbp/sbuild.py b/mdbp/sbuild.py
index ba42932..02aa6cf 100644
--- a/mdbp/sbuild.py
+++ b/mdbp/sbuild.py
@@ -10,7 +10,8 @@ import sys
import tempfile
import typing
-from .common import buildjson, clean_dir, compute_env, get_dsc
+from .common import AddSpaceSeparatedValues, buildjson, clean_dir, \
+ compute_env, get_dsc
PerlValue = typing.Union[None, str, typing.List[typing.Any],
typing.Dict[str, typing.Any]]
@@ -43,6 +44,23 @@ def perl_conf(conf: typing.Dict[str, PerlValue]) -> str:
def main() -> None:
"""Entry point for mdbp-sbuild backend"""
parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "--sbuildopt",
+ dest="sbuildopts",
+ action="append",
+ metavar="OPT",
+ default=[],
+ help="a custom option to be passed down to sbuild, can be specified "
+ "multiple times and mixed with --sbuildopts",
+ )
+ parser.add_argument(
+ "--sbuildopts",
+ action=AddSpaceSeparatedValues,
+ metavar="OPTS",
+ default=[],
+ help="space-separated options to be passed down to sbuild, can be "
+ "specified multiple times and mixed with --sbuildopt",
+ )
parser.add_argument("buildjson", type=buildjson)
args = parser.parse_args()
build = args.buildjson
@@ -90,7 +108,7 @@ def main() -> None:
except KeyError:
thing = str(stack.enter_context(get_dsc(build)).absolute())
- ret = subprocess.call(["sbuild", thing],
+ ret = subprocess.call(["sbuild", *args.sbuildopts, thing],
env=dict(SBUILD_CONFIG=sbuildconf.name,
PATH="/usr/bin:/bin"),
cwd=build["output"]["directory"],