cmd/gorebuild: add GOARM=6 special case to reproduce linux/arm downloads
The default GOARM value during cross-compilation in Go 1.21 is 7,
but the historical decision for go.dev/dl/ release archives is 6.
So gorebuild needs to know about the discrepancy. :(
Fixes golang/go#62514.
Change-Id: I78069a9ed93dda884f0b745d7949bc49992958ac
Reviewed-on: https://go-review.googlesource.com/c/build/+/526263
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/cmd/gorebuild/build.go b/cmd/gorebuild/build.go
index 6cfb4b3..7b1a59d 100644
--- a/cmd/gorebuild/build.go
+++ b/cmd/gorebuild/build.go
@@ -140,8 +140,7 @@
}
cmd := exec.Command(make, args...)
cmd.Dir = filepath.Join(goroot, "src")
- cmd.Env = append(os.Environ(), env...)
- cmd.Env = append(cmd.Env,
+ cmd.Env = append(os.Environ(),
"GOROOT="+goroot,
"GOROOT_BOOTSTRAP="+bdir,
"GOTOOLCHAIN=local", // keep bootstraps honest
@@ -172,6 +171,7 @@
"GO_LDSO=",
"PKG_CONFIG=",
)
+ cmd.Env = append(cmd.Env, env...)
log.Printf("running %s env=%v args=%v\nGOROOT=%s\nGOROOT_BOOTSTRAP=%s\n",
make, env, args, goroot, bdir)
out, err := cmd.CombinedOutput()
diff --git a/cmd/gorebuild/report.go b/cmd/gorebuild/report.go
index 58aaa3f..4899a77 100644
--- a/cmd/gorebuild/report.go
+++ b/cmd/gorebuild/report.go
@@ -335,7 +335,13 @@
if err := UnpackTarGz(goroot, src); err != nil {
return err
}
- if err := r.Build(&file.Log, goroot, rel.Version, []string{"GOOS=" + file.GOOS, "GOARCH=" + file.GOARCH}, []string{"-distpack"}); err != nil {
+ env := []string{"GOOS=" + file.GOOS, "GOARCH=" + file.GOARCH}
+ // For historical reasons, the linux-arm downloads are built
+ // with GOARM=6, even though the cross-compiled default is 7.
+ if strings.HasSuffix(file.Name, "-armv6l.tar.gz") || strings.HasSuffix(file.Name, ".linux-arm.zip") {
+ env = append(env, "GOARM=6")
+ }
+ if err := r.Build(&file.Log, goroot, rel.Version, env, []string{"-distpack"}); err != nil {
return err
}
@@ -383,7 +389,7 @@
bf.Log.Printf("FAIL: rebuilt SHA256 %s does not match public download SHA256 %s", SHA256(data), SHA256(pubData))
continue
}
- bf.Log.Printf("PASS: rebuilt with GOOS=%s GOARCH=%s", file.GOOS, file.GOARCH)
+ bf.Log.Printf("PASS: rebuilt with %q", env)
if bf.dl != nil && bf.dl.Kind == "archive" {
if file.GOOS == "darwin" {
r.ReproDarwinPkg(rel, bf, pubData)