From 8fa6da0faf337b1d0a140c0b8ea054a2e3d25981 Mon Sep 17 00:00:00 2001 From: Caner Derici Date: Thu, 8 Sep 2022 12:18:55 -0600 Subject: [PATCH 1/3] Add riscv64 to supported architectures --- arch/arch.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arch.go b/arch/arch.go index 38eeac5e7..155b2a316 100644 --- a/arch/arch.go +++ b/arch/arch.go @@ -17,6 +17,7 @@ const ( ARM64 = "arm64" PPC64EL = "ppc64el" S390X = "s390x" + RISCV64 = "riscv64" // Older versions of Juju used "ppc64" instead of ppc64el LEGACY_PPC64 = "ppc64" @@ -30,6 +31,7 @@ var AllSupportedArches = []string{ ARM64, PPC64EL, S390X, + RISCV64, } // Info records the information regarding each architecture recognised by Juju. @@ -40,6 +42,7 @@ var Info = map[string]ArchInfo{ ARM64: {64}, PPC64EL: {64}, S390X: {64}, + RISCV64: {64}, } // ArchInfo is a struct containing information about a supported architecture. @@ -60,6 +63,7 @@ var archREs = []struct { {regexp.MustCompile("aarch64"), ARM64}, {regexp.MustCompile("ppc64|ppc64el|ppc64le"), PPC64EL}, {regexp.MustCompile("s390x"), S390X}, + {regexp.MustCompile("risc$|risc-[vV]64"), RISCV64}, } // Override for testing. From 961d55c7efa4f33ca2a2a4a5572ba0d09cdd4124 Mon Sep 17 00:00:00 2001 From: Caner Derici Date: Thu, 8 Sep 2022 12:20:28 -0600 Subject: [PATCH 2/3] Add some variants for different outputs for RISCV --- arch/arch_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arch_test.go b/arch/arch_test.go index a658a0ee8..933e9c6af 100644 --- a/arch/arch_test.go +++ b/arch/arch_test.go @@ -40,6 +40,9 @@ func (s *archSuite) TestNormaliseArch(c *gc.C) { {"ppc64le", "ppc64el"}, {"ppc64", "ppc64el"}, {"s390x", "s390x"}, + {"risc", "riscv64"}, + {"risc-v64", "riscv64"}, + {"risc-V64", "riscv64"}, } { arch := arch.NormaliseArch(test.raw) c.Check(arch, gc.Equals, test.arch) From 4dbe60c8ef6c688b559eec140bf3406e50945b5a Mon Sep 17 00:00:00 2001 From: Caner Derici Date: Mon, 12 Sep 2022 16:41:57 -0600 Subject: [PATCH 3/3] Make sure original arch name could match --- arch/arch.go | 2 +- arch/arch_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arch.go b/arch/arch.go index 155b2a316..765e17ba5 100644 --- a/arch/arch.go +++ b/arch/arch.go @@ -63,7 +63,7 @@ var archREs = []struct { {regexp.MustCompile("aarch64"), ARM64}, {regexp.MustCompile("ppc64|ppc64el|ppc64le"), PPC64EL}, {regexp.MustCompile("s390x"), S390X}, - {regexp.MustCompile("risc$|risc-[vV]64"), RISCV64}, + {regexp.MustCompile("riscv64|risc$|risc-[vV]64"), RISCV64}, } // Override for testing. diff --git a/arch/arch_test.go b/arch/arch_test.go index 933e9c6af..b16c2f152 100644 --- a/arch/arch_test.go +++ b/arch/arch_test.go @@ -40,6 +40,7 @@ func (s *archSuite) TestNormaliseArch(c *gc.C) { {"ppc64le", "ppc64el"}, {"ppc64", "ppc64el"}, {"s390x", "s390x"}, + {"riscv64", "riscv64"}, {"risc", "riscv64"}, {"risc-v64", "riscv64"}, {"risc-V64", "riscv64"},