internal/rosa/go: migrate to generic helper
All checks were successful
Test / Create distribution (push) Successful in 1m9s
Test / ShareFS (push) Successful in 9m41s
Test / Sandbox (race detector) (push) Successful in 10m9s
Test / Hakurei (race detector) (push) Successful in 12m44s
Test / Sandbox (push) Successful in 1m35s
Test / Hakurei (push) Successful in 2m38s
Test / Flake checks (push) Successful in 1m20s
All checks were successful
Test / Create distribution (push) Successful in 1m9s
Test / ShareFS (push) Successful in 9m41s
Test / Sandbox (race detector) (push) Successful in 10m9s
Test / Hakurei (race detector) (push) Successful in 12m44s
Test / Sandbox (push) Successful in 1m35s
Test / Hakurei (push) Successful in 2m38s
Test / Flake checks (push) Successful in 1m20s
The go toolchain predates all abstractions currently available. This migration causes rebuilds due to internal cleanups affecting the final build script. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -8,79 +8,101 @@ import (
|
||||
|
||||
var _go = H("go")
|
||||
|
||||
// newGoBootstrap returns the Go bootstrap toolchain.
|
||||
func (t Toolchain) newGoBootstrap() pkg.Artifact {
|
||||
const checksum = "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23"
|
||||
return t.New("go1.4-bootstrap", 0, t.Append(nil,
|
||||
_bash,
|
||||
), nil, []string{
|
||||
"CGO_ENABLED=0",
|
||||
}, `
|
||||
mkdir -p /var/tmp/ /work/system/
|
||||
cp -r /usr/src/go /work/system/
|
||||
cd /work/system/go/src
|
||||
chmod -R +w ..
|
||||
|
||||
./make.bash
|
||||
`, pkg.Path(AbsUsrSrc.Append("go"), false, newTar(
|
||||
"https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
|
||||
checksum,
|
||||
pkg.TarGzip,
|
||||
)))
|
||||
}
|
||||
|
||||
// newGo returns a specific version of the Go toolchain.
|
||||
func (t Toolchain) newGo(
|
||||
version, checksum string,
|
||||
env []string,
|
||||
script string,
|
||||
extra ...pkg.Artifact,
|
||||
boot pkg.Artifact,
|
||||
) pkg.Artifact {
|
||||
name := "all"
|
||||
if t.opts&OptSkipCheck != 0 {
|
||||
name = "make"
|
||||
}
|
||||
return t.New("go"+version, 0, t.Append(extra,
|
||||
_bash,
|
||||
), nil, slices.Concat([]string{
|
||||
return t.NewPackage("go", version, newTar(
|
||||
"https://go.dev/dl/go"+version+".src.tar.gz",
|
||||
checksum,
|
||||
pkg.TarGzip,
|
||||
), &PackageAttr{
|
||||
EnterSource: true,
|
||||
Env: slices.Concat([]string{
|
||||
"CC=cc",
|
||||
"GOCACHE=/tmp/gocache",
|
||||
"GOROOT_BOOTSTRAP=/system/go",
|
||||
"TMPDIR=/dev/shm/go",
|
||||
}, env), `
|
||||
mkdir /work/system "${TMPDIR}"
|
||||
cp -r /usr/src/go /work/system
|
||||
cd /work/system/go/src
|
||||
}, env),
|
||||
|
||||
Extra: []pkg.Artifact{boot},
|
||||
}, &GenericHelper{
|
||||
InPlace: true,
|
||||
Build: `
|
||||
mkdir /work/system/ "${TMPDIR}"
|
||||
cp -r . /work/system/go
|
||||
cd /work/system/go/src/
|
||||
chmod -R +w ..
|
||||
` + script + `
|
||||
./`+name+`.bash
|
||||
set +u
|
||||
. ./make.bash "$@" --no-banner
|
||||
set -u
|
||||
`,
|
||||
Check: "bash run.bash --no-rebuild\n",
|
||||
Install: `
|
||||
../bin/go tool dist banner # print build info
|
||||
|
||||
mkdir /work/system/bin
|
||||
ln -s \
|
||||
../go/bin/go \
|
||||
../go/bin/gofmt \
|
||||
/work/system/bin
|
||||
`, pkg.Path(AbsUsrSrc.Append("go"), false, newTar(
|
||||
"https://go.dev/dl/go"+version+".src.tar.gz",
|
||||
checksum,
|
||||
pkg.TarGzip,
|
||||
)))
|
||||
`,
|
||||
},
|
||||
_bash,
|
||||
)
|
||||
}
|
||||
|
||||
func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
|
||||
func init() {
|
||||
const (
|
||||
version = "1.26.3"
|
||||
checksum = "lEiFocZFnN5fKvZzmwVdqc9pYUjAuhzqZGbuiOqxUP4XdcY8yECisKcqsQ_eNn1N"
|
||||
)
|
||||
meta := Metadata{
|
||||
Name: "go",
|
||||
Description: "the Go programming language toolchain",
|
||||
Website: "https://go.dev",
|
||||
Version: version,
|
||||
|
||||
ID: 1227,
|
||||
}
|
||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
||||
var (
|
||||
bootstrapEnv []string
|
||||
bootstrapExtra []pkg.Artifact
|
||||
bootstrapEarly pkg.Artifact
|
||||
|
||||
finalEnv []string
|
||||
)
|
||||
switch t.arch {
|
||||
case "amd64":
|
||||
bootstrapExtra = append(bootstrapExtra, t.newGoBootstrap())
|
||||
bootstrapEarly = t.NewPackage("go", "1.4-bootstrap", newTar(
|
||||
"https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
|
||||
"8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23",
|
||||
pkg.TarGzip,
|
||||
), &PackageAttr{
|
||||
EnterSource: true,
|
||||
Env: []string{
|
||||
"CGO_ENABLED=0",
|
||||
},
|
||||
}, &GenericHelper{
|
||||
InPlace: true,
|
||||
Build: `
|
||||
mkdir /work/system/
|
||||
cp -r . /work/system/go
|
||||
cd /work/system/go/src/
|
||||
mkdir -p /var/tmp/
|
||||
./make.bash
|
||||
`,
|
||||
},
|
||||
_bash,
|
||||
)
|
||||
|
||||
case "arm64", "riscv64":
|
||||
bootstrapEnv = append(bootstrapEnv, "GOROOT_BOOTSTRAP=/system")
|
||||
bootstrapExtra = t.Append(bootstrapExtra, H("gcc"))
|
||||
_, bootstrapEarly = t.MustLoad(H("gcc"))
|
||||
finalEnv = append(finalEnv, "CGO_ENABLED=0")
|
||||
|
||||
default:
|
||||
@@ -101,7 +123,7 @@ sed -i \
|
||||
echo \
|
||||
'type syscallDescriptor = int' >> \
|
||||
os/rawconn_test.go
|
||||
`, bootstrapExtra...)
|
||||
`, bootstrapEarly)
|
||||
|
||||
go121 := t.newGo(
|
||||
"1.21.13",
|
||||
@@ -145,11 +167,7 @@ rm \
|
||||
`, go123,
|
||||
)
|
||||
|
||||
const (
|
||||
version = "1.26.3"
|
||||
checksum = "lEiFocZFnN5fKvZzmwVdqc9pYUjAuhzqZGbuiOqxUP4XdcY8yECisKcqsQ_eNn1N"
|
||||
)
|
||||
return t.newGo(
|
||||
return &meta, t.newGo(
|
||||
version,
|
||||
checksum,
|
||||
finalEnv, `
|
||||
@@ -165,14 +183,7 @@ rm \
|
||||
cmd/cgo/internal/testsanitizers/tsan_test.go \
|
||||
cmd/cgo/internal/testsanitizers/cshared_test.go
|
||||
`, go125,
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
native.mustRegister(Toolchain.newGoLatest, &Metadata{
|
||||
Name: "go",
|
||||
Description: "the Go programming language toolchain",
|
||||
Website: "https://go.dev/",
|
||||
)
|
||||
|
||||
ID: 1227,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ go build -o /bin/hostname /usr/src/hostname/main.go
|
||||
return t.NewPackage(name, hakureiVersion, t.NewPatchedSource(
|
||||
"hakurei-"+hakureiVersion, hakureiSource, false, hakureiPatches...,
|
||||
), &PackageAttr{
|
||||
EnterSource: true,
|
||||
Writable: true,
|
||||
Env: []string{
|
||||
"CGO_ENABLED=1",
|
||||
@@ -42,6 +43,7 @@ func main() {
|
||||
`),
|
||||
))},
|
||||
}, &GenericHelper{
|
||||
InPlace: true,
|
||||
Build: hostname + `
|
||||
HAKUREI_VERSION='v` + hakureiVersion + `'
|
||||
` + build,
|
||||
|
||||
@@ -413,6 +413,8 @@ type PackageAttr struct {
|
||||
// Passed to [Toolchain.NewPatchedSource].
|
||||
Patches []KV
|
||||
|
||||
// Unregistered extras.
|
||||
Extra []pkg.Artifact
|
||||
// Passed through to [Toolchain.New], before source.
|
||||
Paths []pkg.ExecPath
|
||||
// Passed through to [Toolchain.New].
|
||||
@@ -481,7 +483,8 @@ func (t Toolchain) NewPackage(
|
||||
rn = name + "-" + version
|
||||
}
|
||||
wantsChmod, wantsWrite := helper.wantsChmod(), helper.wantsWrite()
|
||||
extraRes := make([]pkg.Artifact, 0, 1<<3+len(extra))
|
||||
extraRes := make([]pkg.Artifact, 0, 1<<3+len(attr.Extra)+len(extra))
|
||||
extraRes = append(extraRes, attr.Extra...)
|
||||
{
|
||||
pv := paGet()
|
||||
for _, p := range helper.extra(attr.Flag) {
|
||||
|
||||
Reference in New Issue
Block a user