forked from rosa/hakurei
internal/rosa: pass stage alongside state
This cleans up many function signatures. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -2,8 +2,7 @@ package rosa
|
||||
|
||||
import "hakurei.app/internal/pkg"
|
||||
|
||||
func (s *S) newHakurei(
|
||||
t Toolchain,
|
||||
func (t Toolchain) newHakurei(
|
||||
suffix, script string,
|
||||
withHostname bool,
|
||||
) pkg.Artifact {
|
||||
@@ -15,7 +14,7 @@ go build -o /bin/hostname /usr/src/hostname/main.go
|
||||
hostname = ""
|
||||
}
|
||||
|
||||
return s.New(t, "hakurei"+suffix+"-"+hakureiVersion, 0, s.AppendPresets(t, nil,
|
||||
return t.New("hakurei"+suffix+"-"+hakureiVersion, 0, t.Append(nil,
|
||||
Go,
|
||||
PkgConfig,
|
||||
|
||||
@@ -39,8 +38,8 @@ go build -o /bin/hostname /usr/src/hostname/main.go
|
||||
cd /usr/src/hakurei
|
||||
|
||||
HAKUREI_VERSION='v`+hakureiVersion+`'
|
||||
`+script, pkg.Path(AbsUsrSrc.Append("hakurei"), true, s.NewPatchedSource(
|
||||
t, "hakurei", hakureiVersion, hakureiSource, false, hakureiPatches...,
|
||||
`+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(`
|
||||
@@ -60,8 +59,8 @@ func main() {
|
||||
}
|
||||
func init() {
|
||||
native.MustRegister(&Artifact{
|
||||
f: func(t Toolchain, s *S) (pkg.Artifact, string) {
|
||||
return s.newHakurei(t, "", `
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
return t.newHakurei("", `
|
||||
mkdir -p /work/system/libexec/hakurei/
|
||||
|
||||
echo "Building hakurei for $(go env GOOS)/$(go env GOARCH)."
|
||||
@@ -96,12 +95,12 @@ mkdir -p /work/system/bin/
|
||||
ID: 388834,
|
||||
})
|
||||
native.MustRegister(&Artifact{
|
||||
f: func(t Toolchain, s *S) (pkg.Artifact, string) {
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
name := "all"
|
||||
if s.opts&OptSkipCheck != 0 {
|
||||
if t.opts&OptSkipCheck != 0 {
|
||||
name = "make"
|
||||
}
|
||||
return s.newHakurei(t, "-dist", `
|
||||
return t.newHakurei("-dist", `
|
||||
export HAKUREI_VERSION
|
||||
DESTDIR=/work /usr/src/hakurei/`+name+`.sh
|
||||
`, true), hakureiVersion
|
||||
|
||||
Reference in New Issue
Block a user