internal/rosa: consistent stage0 paths
All checks were successful
Test / Create distribution (push) Successful in 2m2s
Test / Hakurei (push) Successful in 6m35s
Test / ShareFS (push) Successful in 6m33s
Test / Sandbox (race detector) (push) Successful in 6m52s
Test / Hpkg (push) Successful in 7m20s
Test / Hakurei (race detector) (push) Successful in 7m46s
Test / Sandbox (push) Successful in 1m37s
Test / Flake checks (push) Successful in 1m50s

This makes using the gentoo stage3 as our stage0 compatible with Rosa OS stage0 tarballs.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-02-10 19:21:37 +09:00
parent f511f0a9e9
commit 3dbd67d113

View File

@@ -173,7 +173,7 @@ func fixupEnviron(env, extras []string, paths ...string) []string {
// absCureScript is the absolute pathname [Toolchain.New] places the fixed-up
// build script under.
var absCureScript = fhs.AbsUsrBin.Append(".cure-script")
var absCureScript = AbsSystem.Append("bin", ".cure-script")
const (
// TExclusive denotes an exclusive [pkg.Artifact].
@@ -187,7 +187,7 @@ func (t Toolchain) New(
name string,
flag int,
extra []pkg.Artifact,
checksum *pkg.Checksum,
knownChecksum *pkg.Checksum,
env []string,
script string,
@@ -195,17 +195,11 @@ func (t Toolchain) New(
) pkg.Artifact {
const lcMessages = "LC_MESSAGES=C.UTF-8"
var (
path = AbsSystem.Append("bin", "sh")
args = []string{"sh", absCureScript.String()}
support []pkg.Artifact
)
var support []pkg.Artifact
switch t {
case toolchainBusybox:
name += "-early"
support = slices.Concat([]pkg.Artifact{newBusyboxBin()}, extra)
path = AbsSystem.Append("bin", "busybox")
args[0] = "hush"
env = fixupEnviron(env, nil, "/system/bin")
case toolchainStage0:
@@ -220,14 +214,14 @@ func (t Toolchain) New(
default:
panic("unsupported target " + runtime.GOARCH)
}
path = fhs.AbsRoot.Append("bin", "bash")
args[0] = "bash"
support = slices.Concat([]pkg.Artifact{
cureEtc{},
toolchainBusybox.New("stage0", 0, nil, nil, nil, `
tar -C /work -xf /usr/src/stage0.tar.xz
rm -rf /work/dev/ /work/proc/
ln -vs ../usr/bin /work/bin
mkdir -vp /work/system/bin
ln -vs ../../bin/sh /work/system/bin
`, pkg.Path(AbsUsrSrc.Append("stage0.tar.xz"), false,
pkg.NewHTTPGet(
nil, "https://basement.gensokyo.uk/seed/"+seed,
@@ -279,9 +273,10 @@ ln -vs ../usr/bin /work/bin
}
return pkg.NewExec(
name, checksum, pkg.ExecTimeoutMax, flag&TExclusive != 0,
name, knownChecksum, pkg.ExecTimeoutMax, flag&TExclusive != 0,
fhs.AbsRoot, env,
path, args,
AbsSystem.Append("bin", "sh"),
[]string{"sh", absCureScript.String()},
slices.Concat([]pkg.ExecPath{pkg.Path(
fhs.AbsRoot, true,