Improve autodetection of productmd image type for osbuild images

I don't love inferring the type from the filename like this -
it's kinda backwards - but it's an improvement on the current
logic (I don't think 'dvd' is ever currently the correct value
here, I don't think osbuild *can* currently build the type of
image that 'dvd' is meant to indicate). I can't immediately see
any better source of data here (we could use the 'name' or
'package_name' from 'build_info', but those are pretty much
just inputs to the filenames anyway).

Types that are possible in productmd but not covered here are
'cd' (never likely to be used again in Fedora at least, not sure
about RHEL), 'dvd-debuginfo' (again not used in Fedora, may be
used in RHEL), 'ec2', 'kvm' (not sure about those), 'netinst'
(this is a synonym for 'boot', we use 'boot' in practice in
Fedora metadata), 'p2v' and 'rescue' (not sure).

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2023-11-03 11:04:54 -07:00
parent b32c8f3e5e
commit aa7fcc1c20

View File

@ -252,10 +252,20 @@ class RunOSBuildThread(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( img.type = config.get("manifest_type")
"manifest_type", if not img.type:
archive["type_name"] if archive["type_name"] != "iso" else "dvd", 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"])