internal/rosa/package: migrate make
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m42s
Test / ShareFS (push) Successful in 3m49s
Test / Sandbox (race detector) (push) Successful in 5m29s
Test / Hakurei (race detector) (push) Successful in 6m31s
Test / Hakurei (push) Successful in 2m35s
Test / Flake checks (push) Successful in 1m23s
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m42s
Test / ShareFS (push) Successful in 3m49s
Test / Sandbox (race detector) (push) Successful in 5m29s
Test / Hakurei (race detector) (push) Successful in 6m31s
Test / Hakurei (push) Successful in 2m35s
Test / Flake checks (push) Successful in 1m23s
This also introduces the generic helper for unusual build scripts. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -544,6 +544,56 @@ cd '/usr/src/` + name + `/'
|
||||
)
|
||||
}
|
||||
|
||||
// GenericHelper directly passes build script segments for invocations of
|
||||
// one-off build scripts too specific to fit into any other [Helper]
|
||||
// implementation, but can still benefit from [Toolchain.NewPackage].
|
||||
type GenericHelper struct {
|
||||
// Whether to create and enter a directory in TMPDIR.
|
||||
EnterTemp bool
|
||||
|
||||
// Concatenated for [Toolchain].
|
||||
Build, Check, Install string
|
||||
}
|
||||
|
||||
var _ Helper = new(GenericHelper)
|
||||
|
||||
// extra is a noop.
|
||||
func (*GenericHelper) extra(int) P { return nil }
|
||||
|
||||
// wantsChmod returns false.
|
||||
func (*GenericHelper) wantsChmod() bool { return false }
|
||||
|
||||
// wantsWrite returns false.
|
||||
func (*GenericHelper) wantsWrite() bool { return false }
|
||||
|
||||
// scriptEarly returns the zero value.
|
||||
func (*GenericHelper) scriptEarly() string { return "" }
|
||||
|
||||
// createDir returns false.
|
||||
func (*GenericHelper) createDir() bool { return false }
|
||||
|
||||
// wantsDir requests a new directory in TMPDIR, or the source directory otherwise.
|
||||
func (attr *GenericHelper) wantsDir() string {
|
||||
if attr != nil && attr.EnterTemp {
|
||||
return `"$(mktemp -d)"`
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// script concatenates specified segments.
|
||||
func (attr *GenericHelper) script(t Toolchain, _ string) string {
|
||||
if attr == nil {
|
||||
attr = new(GenericHelper)
|
||||
}
|
||||
|
||||
script := attr.Build
|
||||
if t.opts&OptSkipCheck == 0 {
|
||||
script += attr.Check
|
||||
}
|
||||
script += attr.Install
|
||||
return script
|
||||
}
|
||||
|
||||
const (
|
||||
// jobsE is expression for preferred job count set by [pkg].
|
||||
jobsE = `"$` + pkg.EnvJobs + `"`
|
||||
|
||||
Reference in New Issue
Block a user