Skip to content

Commit

Permalink
distro: remove packageSetChains from image type in RHEL 8 & 9
Browse files Browse the repository at this point in the history
Image types no longer report their chains.  Instead, pipelines report
their packages and chains and blueprint packages are added to the
workload.

The distro.ImageType interface retains the PackageSetsChains() methods
for RHEL 7 until that is rewritten as well.

The osbuild-dnf-json-test doesn't use the PackageSetsChains() method
anymore.  Instead, since it only test the centos-8 qcow2 image, it
hardcodes the expected package set names.
  • Loading branch information
achilleas-k committed Jan 14, 2023
1 parent 0aa0cbb commit 0b25500
Show file tree
Hide file tree
Showing 14 changed files with 3 additions and 115 deletions.
22 changes: 1 addition & 21 deletions cmd/osbuild-dnf-json-tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,36 +101,16 @@ func TestDepsolvePackageSets(t *testing.T) {
require.Nilf(t, err, "failed to get %q image type of %q/%q distro/arch", qcow2ImageTypeName, distroStruct.Name(), distro.X86_64ArchName)

imagePkgSets := qcow2Image.PackageSets(blueprint.Blueprint{Packages: []blueprint.Package{{Name: "bind"}}}, distro.ImageOptions{}, x86Repos)
imagePkgSetChains := qcow2Image.PackageSetsChains()
require.NotEmptyf(t, imagePkgSetChains, "the %q image has no package set chains defined", qcow2ImageTypeName)

expectedPackageSpecsSetNames := func(pkgSets map[string][]rpmmd.PackageSet, pkgSetChains map[string][]string) []string {
expectedPkgSpecsSetNames := make([]string, 0, len(pkgSets))
chainPkgSets := make(map[string]struct{}, len(pkgSets))
for name, pkgSetChain := range pkgSetChains {
expectedPkgSpecsSetNames = append(expectedPkgSpecsSetNames, name)
for _, pkgSetName := range pkgSetChain {
chainPkgSets[pkgSetName] = struct{}{}
}
}
for name := range pkgSets {
if _, ok := chainPkgSets[name]; ok {
continue
}
expectedPkgSpecsSetNames = append(expectedPkgSpecsSetNames, name)
}
return expectedPkgSpecsSetNames
}(imagePkgSets, imagePkgSetChains)

gotPackageSpecsSets := make(map[string][]rpmmd.PackageSpec, len(imagePkgSets))

for name, pkgSet := range imagePkgSets {
res, err := solver.Depsolve(pkgSet)
if err != nil {
require.Nil(t, err)
}
gotPackageSpecsSets[name] = res
}
expectedPackageSpecsSetNames := []string{"build", "os"}
require.EqualValues(t, len(expectedPackageSpecsSetNames), len(gotPackageSpecsSets))
for _, name := range expectedPackageSpecsSetNames {
_, ok := gotPackageSpecsSets[name]
Expand Down
18 changes: 0 additions & 18 deletions internal/distro/rhel8/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ func amiImgTypeX86_64(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: ec2CommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAMIImageConfigX86_64(rd),
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
bootable: true,
Expand All @@ -42,9 +39,6 @@ func ec2ImgTypeX86_64(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: rhelEc2PackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultEc2ImageConfigX86_64(rd),
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
bootable: true,
Expand All @@ -68,9 +62,6 @@ func ec2HaImgTypeX86_64(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: rhelEc2HaPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultEc2ImageConfigX86_64(rd),
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
bootable: true,
Expand All @@ -93,9 +84,6 @@ func amiImgTypeAarch64(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: ec2CommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAMIImageConfig(rd),
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0 crashkernel=auto",
bootable: true,
Expand All @@ -118,9 +106,6 @@ func ec2ImgTypeAarch64(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: rhelEc2PackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultEc2ImageConfig(rd),
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0 crashkernel=auto",
bootable: true,
Expand All @@ -143,9 +128,6 @@ func ec2SapImgTypeX86_64(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: rhelEc2SapPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultEc2SapImageConfigX86_64(rd),
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto processor.max_cstate=1 intel_idle.max_cstate=1",
bootable: true,
Expand Down
12 changes: 0 additions & 12 deletions internal/distro/rhel8/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ func azureRhuiImgType() imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: azureRhuiPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAzureRhuiImageConfig.InheritFrom(defaultAzureImageConfig),
kernelOptions: defaultAzureKernelOptions,
bootable: true,
Expand All @@ -43,9 +40,6 @@ func azureSapImgType(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: azureSapPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: SapAzureImageConfig(rd),
kernelOptions: defaultAzureKernelOptions,
bootable: true,
Expand All @@ -67,9 +61,6 @@ func azureByosImgType() imageType {
// the ec2 buildroot is required due to the cloud-init stage and dependency on YAML
osPkgsKey: azurePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAzureByosImageConfig.InheritFrom(defaultAzureImageConfig),
kernelOptions: defaultAzureKernelOptions,
bootable: true,
Expand All @@ -92,9 +83,6 @@ func azureImgType() imageType {
// the ec2 buildroot is required due to the cloud-init stage and dependency on YAML
osPkgsKey: azurePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAzureImageConfig,
kernelOptions: defaultAzureKernelOptions,
bootable: true,
Expand Down
3 changes: 0 additions & 3 deletions internal/distro/rhel8/bare_metal.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ func tarImgType() imageType {
}
},
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
image: tarImage,
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "root-tar"},
Expand Down
6 changes: 0 additions & 6 deletions internal/distro/rhel8/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ func edgeCommitImgType(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: edgeCommitPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: &distro.ImageConfig{
EnabledServices: edgeServices(rd),
},
Expand All @@ -46,9 +43,6 @@ func edgeOCIImgType(rd distribution) imageType {
}
},
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: &distro.ImageConfig{
EnabledServices: edgeServices(rd),
},
Expand Down
6 changes: 0 additions & 6 deletions internal/distro/rhel8/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ func gceImgType(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: gcePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultGceByosImageConfig(rd),
kernelOptions: gceKernelOptions,
bootable: true,
Expand All @@ -42,9 +39,6 @@ func gceRhuiImgType(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: gceRhuiPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultGceRhuiImageConfig(rd),
kernelOptions: gceKernelOptions,
bootable: true,
Expand Down
3 changes: 1 addition & 2 deletions internal/distro/rhel8/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type imageType struct {
compression string // TODO: remove from image definition and make it a transport option
mimeType string
packageSets map[string]packageSetFunc
packageSetChains map[string][]string
defaultImageConfig *distro.ImageConfig
kernelOptions string
defaultSize uint64
Expand Down Expand Up @@ -119,7 +118,7 @@ func (t *imageType) PayloadPackageSets() []string {
}

func (t *imageType) PackageSetsChains() map[string][]string {
return t.packageSetChains
return nil
}

func (t *imageType) Exports() []string {
Expand Down
6 changes: 0 additions & 6 deletions internal/distro/rhel8/qcow2.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ func qcow2ImgType(rd distribution) imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: qcow2CommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: &distro.ImageConfig{
DefaultTarget: common.ToPtr("multi-user.target"),
},
Expand Down Expand Up @@ -57,9 +54,6 @@ func openstackImgType() imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: openstackCommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: "ro net.ifnames=0",
bootable: true,
defaultSize: 4 * common.GibiByte,
Expand Down
3 changes: 0 additions & 3 deletions internal/distro/rhel8/vmdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ func vmdkImgType() imageType {
packageSets: map[string]packageSetFunc{
osPkgsKey: vmdkCommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: "ro net.ifnames=0",
bootable: true,
defaultSize: 4 * common.GibiByte,
Expand Down
18 changes: 0 additions & 18 deletions internal/distro/rhel9/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ var (
packageSets: map[string]packageSetFunc{
osPkgsKey: ec2CommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: amiKernelOptions,
bootable: true,
bootType: distro.LegacyBootType,
Expand All @@ -39,9 +36,6 @@ var (
packageSets: map[string]packageSetFunc{
osPkgsKey: rhelEc2PackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: amiKernelOptions,
bootable: true,
bootType: distro.LegacyBootType,
Expand All @@ -62,9 +56,6 @@ var (
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: rhelEc2HaPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: amiKernelOptions,
bootable: true,
bootType: distro.LegacyBootType,
Expand All @@ -84,9 +75,6 @@ var (
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: ec2CommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0",
bootable: true,
defaultSize: 10 * common.GibiByte,
Expand All @@ -106,9 +94,6 @@ var (
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: rhelEc2PackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0",
bootable: true,
defaultSize: 10 * common.GibiByte,
Expand All @@ -128,9 +113,6 @@ var (
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: rhelEc2SapPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 processor.max_cstate=1 intel_idle.max_cstate=1",
bootable: true,
bootType: distro.LegacyBootType,
Expand Down
6 changes: 0 additions & 6 deletions internal/distro/rhel9/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ var (
packageSets: map[string]packageSetFunc{
osPkgsKey: azurePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAzureImageConfig,
kernelOptions: defaultAzureKernelOptions,
bootable: true,
Expand All @@ -39,9 +36,6 @@ var (
packageSets: map[string]packageSetFunc{
osPkgsKey: azurePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAzureByosImageConfig.InheritFrom(defaultAzureImageConfig),
kernelOptions: defaultAzureKernelOptions,
bootable: true,
Expand Down
6 changes: 0 additions & 6 deletions internal/distro/rhel9/bare_metal.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ var (
}
},
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
image: tarImage,
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "root-tar"},
Expand All @@ -37,9 +34,6 @@ var (
osPkgsKey: bareMetalPackageSet,
installerPkgsKey: anacondaPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
rpmOstree: false,
bootISO: true,
bootable: true,
Expand Down
6 changes: 0 additions & 6 deletions internal/distro/rhel9/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ var (
packageSets: map[string]packageSetFunc{
osPkgsKey: gcePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: gceKernelOptions,
bootable: true,
bootType: distro.UEFIBootType,
Expand All @@ -38,9 +35,6 @@ var (
packageSets: map[string]packageSetFunc{
osPkgsKey: gceRhuiPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
kernelOptions: gceKernelOptions,
bootable: true,
bootType: distro.UEFIBootType,
Expand Down
3 changes: 1 addition & 2 deletions internal/distro/rhel9/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ type imageType struct {
compression string // TODO: remove from image definition and make it a transport option
mimeType string
packageSets map[string]packageSetFunc
packageSetChains map[string][]string
defaultImageConfig *distro.ImageConfig
kernelOptions string
defaultSize uint64
Expand Down Expand Up @@ -122,7 +121,7 @@ func (t *imageType) PayloadPackageSets() []string {
}

func (t *imageType) PackageSetsChains() map[string][]string {
return t.packageSetChains
return nil
}

func (t *imageType) Exports() []string {
Expand Down

0 comments on commit 0b25500

Please sign in to comment.