distro/rhel85: refactor pkg set generation
Instead of using package sets at the distro, arch and image type level and then merging them in `PackageSets`, store the function that generates the package set in the image type and have them return all the package set. In order to do so, they now take an imageType parameter so that they can also return architecture dependent packages.
This commit is contained in:
parent
0e9e1b32d4
commit
714250aa9c
2 changed files with 197 additions and 165 deletions
|
|
@ -28,21 +28,9 @@ const (
|
|||
// build package set name
|
||||
buildPkgsKey = "build"
|
||||
|
||||
// Legacy bootable image package set name
|
||||
bootLegacyPkgsKey = "boot.legacy"
|
||||
|
||||
// UEFI bootable image package set name
|
||||
bootUEFIPkgsKey = "boot.uefi"
|
||||
|
||||
// main/common os image package set name
|
||||
osPkgsKey = "packages"
|
||||
|
||||
// edge os image package set name
|
||||
edgePkgsKey = "edge"
|
||||
|
||||
// edge build package set name
|
||||
edgeBuildPkgsKey = "build.edge"
|
||||
|
||||
// container package set name
|
||||
containerPkgsKey = "container"
|
||||
|
||||
|
|
@ -117,7 +105,6 @@ type architecture struct {
|
|||
name string
|
||||
imageTypes map[string]distro.ImageType
|
||||
imageTypeAliases map[string]string
|
||||
packageSets map[string]rpmmd.PackageSet
|
||||
legacy string
|
||||
bootType distro.BootType
|
||||
}
|
||||
|
|
@ -176,13 +163,15 @@ func (a *architecture) Distro() distro.Distro {
|
|||
|
||||
type pipelinesFunc func(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error)
|
||||
|
||||
type packageSetFunc func(t *imageType) rpmmd.PackageSet
|
||||
|
||||
type imageType struct {
|
||||
arch *architecture
|
||||
name string
|
||||
nameAliases []string
|
||||
filename string
|
||||
mimeType string
|
||||
packageSets map[string]rpmmd.PackageSet
|
||||
packageSets map[string]packageSetFunc
|
||||
enabledServices []string
|
||||
disabledServices []string
|
||||
defaultTarget string
|
||||
|
|
@ -238,6 +227,15 @@ func (t *imageType) Size(size uint64) uint64 {
|
|||
return size
|
||||
}
|
||||
|
||||
func (t *imageType) getPackages(name string) rpmmd.PackageSet {
|
||||
getter := t.packageSets[name]
|
||||
if getter == nil {
|
||||
return rpmmd.PackageSet{}
|
||||
}
|
||||
|
||||
return getter(t)
|
||||
}
|
||||
|
||||
func (t *imageType) PackageSets(bp blueprint.Blueprint) map[string]rpmmd.PackageSet {
|
||||
// merge package sets that appear in the image type with the package sets
|
||||
// of the same name from the distro and arch
|
||||
|
|
@ -245,9 +243,8 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint) map[string]rpmmd.Package
|
|||
|
||||
imageSets := t.packageSets
|
||||
|
||||
archSets := t.arch.packageSets
|
||||
for name := range imageSets {
|
||||
mergedSets[name] = imageSets[name].Append(archSets[name])
|
||||
mergedSets[name] = t.getPackages(name)
|
||||
}
|
||||
|
||||
if _, hasPackages := imageSets[osPkgsKey]; !hasPackages {
|
||||
|
|
@ -260,36 +257,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint) map[string]rpmmd.Package
|
|||
panic(fmt.Sprintf("'%s' image type has no '%s' package set defined", t.name, buildPkgsKey))
|
||||
}
|
||||
|
||||
// package sets from flags
|
||||
if t.bootable {
|
||||
var addLegacyBootPkg bool
|
||||
var addUEFIBootPkg bool
|
||||
|
||||
switch bt := t.getBootType(); bt {
|
||||
case distro.LegacyBootType:
|
||||
addLegacyBootPkg = true
|
||||
case distro.UEFIBootType:
|
||||
addUEFIBootPkg = true
|
||||
case distro.HybridBootType:
|
||||
addLegacyBootPkg = true
|
||||
addUEFIBootPkg = true
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported boot type: %q", bt))
|
||||
}
|
||||
|
||||
if addLegacyBootPkg {
|
||||
mergedSets[osPkgsKey] = mergedSets[osPkgsKey].Append(archSets[bootLegacyPkgsKey])
|
||||
}
|
||||
if addUEFIBootPkg {
|
||||
mergedSets[osPkgsKey] = mergedSets[osPkgsKey].Append(archSets[bootUEFIPkgsKey])
|
||||
}
|
||||
}
|
||||
if t.rpmOstree {
|
||||
// add ostree sets
|
||||
mergedSets[buildPkgsKey] = mergedSets[buildPkgsKey].Append(archSets[edgeBuildPkgsKey])
|
||||
mergedSets[osPkgsKey] = mergedSets[osPkgsKey].Append(archSets[edgePkgsKey])
|
||||
}
|
||||
|
||||
// blueprint packages
|
||||
bpPackages := bp.GetPackages()
|
||||
timezone, _ := bp.Customizations.GetTimezoneSettings()
|
||||
|
|
@ -504,44 +471,27 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
distro: rd,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: x8664BuildPackageSet(),
|
||||
bootLegacyPkgsKey: x8664LegacyBootPackageSet(),
|
||||
bootUEFIPkgsKey: x8664UEFIBootPackageSet(),
|
||||
edgePkgsKey: x8664EdgeCommitPackageSet(),
|
||||
},
|
||||
name: distro.X86_64ArchName,
|
||||
distro: rd,
|
||||
legacy: "i386-pc",
|
||||
bootType: distro.HybridBootType,
|
||||
}
|
||||
|
||||
aarch64 := architecture{
|
||||
name: distro.Aarch64ArchName,
|
||||
distro: rd,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
bootUEFIPkgsKey: aarch64UEFIBootPackageSet(),
|
||||
edgePkgsKey: aarch64EdgeCommitPackageSet(),
|
||||
},
|
||||
name: distro.Aarch64ArchName,
|
||||
distro: rd,
|
||||
bootType: distro.UEFIBootType,
|
||||
}
|
||||
|
||||
ppc64le := architecture{
|
||||
distro: rd,
|
||||
name: distro.Ppc64leArchName,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
bootLegacyPkgsKey: ppc64leLegacyBootPackageSet(),
|
||||
buildPkgsKey: ppc64leBuildPackageSet(),
|
||||
},
|
||||
distro: rd,
|
||||
name: distro.Ppc64leArchName,
|
||||
legacy: "powerpc-ieee1275",
|
||||
bootType: distro.LegacyBootType,
|
||||
}
|
||||
s390x := architecture{
|
||||
distro: rd,
|
||||
name: distro.S390xArchName,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
bootLegacyPkgsKey: s390xLegacyBootPackageSet(),
|
||||
},
|
||||
distro: rd,
|
||||
name: distro.S390xArchName,
|
||||
bootType: distro.LegacyBootType,
|
||||
}
|
||||
|
||||
|
|
@ -556,9 +506,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
nameAliases: []string{"rhel-edge-commit"},
|
||||
filename: "commit.tar",
|
||||
mimeType: "application/x-tar",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: edgeBuildPackageSet(),
|
||||
osPkgsKey: edgeCommitPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: edgeBuildPackageSet,
|
||||
osPkgsKey: edgeCommitPackageSet,
|
||||
},
|
||||
enabledServices: edgeServices,
|
||||
rpmOstree: true,
|
||||
|
|
@ -570,10 +520,14 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
nameAliases: []string{"rhel-edge-container"},
|
||||
filename: "container.tar",
|
||||
mimeType: "application/x-tar",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: edgeBuildPackageSet(),
|
||||
osPkgsKey: edgeCommitPackageSet(),
|
||||
containerPkgsKey: {Include: []string{"nginx"}},
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: edgeBuildPackageSet,
|
||||
osPkgsKey: edgeCommitPackageSet,
|
||||
containerPkgsKey: func(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"nginx"},
|
||||
}
|
||||
},
|
||||
},
|
||||
enabledServices: edgeServices,
|
||||
rpmOstree: true,
|
||||
|
|
@ -586,7 +540,7 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
nameAliases: []string{"rhel-edge-installer"},
|
||||
filename: "installer.iso",
|
||||
mimeType: "application/x-iso9660-image",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
packageSets: map[string]packageSetFunc{
|
||||
// TODO: non-arch-specific package set handling for installers
|
||||
// This image type requires build packages for installers and
|
||||
// ostree/edge. For now we only have x86-64 installer build
|
||||
|
|
@ -594,9 +548,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
// for other architectures, this will need to be moved to the
|
||||
// architecture and the merging will happen in the PackageSets()
|
||||
// method like the other sets.
|
||||
buildPkgsKey: edgeInstallerBuildPackageSet(),
|
||||
osPkgsKey: edgeCommitPackageSet(),
|
||||
installerPkgsKey: edgeInstallerPackageSet(),
|
||||
buildPkgsKey: edgeInstallerBuildPackageSet,
|
||||
osPkgsKey: edgeCommitPackageSet,
|
||||
installerPkgsKey: edgeInstallerPackageSet,
|
||||
},
|
||||
enabledServices: edgeServices,
|
||||
rpmOstree: true,
|
||||
|
|
@ -610,7 +564,7 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
nameAliases: []string{"rhel-edge-simplified-installer"},
|
||||
filename: "simplified-installer.iso",
|
||||
mimeType: "application/x-iso9660-image",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
packageSets: map[string]packageSetFunc{
|
||||
// TODO: non-arch-specific package set handling for installers
|
||||
// This image type requires build packages for installers and
|
||||
// ostree/edge. For now we only have x86-64 installer build
|
||||
|
|
@ -618,8 +572,8 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
// for other architectures, this will need to be moved to the
|
||||
// architecture and the merging will happen in the PackageSets()
|
||||
// method like the other sets.
|
||||
buildPkgsKey: edgeInstallerBuildPackageSet(),
|
||||
installerPkgsKey: edgeSimplifiedInstallerPackageSet(),
|
||||
buildPkgsKey: edgeInstallerBuildPackageSet,
|
||||
installerPkgsKey: edgeSimplifiedInstallerPackageSet,
|
||||
},
|
||||
enabledServices: edgeServices,
|
||||
defaultSize: 10 * GigaByte,
|
||||
|
|
@ -637,9 +591,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
mimeType: "application/x-qemu-disk",
|
||||
defaultTarget: "multi-user.target",
|
||||
kernelOptions: "console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=auto",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: distroBuildPackageSet(),
|
||||
osPkgsKey: qcow2CommonPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: distroBuildPackageSet,
|
||||
osPkgsKey: qcow2CommonPackageSet,
|
||||
},
|
||||
bootable: true,
|
||||
defaultSize: 10 * GigaByte,
|
||||
|
|
@ -652,9 +606,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "vhd",
|
||||
filename: "disk.vhd",
|
||||
mimeType: "application/x-vhd",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: distroBuildPackageSet(),
|
||||
osPkgsKey: vhdCommonPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: distroBuildPackageSet,
|
||||
osPkgsKey: vhdCommonPackageSet,
|
||||
},
|
||||
enabledServices: []string{
|
||||
"sshd",
|
||||
|
|
@ -673,9 +627,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "vmdk",
|
||||
filename: "disk.vmdk",
|
||||
mimeType: "application/x-vmdk",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: distroBuildPackageSet(),
|
||||
osPkgsKey: vmdkCommonPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: distroBuildPackageSet,
|
||||
osPkgsKey: vmdkCommonPackageSet,
|
||||
},
|
||||
kernelOptions: "ro net.ifnames=0",
|
||||
bootable: true,
|
||||
|
|
@ -689,9 +643,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "openstack",
|
||||
filename: "disk.qcow2",
|
||||
mimeType: "application/x-qemu-disk",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: distroBuildPackageSet(),
|
||||
osPkgsKey: openstackCommonPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: distroBuildPackageSet,
|
||||
osPkgsKey: openstackCommonPackageSet,
|
||||
},
|
||||
kernelOptions: "ro net.ifnames=0",
|
||||
bootable: true,
|
||||
|
|
@ -718,9 +672,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "ami",
|
||||
filename: "image.raw",
|
||||
mimeType: "application/octet-stream",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: ec2CommonPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: ec2BuildPackageSet,
|
||||
osPkgsKey: ec2CommonPackageSet,
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
|
|
@ -737,9 +691,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "ami",
|
||||
filename: "image.raw",
|
||||
mimeType: "application/octet-stream",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: ec2CommonPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: ec2BuildPackageSet,
|
||||
osPkgsKey: ec2CommonPackageSet,
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
|
|
@ -755,9 +709,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "ec2",
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: rhelEc2PackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: ec2BuildPackageSet,
|
||||
osPkgsKey: rhelEc2PackageSet,
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
|
|
@ -774,9 +728,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "ec2",
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: rhelEc2PackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: ec2BuildPackageSet,
|
||||
osPkgsKey: rhelEc2PackageSet,
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
|
|
@ -792,9 +746,9 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "ec2-ha",
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: rhelEc2HaPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: ec2BuildPackageSet,
|
||||
osPkgsKey: rhelEc2HaPackageSet,
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
|
|
@ -811,11 +765,13 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "tar",
|
||||
filename: "root.tar.xz",
|
||||
mimeType: "application/x-tar",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: distroBuildPackageSet(),
|
||||
osPkgsKey: {
|
||||
Include: []string{"policycoreutils", "selinux-policy-targeted"},
|
||||
Exclude: []string{"rng-tools"},
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: distroBuildPackageSet,
|
||||
osPkgsKey: func(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"policycoreutils", "selinux-policy-targeted"},
|
||||
Exclude: []string{"rng-tools"},
|
||||
}
|
||||
},
|
||||
},
|
||||
pipelines: tarPipelines,
|
||||
|
|
@ -825,10 +781,10 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
name: "image-installer",
|
||||
filename: "installer.iso",
|
||||
mimeType: "application/x-iso9660-image",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: anacondaBuildPackageSet(),
|
||||
osPkgsKey: bareMetalPackageSet(),
|
||||
installerPkgsKey: installerPackageSet(),
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: anacondaBuildPackageSet,
|
||||
osPkgsKey: bareMetalPackageSet,
|
||||
installerPkgsKey: installerPackageSet,
|
||||
},
|
||||
rpmOstree: false,
|
||||
bootISO: true,
|
||||
|
|
|
|||
|
|
@ -2,13 +2,18 @@ package rhel85
|
|||
|
||||
// This file defines package sets that are used by more than one image type.
|
||||
|
||||
import "github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
// BUILD PACKAGE SETS
|
||||
|
||||
// distro-wide build package set
|
||||
func distroBuildPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
func distroBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
ps := rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dnf", "dosfstools", "e2fsprogs", "glibc", "lorax-templates-generic",
|
||||
"lorax-templates-rhel", "policycoreutils", "python36",
|
||||
|
|
@ -16,33 +21,44 @@ func distroBuildPackageSet() rpmmd.PackageSet {
|
|||
"tar", "xfsprogs", "xz",
|
||||
},
|
||||
}
|
||||
|
||||
switch t.arch.Name() {
|
||||
|
||||
case distro.X86_64ArchName:
|
||||
ps = ps.Append(x8664BuildPackageSet(t))
|
||||
|
||||
case distro.Ppc64leArchName:
|
||||
ps = ps.Append(ppc64leBuildPackageSet(t))
|
||||
}
|
||||
|
||||
return ps
|
||||
}
|
||||
|
||||
// x86_64 build package set
|
||||
func x8664BuildPackageSet() rpmmd.PackageSet {
|
||||
func x8664BuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"grub2-pc"},
|
||||
}
|
||||
}
|
||||
|
||||
// ppc64le build package set
|
||||
func ppc64leBuildPackageSet() rpmmd.PackageSet {
|
||||
func ppc64leBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"grub2-ppc64le", "grub2-ppc64le-modules"},
|
||||
}
|
||||
}
|
||||
|
||||
// common ec2 image build package set
|
||||
func ec2BuildPackageSet() rpmmd.PackageSet {
|
||||
return distroBuildPackageSet().Append(
|
||||
func ec2BuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return distroBuildPackageSet(t).Append(
|
||||
rpmmd.PackageSet{
|
||||
Include: []string{"python3-pyyaml"},
|
||||
})
|
||||
}
|
||||
|
||||
// common edge image build package set
|
||||
func edgeBuildPackageSet() rpmmd.PackageSet {
|
||||
return distroBuildPackageSet().Append(
|
||||
func edgeBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return distroBuildPackageSet(t).Append(
|
||||
rpmmd.PackageSet{
|
||||
Include: []string{"rpm-ostree"},
|
||||
Exclude: nil,
|
||||
|
|
@ -51,8 +67,8 @@ func edgeBuildPackageSet() rpmmd.PackageSet {
|
|||
|
||||
// x86_64 installer ISO build package set
|
||||
// TODO: separate into common installer and arch specific sets
|
||||
func installerBuildPackageSet() rpmmd.PackageSet {
|
||||
return distroBuildPackageSet().Append(
|
||||
func installerBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return distroBuildPackageSet(t).Append(
|
||||
rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"genisoimage",
|
||||
|
|
@ -62,8 +78,8 @@ func installerBuildPackageSet() rpmmd.PackageSet {
|
|||
})
|
||||
}
|
||||
|
||||
func anacondaBuildPackageSet() rpmmd.PackageSet {
|
||||
return installerBuildPackageSet().Append(rpmmd.PackageSet{
|
||||
func anacondaBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return installerBuildPackageSet(t).Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"efibootmgr",
|
||||
"grub2-efi-ia32-cdboot",
|
||||
|
|
@ -84,23 +100,70 @@ func anacondaBuildPackageSet() rpmmd.PackageSet {
|
|||
})
|
||||
}
|
||||
|
||||
func edgeInstallerBuildPackageSet() rpmmd.PackageSet {
|
||||
return anacondaBuildPackageSet().Append(
|
||||
edgeBuildPackageSet(),
|
||||
func edgeInstallerBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return anacondaBuildPackageSet(t).Append(
|
||||
edgeBuildPackageSet(t),
|
||||
)
|
||||
}
|
||||
|
||||
// BOOT PACKAGE SETS
|
||||
|
||||
func bootPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
if !t.bootable {
|
||||
return rpmmd.PackageSet{}
|
||||
}
|
||||
|
||||
var addLegacyBootPkg bool
|
||||
var addUEFIBootPkg bool
|
||||
|
||||
switch bt := t.getBootType(); bt {
|
||||
case distro.LegacyBootType:
|
||||
addLegacyBootPkg = true
|
||||
case distro.UEFIBootType:
|
||||
addUEFIBootPkg = true
|
||||
case distro.HybridBootType:
|
||||
addLegacyBootPkg = true
|
||||
addUEFIBootPkg = true
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported boot type: %q", bt))
|
||||
}
|
||||
|
||||
ps := rpmmd.PackageSet{}
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
if addLegacyBootPkg {
|
||||
ps = ps.Append(x8664LegacyBootPackageSet(t))
|
||||
}
|
||||
if addUEFIBootPkg {
|
||||
ps = ps.Append(x8664UEFIBootPackageSet(t))
|
||||
}
|
||||
|
||||
case distro.Aarch64ArchName:
|
||||
ps = ps.Append(aarch64UEFIBootPackageSet(t))
|
||||
|
||||
case distro.Ppc64leArchName:
|
||||
ps = ps.Append(ppc64leLegacyBootPackageSet(t))
|
||||
|
||||
case distro.S390xArchName:
|
||||
ps = ps.Append(s390xLegacyBootPackageSet(t))
|
||||
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported boot arch: %s", t.arch.Name()))
|
||||
}
|
||||
|
||||
return ps
|
||||
}
|
||||
|
||||
// x86_64 Legacy arch-specific boot package set
|
||||
func x8664LegacyBootPackageSet() rpmmd.PackageSet {
|
||||
func x8664LegacyBootPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"dracut-config-generic", "grub2-pc"},
|
||||
}
|
||||
}
|
||||
|
||||
// x86_64 UEFI arch-specific boot package set
|
||||
func x8664UEFIBootPackageSet() rpmmd.PackageSet {
|
||||
func x8664UEFIBootPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dracut-config-generic",
|
||||
|
|
@ -112,7 +175,7 @@ func x8664UEFIBootPackageSet() rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
// aarch64 UEFI arch-specific boot package set
|
||||
func aarch64UEFIBootPackageSet() rpmmd.PackageSet {
|
||||
func aarch64UEFIBootPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dracut-config-generic", "efibootmgr", "grub2-efi-aa64",
|
||||
|
|
@ -122,7 +185,7 @@ func aarch64UEFIBootPackageSet() rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
// ppc64le Legacy arch-specific boot package set
|
||||
func ppc64leLegacyBootPackageSet() rpmmd.PackageSet {
|
||||
func ppc64leLegacyBootPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dracut-config-generic", "powerpc-utils", "grub2-ppc64le",
|
||||
|
|
@ -132,7 +195,7 @@ func ppc64leLegacyBootPackageSet() rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
// s390x Legacy arch-specific boot package set
|
||||
func s390xLegacyBootPackageSet() rpmmd.PackageSet {
|
||||
func s390xLegacyBootPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"dracut-config-generic", "s390utils-base"},
|
||||
}
|
||||
|
|
@ -140,7 +203,7 @@ func s390xLegacyBootPackageSet() rpmmd.PackageSet {
|
|||
|
||||
// OS package sets
|
||||
|
||||
func qcow2CommonPackageSet() rpmmd.PackageSet {
|
||||
func qcow2CommonPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"@core", "authselect-compat", "chrony", "cloud-init",
|
||||
|
|
@ -166,10 +229,10 @@ func qcow2CommonPackageSet() rpmmd.PackageSet {
|
|||
"libertas-usb8388-firmware", "nss", "plymouth", "rng-tools",
|
||||
"udisks2",
|
||||
},
|
||||
}
|
||||
}.Append(bootPackageSet(t))
|
||||
}
|
||||
|
||||
func vhdCommonPackageSet() rpmmd.PackageSet {
|
||||
func vhdCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
// Defaults
|
||||
|
|
@ -185,10 +248,10 @@ func vhdCommonPackageSet() rpmmd.PackageSet {
|
|||
Exclude: []string{
|
||||
"dracut-config-rescue", "rng-tools",
|
||||
},
|
||||
}
|
||||
}.Append(bootPackageSet(t))
|
||||
}
|
||||
|
||||
func vmdkCommonPackageSet() rpmmd.PackageSet {
|
||||
func vmdkCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"@core", "chrony", "firewalld", "langpacks-en", "open-vm-tools",
|
||||
|
|
@ -197,11 +260,11 @@ func vmdkCommonPackageSet() rpmmd.PackageSet {
|
|||
Exclude: []string{
|
||||
"dracut-config-rescue", "rng-tools",
|
||||
},
|
||||
}
|
||||
}.Append(bootPackageSet(t))
|
||||
|
||||
}
|
||||
|
||||
func openstackCommonPackageSet() rpmmd.PackageSet {
|
||||
func openstackCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
// Defaults
|
||||
|
|
@ -214,11 +277,11 @@ func openstackCommonPackageSet() rpmmd.PackageSet {
|
|||
Exclude: []string{
|
||||
"dracut-config-rescue", "rng-tools",
|
||||
},
|
||||
}
|
||||
}.Append(bootPackageSet(t))
|
||||
|
||||
}
|
||||
|
||||
func ec2CommonPackageSet() rpmmd.PackageSet {
|
||||
func ec2CommonPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"@core", "authselect-compat", "chrony", "cloud-init", "cloud-utils-growpart",
|
||||
|
|
@ -239,19 +302,19 @@ func ec2CommonPackageSet() rpmmd.PackageSet {
|
|||
"libertas-sd8787-firmware", "libertas-usb8388-firmware",
|
||||
"plymouth",
|
||||
},
|
||||
}
|
||||
}.Append(bootPackageSet(t))
|
||||
}
|
||||
|
||||
// rhel-ec2 image package set
|
||||
func rhelEc2PackageSet() rpmmd.PackageSet {
|
||||
ec2PackageSet := ec2CommonPackageSet()
|
||||
func rhelEc2PackageSet(t *imageType) rpmmd.PackageSet {
|
||||
ec2PackageSet := ec2CommonPackageSet(t)
|
||||
ec2PackageSet.Include = append(ec2PackageSet.Include, "rh-amazon-rhui-client")
|
||||
return ec2PackageSet
|
||||
}
|
||||
|
||||
// rhel-ha-ec2 image package set
|
||||
func rhelEc2HaPackageSet() rpmmd.PackageSet {
|
||||
ec2HaPackageSet := ec2CommonPackageSet()
|
||||
func rhelEc2HaPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
ec2HaPackageSet := ec2CommonPackageSet(t)
|
||||
ec2HaPackageSet.Include = append(ec2HaPackageSet.Include,
|
||||
"fence-agents-all",
|
||||
"pacemaker",
|
||||
|
|
@ -262,8 +325,8 @@ func rhelEc2HaPackageSet() rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
// edge commit OS package set
|
||||
func edgeCommitPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
func edgeCommitPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
ps := rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"redhat-release", "glibc", "glibc-minimal-langpack",
|
||||
"nss-altfiles", "dracut-config-generic", "dracut-network",
|
||||
|
|
@ -286,9 +349,22 @@ func edgeCommitPackageSet() rpmmd.PackageSet {
|
|||
},
|
||||
Exclude: []string{"rng-tools"},
|
||||
}
|
||||
|
||||
ps = ps.Append(bootPackageSet(t))
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
ps = ps.Append(x8664EdgeCommitPackageSet(t))
|
||||
|
||||
case distro.Aarch64ArchName:
|
||||
ps = ps.Append(aarch64EdgeCommitPackageSet(t))
|
||||
}
|
||||
|
||||
return ps
|
||||
|
||||
}
|
||||
|
||||
func x8664EdgeCommitPackageSet() rpmmd.PackageSet {
|
||||
func x8664EdgeCommitPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"grub2", "grub2-efi-x64", "efibootmgr", "shim-x64",
|
||||
|
|
@ -302,14 +378,14 @@ func x8664EdgeCommitPackageSet() rpmmd.PackageSet {
|
|||
}
|
||||
}
|
||||
|
||||
func aarch64EdgeCommitPackageSet() rpmmd.PackageSet {
|
||||
func aarch64EdgeCommitPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"grub2-efi-aa64", "efibootmgr", "shim-aa64", "iwl7260-firmware"},
|
||||
Exclude: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func bareMetalPackageSet() rpmmd.PackageSet {
|
||||
func bareMetalPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"authselect-compat", "chrony", "cockpit-system", "cockpit-ws",
|
||||
|
|
@ -327,11 +403,11 @@ func bareMetalPackageSet() rpmmd.PackageSet {
|
|||
"subscription-manager-cockpit", "tar", "tcpdump", "yum",
|
||||
},
|
||||
Exclude: nil,
|
||||
}
|
||||
}.Append(bootPackageSet(t))
|
||||
}
|
||||
|
||||
// INSTALLER PACKAGE SET
|
||||
func installerPackageSet() rpmmd.PackageSet {
|
||||
func installerPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
// TODO: simplify
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
|
|
@ -385,7 +461,7 @@ func installerPackageSet() rpmmd.PackageSet {
|
|||
}
|
||||
}
|
||||
|
||||
func edgeSimplifiedInstallerPackageSet() rpmmd.PackageSet {
|
||||
func edgeSimplifiedInstallerPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"cloud-utils-growpart",
|
||||
|
|
@ -461,7 +537,7 @@ func edgeSimplifiedInstallerPackageSet() rpmmd.PackageSet {
|
|||
}
|
||||
}
|
||||
|
||||
func edgeInstallerPackageSet() rpmmd.PackageSet {
|
||||
func edgeInstallerPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"aajohan-comfortaa-fonts", "abattis-cantarell-fonts",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue