From bf3e9bc53a2dffed7fbe206844a59ad20aa6f68e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 19 Jan 2023 16:43:17 +0100 Subject: [PATCH] Add ability to download images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch extends the ability to download files from Koji to image building phases too. There is no integrity checking for the downloaded images. Signed-off-by: Lubomír Sedlář --- pungi/phases/image_build.py | 4 +++- pungi/phases/live_images.py | 2 +- pungi/phases/livemedia_phase.py | 4 +++- pungi/phases/osbuild.py | 7 +++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pungi/phases/image_build.py b/pungi/phases/image_build.py index e1b1ba8d..cb76c1aa 100644 --- a/pungi/phases/image_build.py +++ b/pungi/phases/image_build.py @@ -346,7 +346,9 @@ class CreateImageBuildThread(WorkerThread): # let's not change filename of koji outputs image_dest = os.path.join(image_dir, os.path.basename(image_info["path"])) - src_file = os.path.realpath(image_info["path"]) + src_file = compose.koji_downloader.get_file( + os.path.realpath(image_info["path"]) + ) linker.link(src_file, image_dest, link_type=cmd["link_type"]) # Update image manifest diff --git a/pungi/phases/live_images.py b/pungi/phases/live_images.py index 102e0fd3..3f1f158a 100644 --- a/pungi/phases/live_images.py +++ b/pungi/phases/live_images.py @@ -232,7 +232,7 @@ class CreateLiveImageThread(WorkerThread): "Got %d images from task %d, expected 1." % (len(image_path), output["task_id"]) ) - image_path = image_path[0] + image_path = compose.koji_downloader.get_file(image_path[0]) filename = cmd.get("filename") or os.path.basename(image_path) destination = os.path.join(cmd["dest_dir"], filename) shutil.copy2(image_path, destination) diff --git a/pungi/phases/livemedia_phase.py b/pungi/phases/livemedia_phase.py index f28c68a3..51cc1d6c 100644 --- a/pungi/phases/livemedia_phase.py +++ b/pungi/phases/livemedia_phase.py @@ -182,7 +182,9 @@ class LiveMediaThread(WorkerThread): # let's not change filename of koji outputs image_dest = os.path.join(image_dir, os.path.basename(image_info["path"])) - src_file = os.path.realpath(image_info["path"]) + src_file = compose.koji_downloader.get_file( + os.path.realpath(image_info["path"]) + ) linker.link(src_file, image_dest, link_type=link_type) # Update image manifest diff --git a/pungi/phases/osbuild.py b/pungi/phases/osbuild.py index 773ecc4d..aef1f008 100644 --- a/pungi/phases/osbuild.py +++ b/pungi/phases/osbuild.py @@ -228,8 +228,11 @@ class RunOSBuildThread(WorkerThread): image_dest = os.path.join(image_dir, archive["filename"]) - src_file = os.path.join( - koji.koji_module.pathinfo.imagebuild(build_info), archive["filename"] + src_file = compose.koji_downloader.get_file( + os.path.join( + koji.koji_module.pathinfo.imagebuild(build_info), + archive["filename"], + ), ) linker.link(src_file, image_dest, link_type=compose.conf["link_type"])