distro: remove architecture names and use platform enum
Removing the dependence of the manifest package on the distro package to import manifest into distro. Wherever arch names are needed, we use the enums from the platform package instead.
This commit is contained in:
parent
0f925c445c
commit
8f69088af1
31 changed files with 108 additions and 101 deletions
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
rhel "github.com/osbuild/osbuild-composer/internal/distro/rhel8"
|
||||
"github.com/osbuild/osbuild-composer/internal/dnfjson"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -75,19 +76,19 @@ func TestDepsolvePackageSets(t *testing.T) {
|
|||
|
||||
// Set up temporary directory for rpm/dnf cache
|
||||
dir := t.TempDir()
|
||||
solver := dnfjson.NewSolver(cs9.ModulePlatformID(), cs9.Releasever(), distro.X86_64ArchName, cs9.Name(), dir)
|
||||
solver := dnfjson.NewSolver(cs9.ModulePlatformID(), cs9.Releasever(), platform.ARCH_X86_64.String(), cs9.Name(), dir)
|
||||
|
||||
repos, err := rpmmd.LoadRepositories([]string{repoDir}, cs9.Name())
|
||||
require.NoErrorf(t, err, "Failed to LoadRepositories %v", cs9.Name())
|
||||
x86Repos, ok := repos[distro.X86_64ArchName]
|
||||
require.Truef(t, ok, "failed to get %q repos for %q", distro.X86_64ArchName, cs9.Name())
|
||||
x86Repos, ok := repos[platform.ARCH_X86_64.String()]
|
||||
require.Truef(t, ok, "failed to get %q repos for %q", platform.ARCH_X86_64.String(), cs9.Name())
|
||||
|
||||
x86Arch, err := cs9.GetArch(distro.X86_64ArchName)
|
||||
require.Nilf(t, err, "failed to get %q arch of %q distro", distro.X86_64ArchName, cs9.Name())
|
||||
x86Arch, err := cs9.GetArch(platform.ARCH_X86_64.String())
|
||||
require.Nilf(t, err, "failed to get %q arch of %q distro", platform.ARCH_X86_64.String(), cs9.Name())
|
||||
|
||||
qcow2ImageTypeName := "qcow2"
|
||||
qcow2Image, err := x86Arch.GetImageType(qcow2ImageTypeName)
|
||||
require.Nilf(t, err, "failed to get %q image type of %q/%q distro/arch", qcow2ImageTypeName, cs9.Name(), distro.X86_64ArchName)
|
||||
require.Nilf(t, err, "failed to get %q image type of %q/%q distro/arch", qcow2ImageTypeName, cs9.Name(), platform.ARCH_X86_64.String())
|
||||
|
||||
imagePkgSets := qcow2Image.PackageSets(blueprint.Blueprint{Packages: []blueprint.Package{{Name: "bind"}}}, distro.ImageOptions{}, x86Repos)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/boot/openstacktest"
|
||||
"github.com/osbuild/osbuild-composer/internal/boot/vmwaretest"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/test"
|
||||
)
|
||||
|
||||
|
|
@ -410,7 +410,7 @@ func testBootUsingOpenStack(t *testing.T, imagePath string) {
|
|||
currentArch := common.CurrentArch()
|
||||
|
||||
// skip on aarch64 because we don't have aarch64 openstack or kvm machines
|
||||
if currentArch == distro.Aarch64ArchName {
|
||||
if currentArch == platform.ARCH_AARCH64.String() {
|
||||
t.Skip("Openstack boot test is skipped on aarch64.")
|
||||
// if no credentials are given, fall back to qemu
|
||||
} else if (creds == gophercloud.AuthOptions{}) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro/fedora"
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
"github.com/osbuild/osbuild-composer/internal/dnfjson"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/store"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
|
|
@ -120,7 +121,7 @@ func main() {
|
|||
awsTarget.OsbuildArtifact.ExportFilename = "image.ami"
|
||||
|
||||
d := fedora.NewF37()
|
||||
a, err := d.GetArch(distro.X86_64ArchName)
|
||||
a, err := d.GetArch(platform.ARCH_X86_64.String())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -136,7 +137,7 @@ func main() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
repos := allRepos[distro.X86_64ArchName]
|
||||
repos := allRepos[platform.ARCH_X86_64.String()]
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
panic("os.UserHomeDir(): " + err.Error())
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
|
||||
"github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/constants"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
||||
// WithNetworkNamespace provides the function f with a new network namespace
|
||||
|
|
@ -138,7 +138,7 @@ func WithBootedQemuImage(image string, ns NetNS, f func() error) error {
|
|||
"-nographic",
|
||||
image,
|
||||
)
|
||||
} else if common.CurrentArch() == distro.Aarch64ArchName {
|
||||
} else if common.CurrentArch() == platform.ARCH_AARCH64.String() {
|
||||
// This command does not use KVM as I was unable to make it work in Beaker,
|
||||
// once we have machines that can use KVM, enable it to make it faster
|
||||
qemuCmd = ns.NamespacedCommand(
|
||||
|
|
|
|||
|
|
@ -11,15 +11,6 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/subscription"
|
||||
)
|
||||
|
||||
const (
|
||||
// architecture names
|
||||
|
||||
X86_64ArchName = "x86_64"
|
||||
Aarch64ArchName = "aarch64"
|
||||
Ppc64leArchName = "ppc64le"
|
||||
S390xArchName = "s390x"
|
||||
)
|
||||
|
||||
type BootMode uint64
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -516,12 +516,12 @@ func newDistro(version int) distro.Distro {
|
|||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
name: platform.ARCH_X86_64.String(),
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
aarch64 := architecture{
|
||||
name: distro.Aarch64ArchName,
|
||||
name: platform.ARCH_AARCH64.String(),
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -440,7 +440,7 @@ func anacondaPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
switch t.Arch().Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"biosdevname",
|
||||
|
|
@ -450,7 +450,7 @@ func anacondaPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
},
|
||||
})
|
||||
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dmidecode",
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
||||
var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -59,7 +60,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -108,7 +109,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
}
|
||||
|
||||
var iotBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -154,7 +155,7 @@ var iotBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "0xc1748067",
|
||||
Type: "dos",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/subscription"
|
||||
)
|
||||
|
|
@ -272,7 +273,7 @@ func azureRhuiCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
var azureRhuiBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Size: 64 * common.GibiByte,
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ func newDistro(distroName string) distro.Distro {
|
|||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
name: platform.ARCH_X86_64.String(),
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
||||
// ////////// Partition table //////////
|
||||
|
||||
var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/shell"
|
||||
"github.com/osbuild/osbuild-composer/internal/subscription"
|
||||
|
|
@ -257,7 +258,7 @@ func azureEapPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
// PARTITION TABLES
|
||||
|
||||
var azureRhuiBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Size: 64 * common.GibiByte,
|
||||
|
|
@ -365,7 +366,7 @@ var azureRhuiBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Size: 64 * common.GibiByte,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package rhel8
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ func installerPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"biosdevname",
|
||||
|
|
@ -278,7 +278,7 @@ func anacondaPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
ps = ps.Append(anacondaBootPackageSet(t))
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"biosdevname",
|
||||
|
|
@ -287,7 +287,7 @@ func anacondaPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
},
|
||||
})
|
||||
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dmidecode",
|
||||
|
|
|
|||
|
|
@ -194,22 +194,22 @@ func newDistro(name string, minor int) *distribution {
|
|||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
name: platform.ARCH_X86_64.String(),
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
aarch64 := architecture{
|
||||
name: distro.Aarch64ArchName,
|
||||
name: platform.ARCH_AARCH64.String(),
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
ppc64le := architecture{
|
||||
distro: &rd,
|
||||
name: distro.Ppc64leArchName,
|
||||
name: platform.ARCH_PPC64LE.String(),
|
||||
}
|
||||
s390x := architecture{
|
||||
distro: &rd,
|
||||
name: distro.S390xArchName,
|
||||
name: platform.ARCH_S390X.String(),
|
||||
}
|
||||
|
||||
ociImgType := qcow2ImgType(rd)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/distro_test_common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/rhel8"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
||||
type rhelFamilyDistro struct {
|
||||
|
|
@ -356,7 +357,7 @@ func TestImageType_Name(t *testing.T) {
|
|||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
for _, mapping := range imgMap {
|
||||
if mapping.arch == distro.S390xArchName && dist.name == "centos" {
|
||||
if mapping.arch == platform.ARCH_S390X.String() && dist.name == "centos" {
|
||||
continue
|
||||
}
|
||||
arch, err := dist.distro.GetArch(mapping.arch)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -217,10 +218,10 @@ func edgeCommitPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(x8664EdgeCommitPackageSet(t))
|
||||
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(aarch64EdgeCommitPackageSet(t))
|
||||
}
|
||||
|
||||
|
|
@ -338,9 +339,9 @@ func edgeSimplifiedInstallerPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
|
||||
switch t.arch.Name() {
|
||||
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(x8664EdgeCommitPackageSet(t))
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(aarch64EdgeCommitPackageSet(t))
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package rhel8
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ func anacondaBootPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(grubCommon)
|
||||
ps = ps.Append(efiCommon)
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
|
|
@ -46,7 +46,7 @@ func anacondaBootPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
"syslinux-nonlinux",
|
||||
},
|
||||
})
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(grubCommon)
|
||||
ps = ps.Append(efiCommon)
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
||||
var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -45,7 +46,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -77,7 +78,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Ppc64leArchName: disk.PartitionTable{
|
||||
platform.ARCH_PPC64LE.String(): disk.PartitionTable{
|
||||
UUID: "0x14fc63d2",
|
||||
Type: "dos",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -98,7 +99,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.S390xArchName: disk.PartitionTable{
|
||||
platform.ARCH_S390X.String(): disk.PartitionTable{
|
||||
UUID: "0x14fc63d2",
|
||||
Type: "dos",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -118,7 +119,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
}
|
||||
|
||||
var ec2BasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -170,7 +171,7 @@ var ec2BasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -221,7 +222,7 @@ var ec2BasePartitionTables = distro.BasePartitionTableMap{
|
|||
// ec2LegacyBasePartitionTables is the partition table layout for RHEL EC2
|
||||
// images prior to 8.9. It is used for backwards compatibility.
|
||||
var ec2LegacyBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -246,7 +247,7 @@ var ec2LegacyBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -293,7 +294,7 @@ var ec2LegacyBasePartitionTables = distro.BasePartitionTableMap{
|
|||
}
|
||||
|
||||
var edgeBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -360,7 +361,7 @@ var edgeBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/subscription"
|
||||
)
|
||||
|
|
@ -176,7 +177,7 @@ func azureRhuiPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
// PARTITION TABLES
|
||||
|
||||
var azureRhuiBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Size: 64 * common.GibiByte,
|
||||
|
|
@ -284,7 +285,7 @@ var azureRhuiBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Size: 64 * common.GibiByte,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package rhel9
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ func installerPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"biosdevname",
|
||||
|
|
@ -292,7 +292,7 @@ func anacondaPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
ps = ps.Append(anacondaBootPackageSet(t))
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"biosdevname",
|
||||
|
|
@ -302,7 +302,7 @@ func anacondaPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
},
|
||||
})
|
||||
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dmidecode",
|
||||
|
|
|
|||
|
|
@ -186,23 +186,23 @@ func newDistro(name string, minor int) *distribution {
|
|||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
name: platform.ARCH_X86_64.String(),
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
aarch64 := architecture{
|
||||
name: distro.Aarch64ArchName,
|
||||
name: platform.ARCH_AARCH64.String(),
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
ppc64le := architecture{
|
||||
distro: &rd,
|
||||
name: distro.Ppc64leArchName,
|
||||
name: platform.ARCH_PPC64LE.String(),
|
||||
}
|
||||
|
||||
s390x := architecture{
|
||||
distro: &rd,
|
||||
name: distro.S390xArchName,
|
||||
name: platform.ARCH_S390X.String(),
|
||||
}
|
||||
|
||||
qcow2ImgType := mkQcow2ImgType(rd)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/distro_test_common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/rhel9"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
||||
type rhelFamilyDistro struct {
|
||||
|
|
@ -339,7 +340,7 @@ func TestImageType_Name(t *testing.T) {
|
|||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
for _, mapping := range imgMap {
|
||||
if mapping.arch == distro.S390xArchName && dist.name == "centos" {
|
||||
if mapping.arch == platform.ARCH_S390X.String() && dist.name == "centos" {
|
||||
continue
|
||||
}
|
||||
arch, err := dist.distro.GetArch(mapping.arch)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -137,7 +138,7 @@ var (
|
|||
|
||||
// Partition tables
|
||||
edgeBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -213,7 +214,7 @@ var (
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -374,10 +375,10 @@ func edgeCommitPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(x8664EdgeCommitPackageSet(t))
|
||||
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(aarch64EdgeCommitPackageSet(t))
|
||||
}
|
||||
|
||||
|
|
@ -474,9 +475,9 @@ func edgeSimplifiedInstallerPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
|
||||
switch t.arch.Name() {
|
||||
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(x8664EdgeCommitPackageSet(t))
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(aarch64EdgeCommitPackageSet(t))
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package rhel9
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -35,10 +35,10 @@ func distroBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
|
||||
switch t.arch.Name() {
|
||||
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(x8664BuildPackageSet(t))
|
||||
|
||||
case distro.Ppc64leArchName:
|
||||
case platform.ARCH_PPC64LE.String():
|
||||
ps = ps.Append(ppc64leBuildPackageSet(t))
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ func anacondaBootPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(grubCommon)
|
||||
ps = ps.Append(efiCommon)
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
|
|
@ -98,7 +98,7 @@ func anacondaBootPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
"syslinux-nonlinux",
|
||||
},
|
||||
})
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(grubCommon)
|
||||
ps = ps.Append(efiCommon)
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
|
|
@ -197,7 +197,7 @@ func coreOsCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
switch t.arch.Name() {
|
||||
case distro.X86_64ArchName:
|
||||
case platform.ARCH_X86_64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"irqbalance",
|
||||
|
|
@ -205,14 +205,14 @@ func coreOsCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
},
|
||||
})
|
||||
|
||||
case distro.Aarch64ArchName:
|
||||
case platform.ARCH_AARCH64.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"irqbalance",
|
||||
},
|
||||
})
|
||||
|
||||
case distro.Ppc64leArchName:
|
||||
case platform.ARCH_PPC64LE.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"irqbalance",
|
||||
|
|
@ -223,7 +223,7 @@ func coreOsCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
},
|
||||
})
|
||||
|
||||
case distro.S390xArchName:
|
||||
case platform.ARCH_S390X.String():
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"s390utils-core",
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
||||
var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -59,7 +60,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
platform.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -105,7 +106,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.Ppc64leArchName: disk.PartitionTable{
|
||||
platform.ARCH_PPC64LE.String(): disk.PartitionTable{
|
||||
UUID: "0x14fc63d2",
|
||||
Type: "dos",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
@ -137,7 +138,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
|||
},
|
||||
},
|
||||
},
|
||||
distro.S390xArchName: disk.PartitionTable{
|
||||
platform.ARCH_S390X.String(): disk.PartitionTable{
|
||||
UUID: "0x14fc63d2",
|
||||
Type: "dos",
|
||||
Partitions: []disk.Partition{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/subscription"
|
||||
)
|
||||
|
|
@ -103,7 +104,7 @@ func openstackCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
},
|
||||
}.Append(coreOsCommonPackageSet(t))
|
||||
|
||||
if t.arch.Name() == distro.X86_64ArchName {
|
||||
if t.arch.Name() == platform.ARCH_X86_64.String() {
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
// packages below used to come from @core group and were not excluded
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package rhel9
|
|||
import (
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -62,7 +63,7 @@ func vmdkCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
},
|
||||
}.Append(coreOsCommonPackageSet(t))
|
||||
|
||||
if t.arch.Name() == distro.X86_64ArchName {
|
||||
if t.arch.Name() == platform.ARCH_X86_64.String() {
|
||||
ps = ps.Append(rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
// packages below used to come from @core group and were not excluded
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package manifest
|
||||
|
||||
import (
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
|
@ -36,9 +35,9 @@ func (p *EFIBootTree) serialize() osbuild.Pipeline {
|
|||
|
||||
arch := p.Platform.GetArch().String()
|
||||
var architectures []string
|
||||
if arch == distro.X86_64ArchName {
|
||||
if arch == platform.ARCH_X86_64.String() {
|
||||
architectures = []string{"X64"}
|
||||
} else if arch == distro.Aarch64ArchName {
|
||||
} else if arch == platform.ARCH_AARCH64.String() {
|
||||
architectures = []string{"AA64"}
|
||||
} else {
|
||||
panic("unsupported architecture")
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ package platform
|
|||
type Arch uint64
|
||||
type ImageFormat uint64
|
||||
|
||||
const (
|
||||
const ( // architecture enum
|
||||
ARCH_AARCH64 Arch = iota
|
||||
ARCH_PPC64LE
|
||||
ARCH_S390X
|
||||
ARCH_X86_64
|
||||
)
|
||||
|
||||
const (
|
||||
const ( // image format enum
|
||||
FORMAT_UNSET ImageFormat = iota
|
||||
FORMAT_RAW
|
||||
FORMAT_ISO
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro/fedora"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/test_distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
)
|
||||
|
|
@ -313,7 +314,7 @@ func Test_upgrade(t *testing.T) {
|
|||
assert.NoError(err)
|
||||
|
||||
// The test data has image types only supported on Fedora X86_64
|
||||
registry.SetHostArchName(distro.X86_64ArchName)
|
||||
registry.SetHostArchName(platform.ARCH_X86_64.String())
|
||||
store := newStoreFromV0(storeStruct, registry, nil)
|
||||
assert.Equal(1, len(store.blueprints))
|
||||
assert.Equal(1, len(store.blueprintsChanges))
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro/test_distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/jobqueue/fsjobqueue"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
"github.com/osbuild/osbuild-composer/internal/test"
|
||||
|
|
@ -737,7 +738,7 @@ func enqueueAndFinishTestJobDependencies(s *worker.Server, deps []testJob) ([]uu
|
|||
switch dep.main.(type) {
|
||||
case *worker.OSBuildJob:
|
||||
job := dep.main.(*worker.OSBuildJob)
|
||||
id, err = s.EnqueueOSBuildAsDependency(distro.X86_64ArchName, job, depUUIDs, "")
|
||||
id, err = s.EnqueueOSBuildAsDependency(platform.ARCH_X86_64.String(), job, depUUIDs, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -807,7 +808,7 @@ func enqueueAndFinishTestJobDependencies(s *worker.Server, deps []testJob) ([]uu
|
|||
}
|
||||
|
||||
// request the previously added Job
|
||||
_, token, _, _, _, err := s.RequestJobById(context.Background(), distro.X86_64ArchName, id)
|
||||
_, token, _, _, _, err := s.RequestJobById(context.Background(), platform.ARCH_X86_64.String(), id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue