move osbuild/kiwi-specific EXTENSIONS to each phase
The image-build phase's EXTENSIONS dict is meant to exactly mirror the 'formats' that exist in the context of the command `koji image-build`, which is driven by this phase. That nice association was lost, however, by adding a couple of items to it which exist for the purposes of the osbuild phase (and in the case of .iso, also the kiwibuild phase), which import this dict and uses it for image identification. To make the association 1:1 again and more clearly show what's going on here, let's move those entries out into the osbuild and kiwi phases. osbuild now has its own dict which starts out as a copy of the image-build one before being extended. And let's update the relevant comments. Signed-off-by: Adam Williamson <awilliam@redhat.com> (cherry picked from commit 5338d3098ccd614a8fd32f837a393aed78b471bd)
This commit is contained in:
parent
9594954287
commit
53c273f025
@ -22,10 +22,13 @@ from productmd.rpms import Rpms
|
|||||||
# This is a mapping from formats to file extensions. The format is what koji
|
# 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
|
# 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
|
# 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 = {
|
EXTENSIONS = {
|
||||||
"docker": ["tar.gz", "tar.xz"],
|
"docker": ["tar.gz", "tar.xz"],
|
||||||
"iso": ["iso"],
|
|
||||||
"liveimg-squashfs": ["liveimg.squashfs"],
|
"liveimg-squashfs": ["liveimg.squashfs"],
|
||||||
"qcow": ["qcow"],
|
"qcow": ["qcow"],
|
||||||
"qcow2": ["qcow2"],
|
"qcow2": ["qcow2"],
|
||||||
@ -40,7 +43,6 @@ EXTENSIONS = {
|
|||||||
"vdi": ["vdi"],
|
"vdi": ["vdi"],
|
||||||
"vmdk": ["vmdk"],
|
"vmdk": ["vmdk"],
|
||||||
"vpc": ["vhd"],
|
"vpc": ["vhd"],
|
||||||
"vhd-compressed": ["vhd.gz", "vhd.xz"],
|
|
||||||
"vsphere-ova": ["vsphere.ova"],
|
"vsphere-ova": ["vsphere.ova"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,10 @@ KIWIEXTENSIONS = [
|
|||||||
("vhd-compressed", ["vhdfixed.xz"], "vhd.xz"),
|
("vhd-compressed", ["vhdfixed.xz"], "vhd.xz"),
|
||||||
("vagrant-libvirt", ["vagrant.libvirt.box"], "vagrant-libvirt.box"),
|
("vagrant-libvirt", ["vagrant.libvirt.box"], "vagrant-libvirt.box"),
|
||||||
("vagrant-virtualbox", ["vagrant.virtualbox.box"], "vagrant-virtualbox.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"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,16 @@ from ..linker import Linker
|
|||||||
from ..wrappers import kojiwrapper
|
from ..wrappers import kojiwrapper
|
||||||
from .image_build import EXTENSIONS
|
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(
|
class OSBuildPhase(
|
||||||
base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigGuardedPhase
|
base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigGuardedPhase
|
||||||
@ -203,7 +213,7 @@ class RunOSBuildThread(WorkerThread):
|
|||||||
# architecture, but we don't verify that.
|
# architecture, but we don't verify that.
|
||||||
build_info = koji.koji_proxy.getBuild(build_id)
|
build_info = koji.koji_proxy.getBuild(build_id)
|
||||||
for archive in koji.koji_proxy.listArchives(buildID=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.
|
# Ignore values that are not of required types.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -241,7 +251,7 @@ class RunOSBuildThread(WorkerThread):
|
|||||||
|
|
||||||
linker.link(src_file, image_dest, link_type=compose.conf["link_type"])
|
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):
|
if archive["filename"].endswith(suffix):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user