internal/rosa: do not register stage0
All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 2m54s
Test / ShareFS (push) Successful in 3m42s
Test / Hakurei (push) Successful in 3m56s
Test / Sandbox (race detector) (push) Successful in 5m23s
Test / Hakurei (race detector) (push) Successful in 6m30s
Test / Flake checks (push) Successful in 1m21s
All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 2m54s
Test / ShareFS (push) Successful in 3m42s
Test / Hakurei (push) Successful in 3m56s
Test / Sandbox (race detector) (push) Successful in 5m23s
Test / Hakurei (race detector) (push) Successful in 6m30s
Test / Flake checks (push) Successful in 1m21s
Nothing can depend on this, so remove it from the namespace. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -91,7 +91,7 @@ func main() {
|
|||||||
addr net.UnixAddr
|
addr net.UnixAddr
|
||||||
)
|
)
|
||||||
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) error {
|
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) error {
|
||||||
if !rosa.Native().HasStage0() {
|
if !rosa.Native().HasStageEarly() {
|
||||||
return pkg.UnsupportedArchError(runtime.GOARCH)
|
return pkg.UnsupportedArchError(runtime.GOARCH)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rosa.Native().DropCaches(flagArch, flags)
|
rosa.Native().DropCaches(flagArch, flags)
|
||||||
if !rosa.Native().HasStage0() {
|
if !rosa.Native().HasStageEarly() {
|
||||||
return pkg.UnsupportedArchError(flagArch)
|
return pkg.UnsupportedArchError(flagArch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,8 +452,9 @@ func main() {
|
|||||||
checksum [2]unique.Handle[pkg.Checksum]
|
checksum [2]unique.Handle[pkg.Checksum]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_llvm := rosa.H("llvm")
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, llvm := rosa.Native().New(s - 2).Load(rosa.LLVM)
|
_, llvm := rosa.Native().New(s - 2).Load(_llvm)
|
||||||
pathname, _, err = cache.Cure(llvm)
|
pathname, _, err = cache.Cure(llvm)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -462,7 +463,7 @@ func main() {
|
|||||||
log.Println("stage1:", pathname)
|
log.Println("stage1:", pathname)
|
||||||
|
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, llvm := rosa.Native().New(s - 1).Load(rosa.LLVM)
|
_, llvm := rosa.Native().New(s - 1).Load(_llvm)
|
||||||
pathname, checksum[0], err = cache.Cure(llvm)
|
pathname, checksum[0], err = cache.Cure(llvm)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -470,7 +471,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
log.Println("stage2:", pathname)
|
log.Println("stage2:", pathname)
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, llvm := rosa.Native().New(s).Load(rosa.LLVM)
|
_, llvm := rosa.Native().New(s).Load(_llvm)
|
||||||
pathname, checksum[1], err = cache.Cure(llvm)
|
pathname, checksum[1], err = cache.Cure(llvm)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -492,8 +493,7 @@ func main() {
|
|||||||
|
|
||||||
if flagStage0 {
|
if flagStage0 {
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, stage0 := rosa.Native().New(s).Load(rosa.Stage0)
|
pathname, _, err = cache.Cure(rosa.Native().Std().NewStage0())
|
||||||
pathname, _, err = cache.Cure(stage0)
|
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return
|
return
|
||||||
@@ -767,14 +767,14 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base := rosa.LLVM
|
base := rosa.H("llvm")
|
||||||
if !flagWithToolchain {
|
if !flagWithToolchain {
|
||||||
base = rosa.H("musl")
|
base = rosa.H("musl")
|
||||||
}
|
}
|
||||||
handles = append(handles,
|
handles = append(handles,
|
||||||
base,
|
base,
|
||||||
rosa.Mksh,
|
rosa.H("mksh"),
|
||||||
rosa.Toybox,
|
rosa.H("toybox"),
|
||||||
)
|
)
|
||||||
|
|
||||||
root := make(pkg.Collect, 0, 6+len(args))
|
root := make(pkg.Collect, 0, 6+len(args))
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ func init() {
|
|||||||
mksquashfs /mnt/system /work/system.img
|
mksquashfs /mnt/system /work/system.img
|
||||||
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil,
|
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil,
|
||||||
_musl,
|
_musl,
|
||||||
Mksh,
|
_mksh,
|
||||||
Toybox,
|
_toybox,
|
||||||
|
|
||||||
H("kmod"),
|
H("kmod"),
|
||||||
H("kernel"),
|
H("kernel"),
|
||||||
|
|||||||
@@ -213,15 +213,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// The Mksh shell is added by [Toolchain.New] and used by almost all packages.
|
|
||||||
Mksh = H("mksh")
|
|
||||||
// Toybox is standard utilities added by [Toolchain.New].
|
|
||||||
Toybox = H("toybox")
|
|
||||||
// LLVM is the standard toolchain added by [Toolchain.New].
|
|
||||||
LLVM = H("llvm")
|
|
||||||
|
|
||||||
_stage0Dist = H("stage0-dist")
|
_stage0Dist = H("stage0-dist")
|
||||||
|
_mksh = H("mksh")
|
||||||
|
_toybox = H("toybox")
|
||||||
_toyboxEarly = H("toybox-early")
|
_toyboxEarly = H("toybox-early")
|
||||||
|
_llvm = H("llvm")
|
||||||
|
_patch = H("patch")
|
||||||
)
|
)
|
||||||
|
|
||||||
// New returns a [pkg.Artifact] based on a [Toolchain] via s.
|
// New returns a [pkg.Artifact] based on a [Toolchain] via s.
|
||||||
@@ -282,12 +279,12 @@ mkdir -vp /work/system/bin
|
|||||||
name += "-std"
|
name += "-std"
|
||||||
}
|
}
|
||||||
|
|
||||||
toybox := Toybox
|
toybox := _toybox
|
||||||
if flag&TEarly != 0 {
|
if flag&TEarly != 0 {
|
||||||
toybox = _toyboxEarly
|
toybox = _toyboxEarly
|
||||||
}
|
}
|
||||||
|
|
||||||
base := LLVM
|
base := _llvm
|
||||||
if flag&TNoToolchain != 0 {
|
if flag&TNoToolchain != 0 {
|
||||||
base = _musl
|
base = _musl
|
||||||
}
|
}
|
||||||
@@ -296,7 +293,7 @@ mkdir -vp /work/system/bin
|
|||||||
cureEtc{newIANAEtc()},
|
cureEtc{newIANAEtc()},
|
||||||
},
|
},
|
||||||
base,
|
base,
|
||||||
Mksh,
|
_mksh,
|
||||||
toybox,
|
toybox,
|
||||||
))
|
))
|
||||||
env = fixupEnviron(env, []string{
|
env = fixupEnviron(env, []string{
|
||||||
@@ -326,8 +323,32 @@ mkdir -vp /work/system/bin
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// patch is used by [Toolchain.NewPatchedSource].
|
// NewStage0 returns a [pkg.Artifact] curing to a stage0 distribution.
|
||||||
var patch = H("patch")
|
func (t Toolchain) NewStage0() pkg.Artifact {
|
||||||
|
return t.New("stage0", 0, t.Append(nil,
|
||||||
|
H("bzip2"),
|
||||||
|
), nil, nil, `
|
||||||
|
umask 377
|
||||||
|
tar \
|
||||||
|
-vjc \
|
||||||
|
-C /stage0 \
|
||||||
|
-f /work/stage0-`+t.triple()+`.tar.bz2 \
|
||||||
|
.
|
||||||
|
`, pkg.Path(fhs.AbsRoot.Append("stage0"), false, t.Append(nil,
|
||||||
|
_llvm,
|
||||||
|
_mksh,
|
||||||
|
_toyboxEarly,
|
||||||
|
)...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasStageEarly returns whether a stage0 distribution is available.
|
||||||
|
func (s *S) HasStageEarly() (ok bool) {
|
||||||
|
func() {
|
||||||
|
defer func() { ok = recover() == nil }()
|
||||||
|
s.New(stageEarly).MustLoad(_stage0Dist)
|
||||||
|
}()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// NewPatchedSource returns [pkg.Artifact] of source with patches applied. If
|
// NewPatchedSource returns [pkg.Artifact] of source with patches applied. If
|
||||||
// passthrough is true, source is returned as is for zero length patches.
|
// passthrough is true, source is returned as is for zero length patches.
|
||||||
@@ -365,7 +386,7 @@ cat /usr/src/` + name + `-patches/* | \
|
|||||||
aname += "-patched"
|
aname += "-patched"
|
||||||
}
|
}
|
||||||
return t.New(aname, 0, t.Append(nil,
|
return t.New(aname, 0, t.Append(nil,
|
||||||
patch,
|
_patch,
|
||||||
), nil, nil, script, paths...)
|
), nil, nil, script, paths...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ func TestCureAll(t *testing.T) {
|
|||||||
cache := getCache(t)
|
cache := getCache(t)
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for _, p := range rosa.Native().Collect() {
|
for _, p := range rosa.Native().CollectAll() {
|
||||||
_, a := rosa.Native().Std().MustLoad(p)
|
_, a := rosa.Native().Std().MustLoad(p)
|
||||||
t.Run(p.String(), func(t *testing.T) {
|
t.Run(p.String(), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@@ -94,8 +94,9 @@ func TestCureAll(t *testing.T) {
|
|||||||
func BenchmarkStage3(b *testing.B) {
|
func BenchmarkStage3(b *testing.B) {
|
||||||
t := rosa.Native().Clone().Std()
|
t := rosa.Native().Clone().Std()
|
||||||
|
|
||||||
|
llvm := rosa.H("llvm")
|
||||||
for b.Loop() {
|
for b.Loop() {
|
||||||
t.MustLoad(rosa.LLVM)
|
t.MustLoad(llvm)
|
||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
t.DropCaches("", 0)
|
t.DropCaches("", 0)
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
package rosa
|
|
||||||
|
|
||||||
import (
|
|
||||||
"hakurei.app/fhs"
|
|
||||||
"hakurei.app/internal/pkg"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Stage0 is the handle of the stage0 distribution tarball built on the
|
|
||||||
// toolchain of stage [Std].
|
|
||||||
var Stage0 = H("rosa-stage0")
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
meta := Metadata{
|
|
||||||
Name: "rosa-stage0",
|
|
||||||
Description: "Rosa OS stage0 toolchain tarball for bootstrap",
|
|
||||||
Version: Unversioned,
|
|
||||||
}
|
|
||||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
|
||||||
return &meta, t.New("rosa-stage0", 0, t.Append(nil,
|
|
||||||
H("bzip2"),
|
|
||||||
), nil, nil, `
|
|
||||||
umask 377
|
|
||||||
tar \
|
|
||||||
-vjc \
|
|
||||||
-C /stage0 \
|
|
||||||
-f /work/stage0-`+t.triple()+`.tar.bz2 \
|
|
||||||
.
|
|
||||||
`, pkg.Path(fhs.AbsRoot.Append("stage0"), false, t.Append(nil,
|
|
||||||
LLVM,
|
|
||||||
Mksh,
|
|
||||||
_toyboxEarly,
|
|
||||||
)...))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// HasStage0 returns whether a stage0 distribution is available.
|
|
||||||
func (s *S) HasStage0() (ok bool) {
|
|
||||||
func() {
|
|
||||||
defer func() { ok = recover() == nil }()
|
|
||||||
s.New(stageEarly).MustLoad(_stage0Dist)
|
|
||||||
}()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user