From d18841b1c6729cfca1da0f0c91900a08c396a4f1 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 8 Jul 2021 09:11:10 +0200 Subject: uninline helper function temporary_static_file --- mdbp/pbuilder.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'mdbp/pbuilder.py') diff --git a/mdbp/pbuilder.py b/mdbp/pbuilder.py index b42e2c7..f1c48e3 100644 --- a/mdbp/pbuilder.py +++ b/mdbp/pbuilder.py @@ -12,7 +12,8 @@ import sys import tempfile from .common import AddSpaceSeparatedValues, buildjson, clean_dir, \ - compute_env, get_dsc, make_option, profile_option + compute_env, get_dsc, make_option, profile_option, \ + temporary_static_file def main() -> None: """Entry point for mdbp-pbuilder backend""" @@ -80,10 +81,11 @@ def main() -> None: apt_get = ["apt-get", "-oAPT::Keep-Downloaded-Path=false", "--yes"] with contextlib.ExitStack() as stack: if build.get("build_path"): - rcfile = stack.enter_context(tempfile.NamedTemporaryFile("w")) - rcfile.write("BUILDDIR=%s\n" % shlex.quote(build["build_path"])) - rcfile.flush() - cmd.extend(["--configfile", rcfile.name]) + pbuilderrc = "BUILDDIR=%s\n" % shlex.quote(build["build_path"]) + cmd.extend([ + "--configfile", + str(stack.enter_context(temporary_static_file(pbuilderrc))), + ]) hookdir = pathlib.Path( stack.enter_context(tempfile.TemporaryDirectory())) hook = hookdir / "D50aptupdate" -- cgit v1.2.3