From 43b4aafecbe355a72aed4ef2819423e7e8d8e600 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Tue, 18 May 2021 18:25:18 +0200 Subject: 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. --- mdbp/sbuild.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'mdbp/sbuild.py') 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"], -- cgit v1.2.3