From 59355c6c91bf4f0ec718411da759dd99e1370b14 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 27 May 2020 23:50:59 +0200 Subject: [PATCH] distro/rhel8: add preliminary support for ppc64le and s390x This adds placeholder architecture structs, but no image types are hooked up. This will allow osbuild-composer to run on these architectures, and serve the weldr API, but without support for building any images. Image type support will be added in the future. Signed-off-by: Tom Gundersen --- internal/distro/rhel8/distro.go | 12 +++++++++++- internal/distro/rhel8/distro_test.go | 16 +++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/internal/distro/rhel8/distro.go b/internal/distro/rhel8/distro.go index d8c658289..28415498d 100644 --- a/internal/distro/rhel8/distro.go +++ b/internal/distro/rhel8/distro.go @@ -844,7 +844,17 @@ func New() distro.Distro { openstackImgType, ) - r.setArches(x8664, aarch64) + ppc64le := architecture{ + distro: &r, + name: "ppc64le", + } + + s390x := architecture{ + distro: &r, + name: "s390x", + } + + r.setArches(x8664, aarch64, ppc64le, s390x) return &r } diff --git a/internal/distro/rhel8/distro_test.go b/internal/distro/rhel8/distro_test.go index b1e744fba..8e4a84c6f 100644 --- a/internal/distro/rhel8/distro_test.go +++ b/internal/distro/rhel8/distro_test.go @@ -103,6 +103,8 @@ func TestImageType_BuildPackages(t *testing.T) { buildPackages := map[string][]string{ "x86_64": x8664BuildPackages, "aarch64": aarch64BuildPackages, + "ppc64le": nil, + "s390x": nil, } d := rhel8.New() for _, archLabel := range d.ListArches() { @@ -144,6 +146,12 @@ func TestImageType_Name(t *testing.T) { "openstack", }, }, + { + arch: "ppc64le", + }, + { + arch: "s390x", + }, } for _, mapping := range imgMap { arch, err := distro.GetArch(mapping.arch) @@ -328,7 +336,7 @@ func TestDistro_Manifest(t *testing.T) { func TestRhel8_ListArches(t *testing.T) { distro := rhel8.New() arches := distro.ListArches() - assert.Equal(t, []string{"aarch64", "x86_64"}, arches) + assert.Equal(t, []string{"aarch64", "ppc64le", "s390x", "x86_64"}, arches) } func TestRhel8_GetArch(t *testing.T) { @@ -343,6 +351,12 @@ func TestRhel8_GetArch(t *testing.T) { { name: "aarch64", }, + { + name: "ppc64le", + }, + { + name: "s390x", + }, { name: "foo-arch", errorExpected: true,