diff --git a/internal/distro/rhel9/arch.go b/internal/distro/rhel9/arch.go index d0d6c5105..446028797 100644 --- a/internal/distro/rhel9/arch.go +++ b/internal/distro/rhel9/arch.go @@ -6,6 +6,7 @@ import ( "sort" "github.com/osbuild/osbuild-composer/internal/distro" + "github.com/osbuild/osbuild-composer/internal/platform" ) type architecture struct { @@ -45,13 +46,14 @@ func (a *architecture) GetImageType(name string) (distro.ImageType, error) { return t, nil } -func (a *architecture) addImageTypes(imageTypes ...imageType) { +func (a *architecture) addImageTypes(platform platform.Platform, imageTypes ...imageType) { if a.imageTypes == nil { a.imageTypes = map[string]distro.ImageType{} } for idx := range imageTypes { it := imageTypes[idx] it.arch = a + it.platform = platform a.imageTypes[it.name] = &it for _, alias := range it.nameAliases { if a.imageTypeAliases == nil { diff --git a/internal/distro/rhel9/distro.go b/internal/distro/rhel9/distro.go index 2c8a1b7d9..8829310bb 100644 --- a/internal/distro/rhel9/distro.go +++ b/internal/distro/rhel9/distro.go @@ -11,6 +11,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/distro" "github.com/osbuild/osbuild-composer/internal/osbuild" "github.com/osbuild/osbuild-composer/internal/oscap" + "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/runner" ) @@ -1045,24 +1046,26 @@ func newDistro(name string, major, minor int) distro.Distro { ociImgType := qcow2ImgType ociImgType.name = "oci" - x86_64.addImageTypes(qcow2ImgType, vmdkImgType, openstackImgType, amiImgTypeX86_64, tarImgType, imageInstaller, edgeCommitImgType, edgeInstallerImgType, edgeOCIImgType, edgeRawImgType, edgeSimplifiedInstallerImgType, ociImgType, gceImgType) - aarch64.addImageTypes(qcow2ImgType, openstackImgType, amiImgTypeAarch64, tarImgType, imageInstaller, edgeCommitImgType, edgeInstallerImgType, edgeOCIImgType, edgeRawImgType, edgeSimplifiedInstallerImgType) - ppc64le.addImageTypes(qcow2ImgType, tarImgType) - s390x.addImageTypes(qcow2ImgType, tarImgType) + var emptyPlat platform.Platform + + x86_64.addImageTypes(emptyPlat, qcow2ImgType, vmdkImgType, openstackImgType, amiImgTypeX86_64, tarImgType, imageInstaller, edgeCommitImgType, edgeInstallerImgType, edgeOCIImgType, edgeRawImgType, edgeSimplifiedInstallerImgType, ociImgType, gceImgType) + aarch64.addImageTypes(emptyPlat, qcow2ImgType, openstackImgType, amiImgTypeAarch64, tarImgType, imageInstaller, edgeCommitImgType, edgeInstallerImgType, edgeOCIImgType, edgeRawImgType, edgeSimplifiedInstallerImgType) + ppc64le.addImageTypes(emptyPlat, qcow2ImgType, tarImgType) + s390x.addImageTypes(emptyPlat, qcow2ImgType, tarImgType) if rd.isRHEL() { // add azure to RHEL distro only - x86_64.addImageTypes(azureRhuiImgType) - x86_64.addImageTypes(azureByosImgType) + x86_64.addImageTypes(emptyPlat, azureRhuiImgType) + x86_64.addImageTypes(emptyPlat, azureByosImgType) // add ec2 image types to RHEL distro only - x86_64.addImageTypes(ec2ImgTypeX86_64, ec2HaImgTypeX86_64, ec2SapImgTypeX86_64) - aarch64.addImageTypes(ec2ImgTypeAarch64) + x86_64.addImageTypes(emptyPlat, ec2ImgTypeX86_64, ec2HaImgTypeX86_64, ec2SapImgTypeX86_64) + aarch64.addImageTypes(emptyPlat, ec2ImgTypeAarch64) // add GCE RHUI image to RHEL only - x86_64.addImageTypes(gceRhuiImgType) + x86_64.addImageTypes(emptyPlat, gceRhuiImgType) } else { - x86_64.addImageTypes(azureImgType) + x86_64.addImageTypes(emptyPlat, azureImgType) } rd.addArches(x86_64, aarch64, ppc64le, s390x) return &rd diff --git a/internal/distro/rhel9/imagetype.go b/internal/distro/rhel9/imagetype.go index 576672790..8452f0359 100644 --- a/internal/distro/rhel9/imagetype.go +++ b/internal/distro/rhel9/imagetype.go @@ -14,6 +14,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/osbuild" "github.com/osbuild/osbuild-composer/internal/oscap" "github.com/osbuild/osbuild-composer/internal/ostree" + "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/rpmmd" ) @@ -42,6 +43,7 @@ type packageSetFunc func(t *imageType) rpmmd.PackageSet type imageType struct { arch *architecture + platform platform.Platform name string nameAliases []string filename string