summaryrefslogtreecommitdiff
path: root/mdbp/pbuilder.py
diff options
context:
space:
mode:
Diffstat (limited to 'mdbp/pbuilder.py')
-rw-r--r--mdbp/pbuilder.py12
1 files changed, 7 insertions, 5 deletions
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"