internal/rosa/hakurei: migrate to helper
All checks were successful
Test / Create distribution (push) Successful in 1m12s
Test / Sandbox (push) Successful in 3m2s
Test / ShareFS (push) Successful in 4m7s
Test / Sandbox (race detector) (push) Successful in 5m38s
Test / Hakurei (race detector) (push) Successful in 6m46s
Test / Hakurei (push) Successful in 2m43s
Test / Flake checks (push) Successful in 1m25s
All checks were successful
Test / Create distribution (push) Successful in 1m12s
Test / Sandbox (push) Successful in 3m2s
Test / ShareFS (push) Successful in 4m7s
Test / Sandbox (race detector) (push) Successful in 5m38s
Test / Hakurei (race detector) (push) Successful in 6m46s
Test / Hakurei (push) Successful in 2m43s
Test / Flake checks (push) Successful in 1m25s
This predates the helper infrastructure, so migrate it. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -3,7 +3,7 @@ package rosa
|
||||
import "hakurei.app/internal/pkg"
|
||||
|
||||
func (t Toolchain) newHakurei(
|
||||
suffix, script string,
|
||||
suffix, build, check, install string,
|
||||
withHostname bool,
|
||||
) pkg.Artifact {
|
||||
hostname := `
|
||||
@@ -14,7 +14,40 @@ go build -o /bin/hostname /usr/src/hostname/main.go
|
||||
hostname = ""
|
||||
}
|
||||
|
||||
return t.New("hakurei"+suffix+"-"+hakureiVersion, 0, t.Append(nil,
|
||||
name := "hakurei" + suffix
|
||||
return t.NewPackage(name, hakureiVersion, t.NewPatchedSource(
|
||||
"hakurei", hakureiVersion, hakureiSource, false, hakureiPatches...,
|
||||
), &PackageAttr{
|
||||
Writable: true,
|
||||
Env: []string{
|
||||
"CGO_ENABLED=1",
|
||||
"GOCACHE=/tmp/gocache",
|
||||
"CC=clang -O3 -Werror",
|
||||
},
|
||||
|
||||
Paths: []pkg.ExecPath{pkg.Path(AbsUsrSrc.Append("hostname", "main.go"), false, pkg.NewFile(
|
||||
"hostname.go",
|
||||
[]byte(`
|
||||
package main
|
||||
|
||||
import "os"
|
||||
|
||||
func main() {
|
||||
if name, err := os.Hostname(); err != nil {
|
||||
panic(err)
|
||||
} else {
|
||||
os.Stdout.WriteString(name)
|
||||
}
|
||||
}
|
||||
`),
|
||||
))},
|
||||
}, &GenericHelper{
|
||||
Build: hostname + `
|
||||
HAKUREI_VERSION='v` + hakureiVersion + `'
|
||||
` + build,
|
||||
Check: check,
|
||||
Install: install,
|
||||
},
|
||||
Go,
|
||||
PkgConfig,
|
||||
|
||||
@@ -30,36 +63,19 @@ go build -o /bin/hostname /usr/src/hostname/main.go
|
||||
WaylandProtocols,
|
||||
|
||||
KernelHeaders,
|
||||
), nil, []string{
|
||||
"CGO_ENABLED=1",
|
||||
"GOCACHE=/tmp/gocache",
|
||||
"CC=clang -O3 -Werror",
|
||||
}, hostname+`
|
||||
cd /usr/src/hakurei
|
||||
|
||||
HAKUREI_VERSION='v`+hakureiVersion+`'
|
||||
`+script, pkg.Path(AbsUsrSrc.Append("hakurei"), true, t.NewPatchedSource(
|
||||
"hakurei", hakureiVersion, hakureiSource, false, hakureiPatches...,
|
||||
)), pkg.Path(AbsUsrSrc.Append("hostname", "main.go"), false, pkg.NewFile(
|
||||
"hostname.go",
|
||||
[]byte(`
|
||||
package main
|
||||
|
||||
import "os"
|
||||
|
||||
func main() {
|
||||
if name, err := os.Hostname(); err != nil {
|
||||
panic(err)
|
||||
} else {
|
||||
os.Stdout.WriteString(name)
|
||||
}
|
||||
}
|
||||
`),
|
||||
)))
|
||||
)
|
||||
}
|
||||
func init() {
|
||||
native.mustRegister(func(t Toolchain) (pkg.Artifact, string) {
|
||||
return t.newHakurei("", `
|
||||
meta := Metadata{
|
||||
Name: "hakurei",
|
||||
Description: "low-level userspace tooling for Rosa OS",
|
||||
Website: "https://hakurei.app",
|
||||
Version: hakureiVersion,
|
||||
|
||||
ID: 388834,
|
||||
}
|
||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
||||
return &meta, t.newHakurei("", `
|
||||
mkdir -p /work/system/libexec/hakurei/
|
||||
|
||||
echo "Building hakurei for $(go env GOOS)/$(go env GOARCH)."
|
||||
@@ -74,36 +90,34 @@ go build -trimpath -tags=rosa -o /work/system/libexec/hakurei -ldflags="-s -w
|
||||
-X main.hakureiPath=/system/bin/hakurei
|
||||
" ./...
|
||||
echo
|
||||
|
||||
`, `
|
||||
echo '##### Testing hakurei.'
|
||||
go test -ldflags='-buildid= -linkmode external -extldflags=-static' ./...
|
||||
echo
|
||||
|
||||
`, `
|
||||
mkdir -p /work/system/bin/
|
||||
(cd /work/system/libexec/hakurei && mv \
|
||||
hakurei \
|
||||
sharefs \
|
||||
../../bin/)
|
||||
`, true), hakureiVersion
|
||||
}, &Metadata{
|
||||
Name: "hakurei",
|
||||
Description: "low-level userspace tooling for Rosa OS",
|
||||
Website: "https://hakurei.app/",
|
||||
|
||||
ID: 388834,
|
||||
`, true)
|
||||
})
|
||||
native.mustRegister(func(t Toolchain) (pkg.Artifact, string) {
|
||||
}
|
||||
func init() {
|
||||
meta := Metadata{
|
||||
Name: "hakurei-dist",
|
||||
Description: "low-level userspace tooling for Rosa OS (distribution tarball)",
|
||||
Website: "https://hakurei.app",
|
||||
Version: hakureiVersion,
|
||||
}
|
||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
||||
name := "all"
|
||||
if t.opts&OptSkipCheck != 0 {
|
||||
name = "make"
|
||||
}
|
||||
return t.newHakurei("-dist", `
|
||||
return &meta, t.newHakurei("-dist", `
|
||||
export HAKUREI_VERSION
|
||||
DESTDIR=/work /usr/src/hakurei/`+name+`.sh
|
||||
`, true), hakureiVersion
|
||||
}, &Metadata{
|
||||
Name: "hakurei-dist",
|
||||
Description: "low-level userspace tooling for Rosa OS (distribution tarball)",
|
||||
Website: "https://hakurei.app/",
|
||||
DESTDIR=/work ./`+name+`.sh
|
||||
`, "", "", true)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ go build -trimpath -v -o /work/system/libexec/hakurei -ldflags="-s -w
|
||||
-X hakurei.app/internal/info.buildVersion=${HAKUREI_VERSION}
|
||||
" ./cmd/earlyinit
|
||||
echo
|
||||
`, false)
|
||||
`, "", "", false)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user