From 8920eef3390921c7b0b88058c89bf0c774e4aa2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 2 Mar 2023 10:02:47 +0100 Subject: [PATCH] image-build/osbuild: Pull ISOs into the compose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OSBuild tasks can produce ISO files. If they do, we should include them in the compose, and we should pull them into the iso/ subdirectory together with other ISOs. Fixes: https://pagure.io/pungi/issue/1657 Signed-off-by: Lubomír Sedlář --- pungi/phases/image_build.py | 1 + pungi/phases/osbuild.py | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pungi/phases/image_build.py b/pungi/phases/image_build.py index 1e5b23e1..e1b1ba8d 100644 --- a/pungi/phases/image_build.py +++ b/pungi/phases/image_build.py @@ -25,6 +25,7 @@ from productmd.rpms import Rpms # results will be pulled into the compose. EXTENSIONS = { "docker": ["tar.gz", "tar.xz"], + "iso": ["iso"], "liveimg-squashfs": ["liveimg.squashfs"], "qcow": ["qcow"], "qcow2": ["qcow2"], diff --git a/pungi/phases/osbuild.py b/pungi/phases/osbuild.py index 2bef1636..773ecc4d 100644 --- a/pungi/phases/osbuild.py +++ b/pungi/phases/osbuild.py @@ -212,10 +212,18 @@ class RunOSBuildThread(WorkerThread): # image_dir is absolute path to which the image should be copied. # We also need the same path as relative to compose directory for # including in the metadata. - image_dir = compose.paths.compose.image_dir(variant) % {"arch": arch} - rel_image_dir = compose.paths.compose.image_dir(variant, relative=True) % { - "arch": arch - } + if archive["type_name"] == "iso": + # If the produced image is actually an ISO, it should go to + # iso/ subdirectory. + image_dir = compose.paths.compose.iso_dir(arch, variant) + rel_image_dir = compose.paths.compose.iso_dir( + arch, variant, relative=True + ) + else: + image_dir = compose.paths.compose.image_dir(variant) % {"arch": arch} + rel_image_dir = compose.paths.compose.image_dir( + variant, relative=True + ) % {"arch": arch} util.makedirs(image_dir) image_dest = os.path.join(image_dir, archive["filename"]) @@ -238,7 +246,7 @@ class RunOSBuildThread(WorkerThread): # Update image manifest img = Image(compose.im) - img.type = archive["type_name"] + img.type = archive["type_name"] if archive["type_name"] != "iso" else "dvd" img.format = suffix img.path = os.path.join(rel_image_dir, archive["filename"]) img.mtime = util.get_mtime(image_dest)