From 70813c6261128ee5fa1f5396570e9e9f598caee4 Mon Sep 17 00:00:00 2001 From: themylogin Date: Wed, 8 Jan 2025 09:27:29 +0100 Subject: [PATCH] Fix `.squashfs` files not being cleaned up (cherry picked from commit 50c9da0d23562213dac14d34f563cfae7ba174e4) --- scale_build/image/update.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scale_build/image/update.py b/scale_build/image/update.py index ffba6273..62832084 100644 --- a/scale_build/image/update.py +++ b/scale_build/image/update.py @@ -232,10 +232,10 @@ def build_extensions(): run(["mksquashfs", td, f"{sysext_extensions_dir}/functioning-dpkg.raw"]) - with tempfile.NamedTemporaryFile(suffix=".squashfs") as tf: - tf.close() - run(["mksquashfs", CHROOT_BASEDIR, tf.name, "-one-file-system"]) - do_build_extensions(tf.name, sysext_extensions_dir) + with tempfile.TemporaryDirectory() as td: + rootfs_image = f"{td}/rootfs.squashfs" + run(["mksquashfs", CHROOT_BASEDIR, rootfs_image, "-one-file-system"]) + do_build_extensions(rootfs_image, sysext_extensions_dir) external_extesions_dir = os.path.join(RELEASE_DIR, "extensions") os.makedirs(external_extesions_dir, exist_ok=True)