From f0137fd9b93c99ee8ada22dbd90ff4a8a55ebb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 29 Feb 2024 10:23:17 +0100 Subject: [PATCH] kiwibuild: Work around missing arch in build data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lubomír Sedlář --- pungi/checks.py | 3 +-- pungi/phases/kiwibuild.py | 42 ++++++++++----------------------------- 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/pungi/checks.py b/pungi/checks.py index b8c21478..ead7c814 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -1228,7 +1228,7 @@ def make_schema(): "type": "object", "properties": { "target": {"type": "string"}, - "description_scm": {"type": "string"}, + "description_scm": {"type": "url"}, "description_path": {"type": "string"}, "kiwi_profile": {"type": "string"}, "release": {"type": "string"}, @@ -1241,7 +1241,6 @@ def make_schema(): "description_scm", "description_path", "kiwi_profile", - "release", ], "additionalProperties": False, }, diff --git a/pungi/phases/kiwibuild.py b/pungi/phases/kiwibuild.py index 6921d6ff..6e626ef0 100644 --- a/pungi/phases/kiwibuild.py +++ b/pungi/phases/kiwibuild.py @@ -175,27 +175,21 @@ class RunKiwiBuildThread(WorkerThread): # Ignore values that are not of required types. continue - # Get architecture of the image from extra data. - try: - arch = archive["extra"]["image"]["arch"] - except KeyError: + # HACK: there's no metadata telling which image is for which + # architecture, so we need to check the filename. + for arch in arches: + if arch in archive["filename"]: + break + else: raise RuntimeError("Image doesn't have any architecture!") # 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. - 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} + 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"]) @@ -224,21 +218,7 @@ class RunKiwiBuildThread(WorkerThread): # Get the manifest type from the config if supplied, otherwise we # determine the manifest type based on the koji output - img.type = config.get("manifest_type") - if not img.type: - if archive["type_name"] != "iso": - img.type = archive["type_name"] - else: - fn = archive["filename"].lower() - if "ostree" in fn: - img.type = "dvd-ostree-osbuild" - elif "live" in fn: - img.type = "live-osbuild" - elif "netinst" in fn or "boot" in fn: - img.type = "boot" - else: - img.type = "dvd" - + img.type = archive["type_name"] img.format = suffix img.path = os.path.join(rel_image_dir, archive["filename"]) img.mtime = util.get_mtime(image_dest)