diff --git a/cmd/osbuild-dnf-json-tests/main_test.go b/cmd/osbuild-dnf-json-tests/main_test.go index e1a9c2bab..60bff89f5 100644 --- a/cmd/osbuild-dnf-json-tests/main_test.go +++ b/cmd/osbuild-dnf-json-tests/main_test.go @@ -14,9 +14,9 @@ import ( "github.com/osbuild/images/pkg/distro" rhel "github.com/osbuild/images/pkg/distro/rhel8" "github.com/osbuild/images/pkg/ostree" + "github.com/osbuild/images/pkg/platform" "github.com/osbuild/images/pkg/rpmmd" "github.com/osbuild/osbuild-composer/internal/dnfjson" - "github.com/osbuild/osbuild-composer/internal/platform" ) // This test loads all the repositories available in /repositories directory diff --git a/cmd/osbuild-image-tests/main_test.go b/cmd/osbuild-image-tests/main_test.go index 1b3b63d74..228927e0a 100644 --- a/cmd/osbuild-image-tests/main_test.go +++ b/cmd/osbuild-image-tests/main_test.go @@ -23,13 +23,13 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/osbuild/images/pkg/platform" "github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/constants" "github.com/osbuild/osbuild-composer/internal/boot" "github.com/osbuild/osbuild-composer/internal/boot/azuretest" "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/platform" "github.com/osbuild/osbuild-composer/internal/test" ) diff --git a/cmd/osbuild-store-dump/main.go b/cmd/osbuild-store-dump/main.go index fc20b6bf6..f8ab9621e 100644 --- a/cmd/osbuild-store-dump/main.go +++ b/cmd/osbuild-store-dump/main.go @@ -13,10 +13,10 @@ import ( "github.com/osbuild/images/pkg/distro/fedora" "github.com/osbuild/images/pkg/distroregistry" "github.com/osbuild/images/pkg/manifest" + "github.com/osbuild/images/pkg/platform" "github.com/osbuild/images/pkg/rpmmd" "github.com/osbuild/osbuild-composer/internal/blueprint" "github.com/osbuild/osbuild-composer/internal/dnfjson" - "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/store" "github.com/osbuild/osbuild-composer/internal/target" ) diff --git a/internal/boot/context-managers.go b/internal/boot/context-managers.go index 722161be0..4434d82c2 100644 --- a/internal/boot/context-managers.go +++ b/internal/boot/context-managers.go @@ -13,9 +13,9 @@ import ( "strings" "time" + "github.com/osbuild/images/pkg/platform" "github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/constants" "github.com/osbuild/osbuild-composer/internal/common" - "github.com/osbuild/osbuild-composer/internal/platform" ) // WithNetworkNamespace provides the function f with a new network namespace diff --git a/internal/platform/aarch64.go b/internal/platform/aarch64.go deleted file mode 100644 index 2e8b81cd6..000000000 --- a/internal/platform/aarch64.go +++ /dev/null @@ -1,62 +0,0 @@ -package platform - -type Aarch64 struct { - BasePlatform - UEFIVendor string -} - -func (p *Aarch64) GetArch() Arch { - return ARCH_AARCH64 -} - -func (p *Aarch64) GetUEFIVendor() string { - return p.UEFIVendor -} - -func (p *Aarch64) GetPackages() []string { - packages := p.BasePlatform.FirmwarePackages - - if p.UEFIVendor != "" { - packages = append(packages, - "dracut-config-generic", - "efibootmgr", - "grub2-efi-aa64", - "grub2-tools", - "shim-aa64") - } - - return packages -} - -type Aarch64_IoT struct { - BasePlatform - UEFIVendor string - BootFiles [][2]string -} - -func (p *Aarch64_IoT) GetArch() Arch { - return ARCH_AARCH64 -} - -func (p *Aarch64_IoT) GetUEFIVendor() string { - return p.UEFIVendor -} - -func (p *Aarch64_IoT) GetPackages() []string { - packages := p.BasePlatform.FirmwarePackages - - if p.UEFIVendor != "" { - packages = append(packages, - "dracut-config-generic", - "efibootmgr", - "grub2-efi-aa64", - "grub2-tools", - "shim-aa64") - } - - return packages -} - -func (p *Aarch64_IoT) GetBootFiles() [][2]string { - return p.BootFiles -} diff --git a/internal/platform/platform.go b/internal/platform/platform.go deleted file mode 100644 index 854b861d3..000000000 --- a/internal/platform/platform.go +++ /dev/null @@ -1,108 +0,0 @@ -package platform - -type Arch uint64 -type ImageFormat uint64 - -const ( // architecture enum - ARCH_AARCH64 Arch = iota - ARCH_PPC64LE - ARCH_S390X - ARCH_X86_64 -) - -const ( // image format enum - FORMAT_UNSET ImageFormat = iota - FORMAT_RAW - FORMAT_ISO - FORMAT_QCOW2 - FORMAT_VMDK - FORMAT_VHD - FORMAT_GCE - FORMAT_OVA -) - -func (a Arch) String() string { - switch a { - case ARCH_AARCH64: - return "aarch64" - case ARCH_PPC64LE: - return "ppc64le" - case ARCH_S390X: - return "s390x" - case ARCH_X86_64: - return "x86_64" - default: - panic("invalid architecture") - } -} - -func (f ImageFormat) String() string { - switch f { - case FORMAT_RAW: - return "raw" - case FORMAT_ISO: - return "iso" - case FORMAT_QCOW2: - return "qcow2" - case FORMAT_VMDK: - return "vmdk" - case FORMAT_VHD: - return "vhd" - case FORMAT_GCE: - return "gce" - case FORMAT_OVA: - return "ova" - default: - panic("invalid image format") - } -} - -type Platform interface { - GetArch() Arch - GetImageFormat() ImageFormat - GetQCOW2Compat() string - GetBIOSPlatform() string - GetUEFIVendor() string - GetZiplSupport() bool - GetPackages() []string - GetBuildPackages() []string - GetBootFiles() [][2]string -} - -type BasePlatform struct { - ImageFormat ImageFormat - QCOW2Compat string - FirmwarePackages []string -} - -func (p BasePlatform) GetImageFormat() ImageFormat { - return p.ImageFormat -} - -func (p BasePlatform) GetQCOW2Compat() string { - return p.QCOW2Compat -} - -func (p BasePlatform) GetBIOSPlatform() string { - return "" -} - -func (p BasePlatform) GetUEFIVendor() string { - return "" -} - -func (p BasePlatform) GetZiplSupport() bool { - return false -} - -func (p BasePlatform) GetPackages() []string { - return p.FirmwarePackages -} - -func (p BasePlatform) GetBuildPackages() []string { - return []string{} -} - -func (p BasePlatform) GetBootFiles() [][2]string { - return [][2]string{} -} diff --git a/internal/platform/ppc64le.go b/internal/platform/ppc64le.go deleted file mode 100644 index 8aab9634f..000000000 --- a/internal/platform/ppc64le.go +++ /dev/null @@ -1,33 +0,0 @@ -package platform - -type PPC64LE struct { - BasePlatform - BIOS bool -} - -func (p *PPC64LE) GetArch() Arch { - return ARCH_PPC64LE -} - -func (p *PPC64LE) GetBIOSPlatform() string { - if p.BIOS { - return "powerpc-ieee1275" - } - return "" -} - -func (p *PPC64LE) GetPackages() []string { - return []string{ - "dracut-config-generic", - "powerpc-utils", - "grub2-ppc64le", - "grub2-ppc64le-modules", - } -} - -func (p *PPC64LE) GetBuildPackages() []string { - return []string{ - "grub2-ppc64le", - "grub2-ppc64le-modules", - } -} diff --git a/internal/platform/s390x.go b/internal/platform/s390x.go deleted file mode 100644 index d67f52510..000000000 --- a/internal/platform/s390x.go +++ /dev/null @@ -1,32 +0,0 @@ -package platform - -type S390X struct { - BasePlatform - Zipl bool -} - -func (p *S390X) GetArch() Arch { - return ARCH_S390X -} - -func (p *S390X) GetZiplSupport() bool { - return p.Zipl -} - -func (p *S390X) GetPackages() []string { - packages := p.BasePlatform.FirmwarePackages - // TODO: should these packages be present also in images not intended for booting? - packages = append(packages, - "dracut-config-generic", - "s390utils-base", - "s390utils-core", - ) - return packages -} - -func (p *S390X) GetBuildPackages() []string { - // TODO: should these packages be present also in images not intended for booting? - return []string{ - "s390utils-base", - } -} diff --git a/internal/platform/x86_64.go b/internal/platform/x86_64.go deleted file mode 100644 index d9403b2f7..000000000 --- a/internal/platform/x86_64.go +++ /dev/null @@ -1,52 +0,0 @@ -package platform - -type X86BootLoader uint64 - -type X86 struct { - BasePlatform - BIOS bool - UEFIVendor string -} - -func (p *X86) GetArch() Arch { - return ARCH_X86_64 -} - -func (p *X86) GetBIOSPlatform() string { - if p.BIOS { - return "i386-pc" - } - return "" -} - -func (p *X86) GetUEFIVendor() string { - return p.UEFIVendor -} - -func (p *X86) GetPackages() []string { - packages := p.BasePlatform.FirmwarePackages - - if p.BIOS { - packages = append(packages, - "dracut-config-generic", - "grub2-pc") - } - - if p.UEFIVendor != "" { - packages = append(packages, - "dracut-config-generic", - "efibootmgr", - "grub2-efi-x64", - "shim-x64") - } - - return packages -} - -func (p *X86) GetBuildPackages() []string { - packages := []string{} - if p.BIOS { - packages = append(packages, "grub2-pc") - } - return packages -} diff --git a/internal/store/json_test.go b/internal/store/json_test.go index bf5696fd3..0e8f43d27 100644 --- a/internal/store/json_test.go +++ b/internal/store/json_test.go @@ -17,10 +17,10 @@ import ( "github.com/osbuild/images/pkg/distro/fedora" "github.com/osbuild/images/pkg/distro/test_distro" "github.com/osbuild/images/pkg/distroregistry" + "github.com/osbuild/images/pkg/platform" "github.com/osbuild/images/pkg/rpmmd" "github.com/osbuild/osbuild-composer/internal/blueprint" "github.com/osbuild/osbuild-composer/internal/common" - "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/target" ) diff --git a/internal/worker/server_test.go b/internal/worker/server_test.go index f11473772..eaa7fbd81 100644 --- a/internal/worker/server_test.go +++ b/internal/worker/server_test.go @@ -20,9 +20,9 @@ import ( "github.com/osbuild/images/pkg/distro/test_distro" "github.com/osbuild/images/pkg/manifest" "github.com/osbuild/images/pkg/osbuild" + "github.com/osbuild/images/pkg/platform" "github.com/osbuild/images/pkg/rpmmd" "github.com/osbuild/osbuild-composer/internal/jobqueue/fsjobqueue" - "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/target" "github.com/osbuild/osbuild-composer/internal/test" "github.com/osbuild/osbuild-composer/internal/worker"