kiwibuild: Work around missing arch in build data

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
(cherry picked from commit f0137fd9b9)
This commit is contained in:
Lubomír Sedlář 2024-02-29 10:23:17 +01:00 committed by Stepan Oksanichenko
parent 6aa674fbb3
commit a3dcec5059
Signed by: soksanichenko
GPG Key ID: AB9983172AB1E45B
2 changed files with 12 additions and 33 deletions

View File

@ -1241,7 +1241,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"},
@ -1254,7 +1254,6 @@ def make_schema():
"description_scm",
"description_path",
"kiwi_profile",
"release",
],
"additionalProperties": False,
},

View File

@ -175,23 +175,17 @@ 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
@ -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.format = suffix
img.path = os.path.join(rel_image_dir, archive["filename"])
img.mtime = util.get_mtime(image_dest)