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", "type": "object",
"properties": { "properties": {
"target": {"type": "string"}, "target": {"type": "string"},
"description_scm": {"type": "string"}, "description_scm": {"type": "url"},
"description_path": {"type": "string"}, "description_path": {"type": "string"},
"kiwi_profile": {"type": "string"}, "kiwi_profile": {"type": "string"},
"release": {"type": "string"}, "release": {"type": "string"},
@ -1254,7 +1254,6 @@ def make_schema():
"description_scm", "description_scm",
"description_path", "description_path",
"kiwi_profile", "kiwi_profile",
"release",
], ],
"additionalProperties": False, "additionalProperties": False,
}, },

View File

@ -175,27 +175,21 @@ class RunKiwiBuildThread(WorkerThread):
# Ignore values that are not of required types. # Ignore values that are not of required types.
continue continue
# Get architecture of the image from extra data. # HACK: there's no metadata telling which image is for which
try: # architecture, so we need to check the filename.
arch = archive["extra"]["image"]["arch"] for arch in arches:
except KeyError: if arch in archive["filename"]:
break
else:
raise RuntimeError("Image doesn't have any architecture!") raise RuntimeError("Image doesn't have any architecture!")
# image_dir is absolute path to which the image should be copied. # image_dir is absolute path to which the image should be copied.
# We also need the same path as relative to compose directory for # We also need the same path as relative to compose directory for
# including in the metadata. # including in the metadata.
if archive["type_name"] == "iso": image_dir = compose.paths.compose.image_dir(variant) % {"arch": arch}
# If the produced image is actually an ISO, it should go to rel_image_dir = compose.paths.compose.image_dir(
# iso/ subdirectory. variant, relative=True
image_dir = compose.paths.compose.iso_dir(arch, variant) ) % {"arch": arch}
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) util.makedirs(image_dir)
image_dest = os.path.join(image_dir, archive["filename"]) 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 # Get the manifest type from the config if supplied, otherwise we
# determine the manifest type based on the koji output # determine the manifest type based on the koji output
img.type = config.get("manifest_type") img.type = archive["type_name"]
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.format = suffix
img.path = os.path.join(rel_image_dir, archive["filename"]) img.path = os.path.join(rel_image_dir, archive["filename"])
img.mtime = util.get_mtime(image_dest) img.mtime = util.get_mtime(image_dest)