From f46c1e774b6a8b6ee10eac14c40ae60608259d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 29 Nov 2023 11:47:08 +0100 Subject: [PATCH] Don't add a file for Ubuntu in Debian container --- c2cciutils/scripts/docker_versions_update.py | 31 ++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/c2cciutils/scripts/docker_versions_update.py b/c2cciutils/scripts/docker_versions_update.py index c442031d8..e1a3af507 100644 --- a/c2cciutils/scripts/docker_versions_update.py +++ b/c2cciutils/scripts/docker_versions_update.py @@ -51,22 +51,23 @@ def main() -> None: ], check=True, ) - # Create a temporary file - with tempfile.NamedTemporaryFile(mode="w", encoding=("utf-8")) as sources_list: - sources_list.write( - "\n".join( - [ - f"deb http://archive.ubuntu.com/ubuntu/ {dist_name}-security main restricted", - f"deb http://archive.ubuntu.com/ubuntu/ {dist_name}-security universe", - f"deb http://archive.ubuntu.com/ubuntu/ {dist_name}-security multiverse", - "", - ] + if images == "ubuntu": + with tempfile.NamedTemporaryFile(mode="w", encoding=("utf-8")) as sources_list: + sources_list.write( + "\n".join( + [ + f"deb http://archive.ubuntu.com/ubuntu/ {dist_name}-security main restricted", + f"deb http://archive.ubuntu.com/ubuntu/ {dist_name}-security universe", + f"deb http://archive.ubuntu.com/ubuntu/ {dist_name}-security multiverse", + "", + ] + ) + ) + sources_list.flush() + subprocess.run( + ["docker", "cp", sources_list.name, "apt:/etc/apt/sources.list"], + check=True, ) - ) - sources_list.flush() - subprocess.run( - ["docker", "cp", sources_list.name, "apt:/etc/apt/sources.list"], check=True - ) subprocess.run(["docker", "exec", "apt", "apt-get", "update"], check=True)