diff options
Diffstat (limited to 'mdbp/pbuilder.py')
-rw-r--r-- | mdbp/pbuilder.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/mdbp/pbuilder.py b/mdbp/pbuilder.py index 7208152..d408533 100644 --- a/mdbp/pbuilder.py +++ b/mdbp/pbuilder.py @@ -5,8 +5,10 @@ import argparse import os import pathlib +import shlex import subprocess import sys +import tempfile from .common import buildjson, compute_env, get_dsc, make_option, \ profile_option @@ -60,8 +62,16 @@ def main() -> None: cmd.extend(["--buildresult", build["output"]["directory"]]) if not enablelog: cmd.extend(["--loglevel", "E"]) - with get_dsc(build) as dscpath: - cmd.append(str(dscpath)) + with tempfile.TemporaryDirectory() as hookdirn, get_dsc(build) as dscpath: + hookdir = pathlib.Path(hookdirn) + hook = hookdir / "D50aptupdate" + hook.write_text("""#/bin/sh +set -e +apt-get update +apt-get -oAPT::Keep-Downloaded-Path=false --yes dist-upgrade +""") + hook.chmod(0o755) + cmd.extend(["--hookdir", hookdirn, str(dscpath)]) proc = subprocess.Popen(cmd, env=compute_env(build), stdout=None if enablelog else subprocess.DEVNULL, |