Skip to content

Commit

Permalink
internal/relui: drop v6l suffix from non-linux/arm download metadata
Browse files Browse the repository at this point in the history
For historical reasons, the binary release for the linux/arm port we
provide at https://go.dev/dl/ is a bit of a special case. It differs
from other ports in that it's built with GOARM overridden to a value
of 6, and the filename has a "v6l" suffix after "arm". The download
metadata has a field "arch" where that v6l suffix is being included.

This special case needs to be handled consistently in various places,
which can be easy to get slightly wrong sometimes (e.g., CL 504820,
go.dev/issue/62514, etc.).

It turns out a GOOS == linux check was missed when porting the metadata
publishing logic from releasebot to relui, causing metadata for Go 1.21
onwards to be "armv6l" for arm ports of all OSes, not just Linux. Cease
doing that in Go 1.23 (the nearest major release, to minimize potential
disruption in minor releases).

Spotted this via https://hachyderm.io/@golang/112044405859439427 which
happened to select the netbsd/arm port. The fact that this hasn't been
reported sooner suggests this isn't a very serious problem fortunately.

Change-Id: I732ca7a6db181e81d31b265df48e7a9f47ed2c6c
Reviewed-on: https://go-review.googlesource.com/c/build/+/584403
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Michael Pratt <[email protected]>
  • Loading branch information
dmitshur authored and gopherbot committed May 10, 2024
1 parent 4b28576 commit ef977b7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
8 changes: 8 additions & 0 deletions internal/relui/buildrelease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ func testRelease(t *testing.T, prevTag string, major int, wantVersion string, ki
"go/VERSION": versionFile,
"go/tool/something_orother/compile": "",
})
checkTGZ(t, dlURL, files, "netbsd-arm.tar.gz", task.WebsiteFile{
OS: "netbsd",
Arch: "arm" + map[int]string{21: "v6l", 22: "v6l"}[major],
Kind: "archive",
}, map[string]string{
"go/VERSION": versionFile,
"go/tool/something_orother/compile": "",
})
checkTGZ(t, dlURL, files, "darwin-amd64.tar.gz", task.WebsiteFile{
OS: "darwin",
Arch: "amd64",
Expand Down
11 changes: 10 additions & 1 deletion internal/relui/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -1626,9 +1626,18 @@ func (tasks *BuildReleaseTasks) publishArtifacts(ctx *wf.TaskContext, version st
if a.Target != nil {
f.OS = a.Target.GOOS
f.Arch = a.Target.GOARCH
if a.Target.GOARCH == "arm" {
if a.Target.GOOS == "linux" && a.Target.GOARCH == "arm" && slices.Contains(a.Target.ExtraEnv, "GOARM=6") {
f.Arch = "armv6l"
}
if task.CompareGoVersions(version, "go1.23") == -1 { // TODO: Delete this after Go 1.24.0 is out and this becomes dead code.
// Due to an oversight, we've been inadvertently setting the "arch" field
// of published download metadata to "armv6l" for all arm ports, not just
// linux/arm port as intended. Keep doing it for the rest of Go 1.22/1.21
// minor releases only.
if a.Target.GOARCH == "arm" {
f.Arch = "armv6l"
}
}
}
switch a.Suffix {
case "src.tar.gz":
Expand Down
4 changes: 2 additions & 2 deletions internal/task/gover.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

package task

// compareGoVersions returns -1, 0, or +1 depending on whether
// CompareGoVersions returns -1, 0, or +1 depending on whether
// x < y, x == y, or x > y, interpreted as toolchain versions.
// The versions x and y must begin with a "go" prefix: "go1.21" not "1.21".
// Malformed versions compare less than well-formed versions and equal to each other.
// The language version "go1.21" compares less than the release candidate and eventual releases "go1.21rc1" and "go1.21.0".
func compareGoVersions(x, y string) int {
func CompareGoVersions(x, y string) int {
vx := parse(x)
vy := parse(y)

Expand Down
2 changes: 1 addition & 1 deletion internal/task/updateproxytestrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (t *UpdateProxyTestRepoTasks) UpdateProxyTestRepo(ctx *wf.TaskContext, publ
}
// If the published version is lower than the current go.mod version, don't update.
// If we could parse the go.mod file, assume we should update.
if f.Go != nil && compareGoVersions(published.Version, "go"+f.Go.Version) < 0 {
if f.Go != nil && CompareGoVersions(published.Version, "go"+f.Go.Version) < 0 {
return "no update", nil
}

Expand Down

0 comments on commit ef977b7

Please sign in to comment.