distro/rhel9: add platform to image type

Add platform attribute to imageType like we do in Fedora.
Currently this has no effect.
This commit is contained in:
Achilleas Koutsou 2022-10-17 20:39:38 +02:00 committed by Christian Kellner
parent 1584770307
commit a0e05ea192
3 changed files with 18 additions and 11 deletions

View file

@ -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 {

View file

@ -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

View file

@ -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