diff --git a/pungi/phases/image_build.py b/pungi/phases/image_build.py index cb76c1aa..cd034cd2 100644 --- a/pungi/phases/image_build.py +++ b/pungi/phases/image_build.py @@ -22,10 +22,13 @@ from productmd.rpms import Rpms # This is a mapping from formats to file extensions. The format is what koji # image-build command expects as argument, and the extension is what the file # name will be ending with. The extensions are used to filter out which task -# results will be pulled into the compose. +# results will be pulled into the compose. This dict is also used later in +# the process to set the image 'type' in productmd metadata terms - the type +# is set as the first key in this dict which has the file's extension in its +# values. This dict is imported and extended for similar purposes by other +# phases (at least osbuild and kiwibuild). EXTENSIONS = { "docker": ["tar.gz", "tar.xz"], - "iso": ["iso"], "liveimg-squashfs": ["liveimg.squashfs"], "qcow": ["qcow"], "qcow2": ["qcow2"], @@ -40,7 +43,6 @@ EXTENSIONS = { "vdi": ["vdi"], "vmdk": ["vmdk"], "vpc": ["vhd"], - "vhd-compressed": ["vhd.gz", "vhd.xz"], "vsphere-ova": ["vsphere.ova"], } diff --git a/pungi/phases/kiwibuild.py b/pungi/phases/kiwibuild.py index bb268125..15732cea 100644 --- a/pungi/phases/kiwibuild.py +++ b/pungi/phases/kiwibuild.py @@ -15,6 +15,10 @@ KIWIEXTENSIONS = [ ("vhd-compressed", ["vhdfixed.xz"], "vhd.xz"), ("vagrant-libvirt", ["vagrant.libvirt.box"], "vagrant-libvirt.box"), ("vagrant-virtualbox", ["vagrant.virtualbox.box"], "vagrant-virtualbox.box"), + # .iso images can be of many types - boot, cd, dvd, live... - + # so 'boot' is just a default guess. 'iso' is not a valid + # productmd image type + ("boot", [".iso"], "iso"), ] diff --git a/pungi/phases/osbuild.py b/pungi/phases/osbuild.py index 6c5b7e5a..a3b5c9b8 100644 --- a/pungi/phases/osbuild.py +++ b/pungi/phases/osbuild.py @@ -11,6 +11,16 @@ from ..linker import Linker from ..wrappers import kojiwrapper from .image_build import EXTENSIONS +# copy and modify EXTENSIONS with some that osbuild produces but which +# do not exist as `koji image-build` formats +OSBUILDEXTENSIONS = EXTENSIONS.copy() +OSBUILDEXTENSIONS.update( + { + "iso": ["iso"], + "vhd-compressed": ["vhd.gz", "vhd.xz"], + } +) + class OSBuildPhase( base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigGuardedPhase @@ -203,7 +213,7 @@ class RunOSBuildThread(WorkerThread): # architecture, but we don't verify that. build_info = koji.koji_proxy.getBuild(build_id) for archive in koji.koji_proxy.listArchives(buildID=build_id): - if archive["type_name"] not in EXTENSIONS: + if archive["type_name"] not in OSBUILDEXTENSIONS: # Ignore values that are not of required types. continue @@ -241,7 +251,7 @@ class RunOSBuildThread(WorkerThread): linker.link(src_file, image_dest, link_type=compose.conf["link_type"]) - for suffix in EXTENSIONS[archive["type_name"]]: + for suffix in OSBUILDEXTENSIONS[archive["type_name"]]: if archive["filename"].endswith(suffix): break else: