From a034b8b97782081fe1ea2d8a5920b6704f81d5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 23 Jan 2025 10:00:41 +0100 Subject: [PATCH] Move temporary buildinstall download to work/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The files should always be cleaned up immediately after the archive is extracted, but we are seeing them being left behind for some reason. With this page, even if the data is not cleaned up, it will not clog up /tmp and be eventually deleted together with the compose. JIRA: RHELCMP-14319 Signed-off-by: Lubomír Sedlář (cherry picked from commit e4d1bd4783de28b34ec289d6218205756ee916ad) --- pungi/runroot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pungi/runroot.py b/pungi/runroot.py index ea924d23..4f08ce75 100644 --- a/pungi/runroot.py +++ b/pungi/runroot.py @@ -454,6 +454,9 @@ def download_and_extract_archive(compose, task_id, fname, destination): # So instead let's generate a patch and attempt to convert it to a URL. server_path = os.path.join(koji.pathinfo.task(task_id), fname) archive_url = server_path.replace(koji.config.topdir, koji.config.topurl) - with util.temp_dir(prefix="buildinstall-download") as tmp_dir: + tmp_dir = compose.mkdtemp(prefix="buildinstall-download") + try: local_path = _download_archive(task_id, fname, archive_url, tmp_dir) _extract_archive(task_id, fname, local_path, destination) + finally: + shutil.rmtree(tmp_dir)