taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit a0e3b2f63ec76c364a282654643406d9d92a821c
parent f1de1b36d1fe04692a457c989a3f93903ef915f8
Author: Florian Dold <florian@dold.me>
Date:   Fri, 21 Nov 2025 00:19:53 +0100

cache debian packages

Diffstat:
Mpackaging/ng/distros/Dockerfile.ubuntu-noble | 5++++-
Mpackaging/ng/taler-pkg | 34+++++++++++++++++++++++++++++-----
2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/packaging/ng/distros/Dockerfile.ubuntu-noble b/packaging/ng/distros/Dockerfile.ubuntu-noble @@ -6,8 +6,11 @@ FROM ubuntu:noble ARG DEBIAN_FRONTEND=noninteractive -# Install dependencies +# Install dependencies. +# Disable the apt config that inhibits caching. RUN \ + rm -f /etc/apt/apt.conf.d/docker-clean \ + && \ apt-get update \ && \ apt-get -y full-upgrade \ diff --git a/packaging/ng/taler-pkg b/packaging/ng/taler-pkg @@ -133,14 +133,28 @@ def build(cfg): dockerfile = f"distros/Dockerfile.{distro}" image_tag = f"taler-packaging-{distro}:latest" pkgdir = Path(f"packages/{distro}").absolute() - cachedir = Path(f"cache") + cachedir = Path(f"cache").absolute() cachedir.mkdir(exist_ok=True) (cachedir / "cargo-git").mkdir(exist_ok=True) (cachedir / "cargo-registry").mkdir(exist_ok=True) + (cachedir / distro / "apt-archives").mkdir(parents=True, exist_ok=True) + (cachedir / distro / "apt-lists").mkdir(parents=True, exist_ok=True) if not cfg.dry: subprocess.run( - ["podman", "build", "-t", image_tag, "-f", dockerfile], check=True + [ + "podman", + "build", + "-v", + f"{cachedir}/{distro}/apt-archives:/var/cache/apt/archives:z", + "-v", + f"{cachedir}/{distro}/apt-lists:/var/lib/apt/lists:z", + "-t", + image_tag, + "-f", + dockerfile, + ], + check=True, ) # Sort components by their dependencies @@ -175,6 +189,10 @@ def build(cfg): "--mount", f"type=bind,source={cachedir}/cargo-git,target=/root/.cargo/git", "--mount", + f"type=bind,source={cachedir}/{distro}/apt-archives,target=/var/cache/apt/archives,relabel=shared", + "--mount", + f"type=bind,source={cachedir}/{distro}/apt-lists,target=/var/lib/apt/lists,relabel=shared", + "--mount", f"type=bind,source={mydir}/buildscripts,target=/buildscripts,readonly", "--mount", f"type=bind,source={mydir}/buildconfig,target=/buildconfig,readonly", @@ -192,7 +210,6 @@ def build(cfg): ) - def show_order(cfg): buildorder = buildsort(list(cfg.roots)) print("build order:", buildorder) @@ -328,7 +345,9 @@ def publish(cfg): ) if ret.returncode != 0: # Usually not critical if it fails. - print("Including debs failed. This can happen when including packages that have been included previously") + print( + "Including debs failed. This can happen when including packages that have been included previously" + ) # almost the same, but with ddebs ret = subprocess.run( [ @@ -340,7 +359,9 @@ def publish(cfg): ) if ret.returncode != 0: # Usually not critical if it fails. - print("Including ddebs failed. This can happen when including packages that have been included previously") + print( + "Including ddebs failed. This can happen when including packages that have been included previously" + ) # Always export! # Reprepro is weird, listed packages might actually not show # up in the index yet. @@ -354,6 +375,7 @@ def publish(cfg): check=True, ) + def get_remote_version(url): """Get the latest stable tag from the git repo""" # Construct the git command @@ -410,6 +432,7 @@ def check_version(name, url): prefix = "[!] " if curr != ver else "" print(f"{prefix}{name} curr: {curr} latest: {ver}") + def print_latest(cfg): """Print latest upstream tag for each component""" for name in components: @@ -418,6 +441,7 @@ def print_latest(cfg): giturl = f.read().strip() check_version(name, giturl) + def main(): parser = argparse.ArgumentParser( prog="taler-pkg", description="Taler Packaging Helper"