From e4bb7f4f16507bef65211cf507fa9a1bf5d97eba Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Sat, 14 Jan 2023 23:38:55 +0100 Subject: [PATCH] distro: remove packageSetChains from image type in RHEL 8 & 9 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. --- cmd/osbuild-dnf-json-tests/main_test.go | 22 +--------------------- internal/distro/rhel8/ami.go | 18 ------------------ internal/distro/rhel8/azure.go | 12 ------------ internal/distro/rhel8/bare_metal.go | 3 --- internal/distro/rhel8/edge.go | 6 ------ internal/distro/rhel8/gce.go | 6 ------ internal/distro/rhel8/imagetype.go | 3 +-- internal/distro/rhel8/qcow2.go | 6 ------ internal/distro/rhel8/vmdk.go | 3 --- internal/distro/rhel9/ami.go | 18 ------------------ internal/distro/rhel9/azure.go | 6 ------ internal/distro/rhel9/bare_metal.go | 6 ------ internal/distro/rhel9/gce.go | 6 ------ internal/distro/rhel9/imagetype.go | 3 +-- 14 files changed, 3 insertions(+), 115 deletions(-) diff --git a/cmd/osbuild-dnf-json-tests/main_test.go b/cmd/osbuild-dnf-json-tests/main_test.go index 5dc84af6c..471b1a2f8 100644 --- a/cmd/osbuild-dnf-json-tests/main_test.go +++ b/cmd/osbuild-dnf-json-tests/main_test.go @@ -101,29 +101,8 @@ 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 { @@ -131,6 +110,7 @@ func TestDepsolvePackageSets(t *testing.T) { } gotPackageSpecsSets[name] = res } + expectedPackageSpecsSetNames := []string{"build", "os"} require.EqualValues(t, len(expectedPackageSpecsSetNames), len(gotPackageSpecsSets)) for _, name := range expectedPackageSpecsSetNames { _, ok := gotPackageSpecsSets[name] diff --git a/internal/distro/rhel8/ami.go b/internal/distro/rhel8/ami.go index 17bcd0647..8f4a95dfe 100644 --- a/internal/distro/rhel8/ami.go +++ b/internal/distro/rhel8/ami.go @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/internal/distro/rhel8/azure.go b/internal/distro/rhel8/azure.go index a7aa2e0c5..bbd39ab2a 100644 --- a/internal/distro/rhel8/azure.go +++ b/internal/distro/rhel8/azure.go @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/internal/distro/rhel8/bare_metal.go b/internal/distro/rhel8/bare_metal.go index 04511b139..b5ad9d0c8 100644 --- a/internal/distro/rhel8/bare_metal.go +++ b/internal/distro/rhel8/bare_metal.go @@ -39,9 +39,6 @@ func tarImgType() imageType { } }, }, - packageSetChains: map[string][]string{ - osPkgsKey: {osPkgsKey, blueprintPkgsKey}, - }, image: tarImage, buildPipelines: []string{"build"}, payloadPipelines: []string{"os", "archive"}, diff --git a/internal/distro/rhel8/edge.go b/internal/distro/rhel8/edge.go index 64971d75f..beac5eeae 100644 --- a/internal/distro/rhel8/edge.go +++ b/internal/distro/rhel8/edge.go @@ -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), }, @@ -46,9 +43,6 @@ func edgeOCIImgType(rd distribution) imageType { } }, }, - packageSetChains: map[string][]string{ - osPkgsKey: {osPkgsKey, blueprintPkgsKey}, - }, defaultImageConfig: &distro.ImageConfig{ EnabledServices: edgeServices(rd), }, diff --git a/internal/distro/rhel8/gce.go b/internal/distro/rhel8/gce.go index e936acb0f..24a5a45d4 100644 --- a/internal/distro/rhel8/gce.go +++ b/internal/distro/rhel8/gce.go @@ -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, @@ -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, diff --git a/internal/distro/rhel8/imagetype.go b/internal/distro/rhel8/imagetype.go index db90b335c..530720497 100644 --- a/internal/distro/rhel8/imagetype.go +++ b/internal/distro/rhel8/imagetype.go @@ -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 @@ -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 { diff --git a/internal/distro/rhel8/qcow2.go b/internal/distro/rhel8/qcow2.go index a77528207..a232cc402 100644 --- a/internal/distro/rhel8/qcow2.go +++ b/internal/distro/rhel8/qcow2.go @@ -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"), }, @@ -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, diff --git a/internal/distro/rhel8/vmdk.go b/internal/distro/rhel8/vmdk.go index 3d5da2750..a5d37ff89 100644 --- a/internal/distro/rhel8/vmdk.go +++ b/internal/distro/rhel8/vmdk.go @@ -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, diff --git a/internal/distro/rhel9/ami.go b/internal/distro/rhel9/ami.go index 769c50ae8..8c985c1b4 100644 --- a/internal/distro/rhel9/ami.go +++ b/internal/distro/rhel9/ami.go @@ -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, @@ -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, @@ -62,9 +56,6 @@ var ( buildPkgsKey: ec2BuildPackageSet, osPkgsKey: rhelEc2HaPackageSet, }, - packageSetChains: map[string][]string{ - osPkgsKey: {osPkgsKey, blueprintPkgsKey}, - }, kernelOptions: amiKernelOptions, bootable: true, bootType: distro.LegacyBootType, @@ -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, @@ -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, @@ -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, diff --git a/internal/distro/rhel9/azure.go b/internal/distro/rhel9/azure.go index fa06e0354..213da7bc4 100644 --- a/internal/distro/rhel9/azure.go +++ b/internal/distro/rhel9/azure.go @@ -17,9 +17,6 @@ var ( packageSets: map[string]packageSetFunc{ osPkgsKey: azurePackageSet, }, - packageSetChains: map[string][]string{ - osPkgsKey: {osPkgsKey, blueprintPkgsKey}, - }, defaultImageConfig: defaultAzureImageConfig, kernelOptions: defaultAzureKernelOptions, bootable: true, @@ -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, diff --git a/internal/distro/rhel9/bare_metal.go b/internal/distro/rhel9/bare_metal.go index 30e49775b..cf13dc4b3 100644 --- a/internal/distro/rhel9/bare_metal.go +++ b/internal/distro/rhel9/bare_metal.go @@ -20,9 +20,6 @@ var ( } }, }, - packageSetChains: map[string][]string{ - osPkgsKey: {osPkgsKey, blueprintPkgsKey}, - }, image: tarImage, buildPipelines: []string{"build"}, payloadPipelines: []string{"os", "root-tar"}, @@ -37,9 +34,6 @@ var ( osPkgsKey: bareMetalPackageSet, installerPkgsKey: anacondaPackageSet, }, - packageSetChains: map[string][]string{ - osPkgsKey: {osPkgsKey, blueprintPkgsKey}, - }, rpmOstree: false, bootISO: true, bootable: true, diff --git a/internal/distro/rhel9/gce.go b/internal/distro/rhel9/gce.go index 8e7083a63..60f8b0e6d 100644 --- a/internal/distro/rhel9/gce.go +++ b/internal/distro/rhel9/gce.go @@ -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, @@ -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, diff --git a/internal/distro/rhel9/imagetype.go b/internal/distro/rhel9/imagetype.go index 380add720..92fafadea 100644 --- a/internal/distro/rhel9/imagetype.go +++ b/internal/distro/rhel9/imagetype.go @@ -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 @@ -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 {