Skip to content

Commit

Permalink
mantle/system: Add RpmArch API
Browse files Browse the repository at this point in the history
A lot of our code uses the portage architecture, which no longer
makes sense.  Now, the more correct code for this is part of
rpm-ostree but I'm not sure we want to go to forking off that yet.
Since the build system only supports this set of architectures
currently, let's just inline the Go -> RPM translation here.
  • Loading branch information
cgwalters authored and openshift-merge-robot committed Mar 19, 2020
1 parent c17b6c2 commit 86966cc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mantle/system/arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,27 @@
package system

import (
"fmt"
"runtime"
)

// RpmArch returns the architecture in RPM terms.
func RpmArch() string {
goarch := runtime.GOARCH
switch goarch {
case "amd64":
return "x86_64"
case "arm64":
return "aarch64"
case "ppc64":
return "ppc64le"
case "s390x":
return "s390x"
default:
panic(fmt.Sprintf("RpmArch: No mapping defined for GOARCH %s", goarch))
}
}

func PortageArch() string {
arch := runtime.GOARCH
switch arch {
Expand Down

2 comments on commit 86966cc

@menantea
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code specific to ppc64le is not valid and make cosa failed.
it should be:
case "ppc64le":
return "ppc64le"
or eventually
case "ppc64", "ppc64le":
return "ppc64le"

@Prashanth684
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code specific to ppc64le is not valid and make cosa failed.
it should be:
case "ppc64le":
return "ppc64le"
or eventually
case "ppc64", "ppc64le":
return "ppc64le"

we noticed this in our multi-arch testing too. Planning to put the fix in after a test

Please sign in to comment.