Add ability to download images

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ář <lsedlar@redhat.com>
(cherry picked from commit bf3e9bc53a)
This commit is contained in:
Lubomír Sedlář 2023-01-19 16:43:17 +01:00 committed by Stepan Oksanichenko
parent f6f54b56ca
commit f5a0e06af5
Signed by: soksanichenko
GPG Key ID: AB9983172AB1E45B
4 changed files with 12 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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