summaryrefslogtreecommitdiff
path: root/mdbp/sbuild.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2021-05-18 18:25:18 +0200
committerHelmut Grohne <helmut@subdivi.de>2021-05-18 18:25:18 +0200
commit43b4aafecbe355a72aed4ef2819423e7e8d8e600 (patch)
treec80a6cf92bf145de164f9b066a504e737b9d5f5b /mdbp/sbuild.py
parentb6f54633e5b4cafa851fdec80e8e982d46109be3 (diff)
downloadmdbp-43b4aafecbe355a72aed4ef2819423e7e8d8e600.tar.gz
enable building a source package by name and version
If a package is specified by name, it is downloaded inside the chroot using the embedded deb-src uris. sbuild implements this natively, pbuilder does not implement this yet, but there is #988419 and mmdebstrap can make it work.
Diffstat (limited to 'mdbp/sbuild.py')
-rw-r--r--mdbp/sbuild.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/mdbp/sbuild.py b/mdbp/sbuild.py
index ef6b67d..defd0bc 100644
--- a/mdbp/sbuild.py
+++ b/mdbp/sbuild.py
@@ -75,11 +75,19 @@ def main() -> None:
sbc["external_commands"]["finished-build-commands"] = \
["mv /etc/resolv.conf.disabled /etc/resolv.conf"]
- with tempfile.NamedTemporaryFile(mode="w") as sbuildconf, \
- get_dsc(build) as dscpath:
+ with contextlib.ExitStack() as stack:
+ sbuildconf = stack.enter_context(tempfile.NamedTemporaryFile(mode="w"))
sbuildconf.write(perl_conf(sbc))
sbuildconf.flush()
- proc = subprocess.Popen(["sbuild", str(dscpath.absolute())],
+
+ try:
+ thing = build["input"]["sourcename"]
+ with contextlib.suppress(KeyError):
+ thing += "_" + build["input"]["version"]
+ 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"],