internal/rosa: remove xz utils hack

This replaces all xz invocations with the native decompressor. This also significantly cleans up the Gentoo stage3 bootstrap path.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
cat
2026-07-25 14:14:34 +09:00
parent 35147f6dfb
commit 0d3efeb456
6 changed files with 131 additions and 176 deletions
+13 -43
View File
@@ -26,8 +26,8 @@ const (
// kindEtc is the kind of [pkg.Artifact] of cureEtc.
kindEtc = iota + pkg.KindCustomOffset
// kindBusyboxBin is the kind of [pkg.Artifact] of busyboxBin.
kindBusyboxBin
// kindGentooOverlay is the kind of [pkg.Artifact] of gentooOverlay.
kindGentooOverlay
)
// mustDecode is like [pkg.MustDecode], but replaces the zero value and prints
@@ -97,15 +97,9 @@ func (s *S) earlyLDFLAGS(static bool) string {
}
const (
// _stageBusybox denotes a busybox installation from the busyboxBin
// binary distribution. This is defined as a [Stage] to make use of the
// toolchain abstractions to preprocess stageGentoo and is not a real,
// functioning toolchain. It does not contain any compilers.
_stageBusybox Stage = iota
// stageGentoo denotes the toolchain in a Gentoo stage3 tarball. Special
// care must be taken to compile correctly against this stage.
stageGentoo
stageGentoo Stage = iota
// stageIntermediateGentoo is like stageIntermediate, but compiled against
// stageGentoo.
@@ -239,11 +233,6 @@ func (t Toolchain) New(
var support []pkg.Artifact
switch t.stage {
case _stageBusybox:
name += "-early"
support = slices.Concat([]pkg.Artifact{t.newBusyboxBin()}, extra)
env = fixupEnviron(env, nil, "/system/bin")
case stageGentoo, stageEarly:
name += "-boot"
support = append(support, extra...)
@@ -251,22 +240,17 @@ func (t Toolchain) New(
if t.stage == stageEarly {
_, a := t.MustLoad(_stage0Dist)
support = append(support, a)
} else if t.gentooStage3 == nil {
panic(os.ErrInvalid)
} else {
support = append(support, t.S.New(_stageBusybox).New("gentoo", 0, nil, nil, nil, `
tar -C /work -xf /usr/src/stage3.tar.xz
rm -rf /work/dev/ /work/proc/
ln -vs ../usr/bin /work/bin
mkdir -vp /work/system/bin
(cd /work/system/bin && ln -vs \
../../bin/sh \
../../usr/lib/llvm/*/bin/* \
.)
`, pkg.Path(AbsUsrSrc.Append("stage3.tar.xz"), false,
pkg.NewHTTPGet(
nil, t.gentooStage3,
t.gentooStage3Checksum,
),
)))
support = append(support,
t.gentooStage3,
gentooOverlay{t.gentooStage3},
)
env = append(env,
"CC=clang",
"CXX=clang++",
)
}
env = fixupEnviron(env, []string{
EnvTriple + "=" + t.triple(),
@@ -516,20 +500,6 @@ func (t Toolchain) NewPackage(
sourceSuffix string
)
if _, ok := source.(pkg.FileArtifact); ok {
if attr.Writable || attr.Chmod ||
wantsChmod || wantsWrite ||
len(attr.Patches) > 0 {
panic("source processing requested on a xz-compressed tarball")
}
sourceSuffix = ".tar.xz"
scriptEarly += `
tar -C /usr/src/ -xf '/usr/src/` + name + `.tar.xz'
mv '/usr/src/` + rn + `' '/usr/src/` + name + `'
`
}
dir, create := helper.wantsDir()
helperScriptEarly := helper.scriptEarly()
if attr.EnterSource ||