diff options
author | Helmut Grohne <helmut@subdivi.de> | 2021-05-19 06:33:41 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2021-05-19 06:33:41 +0200 |
commit | 458255cd158c8fe4545b88c604749b185ecb4e57 (patch) | |
tree | 64d3f96adf872d0f20fac4495d2e79db52ed9b30 /mdbp/pbuilder.py | |
parent | 01e503fb91baf230b22c09a930c89ca2dab2b154 (diff) | |
download | mdbp-458255cd158c8fe4545b88c604749b185ecb4e57.tar.gz |
pbuilder: always update and upgrade the chroot
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, |