Skip to content

Commit e274ea0

Browse files
ncwNyaMisty
authored andcommitted
build: fix ARM architecture version in .deb packages after nfpm change
Fixes #5973
1 parent 766f57a commit e274ea0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

bin/cross-compile.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ var archFlags = map[string][]string{
8585
"arm-v7": {"GOARM=7"},
8686
}
8787

88+
// Map Go architectures to NFPM architectures
89+
// Any missing are passed straight through
90+
var goarchToNfpm = map[string]string{
91+
"arm": "arm6",
92+
"arm-v7": "arm7",
93+
}
94+
8895
// runEnv - run a shell command with env
8996
func runEnv(args, env []string) error {
9097
if *debug {
@@ -167,11 +174,15 @@ func buildDebAndRpm(dir, version, goarch string) []string {
167174
pkgVersion := version[1:]
168175
pkgVersion = strings.Replace(pkgVersion, "β", "-beta", -1)
169176
pkgVersion = strings.Replace(pkgVersion, "-", ".", -1)
177+
nfpmArch, ok := goarchToNfpm[goarch]
178+
if !ok {
179+
nfpmArch = goarch
180+
}
170181

171182
// Make nfpm.yaml from the template
172183
substitute("../bin/nfpm.yaml", path.Join(dir, "nfpm.yaml"), map[string]string{
173184
"Version": pkgVersion,
174-
"Arch": goarch,
185+
"Arch": nfpmArch,
175186
})
176187

177188
// build them
@@ -377,7 +388,7 @@ func compileArch(version, goos, goarch, dir string) bool {
377388
artifacts := []string{buildZip(dir)}
378389
// build a .deb and .rpm if appropriate
379390
if goos == "linux" {
380-
artifacts = append(artifacts, buildDebAndRpm(dir, version, stripVersion(goarch))...)
391+
artifacts = append(artifacts, buildDebAndRpm(dir, version, goarch)...)
381392
}
382393
if *copyAs != "" {
383394
for _, artifact := range artifacts {

0 commit comments

Comments
 (0)