Skip to content

Commit d76f3eb

Browse files
committed
builds: Fix arch to use standard coreos arch function
A perfect example of the enormous technical debt we've accrued in the python/shell/Go duplication, not to mention separate Go modules for mangle and gangplank. The gangplank code reimplemented logic to get the RPM architecture, and missed converting `arm64` from Go's arch to `aarch64`. Use the standard API we have for this in stream-metadata-go, the same as mantle does. This will fix extensions builds on aarch64.
1 parent 6a89503 commit d76f3eb

File tree

6 files changed

+266
-9
lines changed

6 files changed

+266
-9
lines changed

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ module github.com/coreos/coreos-assembler
22

33
go 1.17
44

5-
require github.com/spf13/cobra v1.5.0
5+
require (
6+
github.com/coreos/stream-metadata-go v0.4.0
7+
github.com/spf13/cobra v1.5.0
8+
)
69

710
require (
811
github.com/pkg/errors v0.9.1

go.sum

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/coreos/stream-metadata-go v0.4.0 h1:0OSYc0Q43lveZCzS8AvpWK+fgIMwDW+dwQYH56hSfBY=
2+
github.com/coreos/stream-metadata-go v0.4.0/go.mod h1:clbqsP1PUHnpmZHqn7mMOB/ZU+RFa3MxpAmcvE+FJkU=
13
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
24
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
35
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -16,9 +18,12 @@ github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJ
1618
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
1719
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
1820
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
21+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
1922
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
20-
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
2123
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
24+
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
25+
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
26+
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
2227
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
2328
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
2429
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
@@ -30,5 +35,6 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9w
3035
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3136
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3237
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
33-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
3438
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
39+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
40+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

pkg/builds/build.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import (
2424
"path/filepath"
2525
"reflect"
2626
"regexp"
27-
"runtime"
2827
"sort"
2928
"strings"
3029

3130
"github.com/pkg/errors"
3231
log "github.com/sirupsen/logrus"
32+
coreosarch "github.com/coreos/stream-metadata-go/arch"
3333
)
3434

3535
var (
@@ -67,11 +67,7 @@ func BuilderArch() string {
6767
if forceArch != "" {
6868
return forceArch
6969
}
70-
arch := runtime.GOARCH
71-
if arch == "amd64" {
72-
arch = "x86_64"
73-
}
74-
return arch
70+
return coreosarch.CurrentRpmArch()
7571
}
7672

7773
// defaultWalkFunc walks over a directory and returns a channel of os.FileInfo

vendor/github.com/coreos/stream-metadata-go/LICENSE

Lines changed: 201 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/coreos/stream-metadata-go/arch/arch.go

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# github.com/coreos/stream-metadata-go v0.4.0
2+
## explicit; go 1.17
3+
github.com/coreos/stream-metadata-go/arch
14
# github.com/inconshreveable/mousetrap v1.0.0
25
## explicit
36
github.com/inconshreveable/mousetrap

0 commit comments

Comments
 (0)