From aa7fcc1c207f1af83c3206d08d94a8b6dafc090c Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 3 Nov 2023 11:04:54 -0700 Subject: [PATCH] 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 --- pungi/phases/osbuild.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pungi/phases/osbuild.py b/pungi/phases/osbuild.py index 19bc23e2..34be17c8 100644 --- a/pungi/phases/osbuild.py +++ b/pungi/phases/osbuild.py @@ -252,10 +252,20 @@ class RunOSBuildThread(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", - archive["type_name"] if archive["type_name"] != "iso" else "dvd", - ) + 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"])