Move temporary buildinstall download to work/

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ář <lsedlar@redhat.com>
(cherry picked from commit e4d1bd4783de28b34ec289d6218205756ee916ad)
This commit is contained in:
Lubomír Sedlář 2025-01-23 10:00:41 +01:00 committed by Stepan Oksanichenko
parent f3dcb036a5
commit a034b8b977

View File

@ -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)