aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/state.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-07-25 14:14:34 +0900
committerOphestra <cat@gensokyo.uk>2026-07-25 14:14:34 +0900
commit0d3efeb456117b87f256e3bfaabd5abbace67ab4 (patch)
tree7405be7a58e634f2d6d1fa00b34b3e054e35666c /internal/rosa/state.go
parent35147f6dfb0b81d2fe21f69b3800162b0cd7060f (diff)
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>
Diffstat (limited to 'internal/rosa/state.go')
-rw-r--r--internal/rosa/state.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/rosa/state.go b/internal/rosa/state.go
index 36fe9451..516efd81 100644
--- a/internal/rosa/state.go
+++ b/internal/rosa/state.go
@@ -213,10 +213,8 @@ type S struct {
// Cached [pkg.Artifact].
c [_stageEnd]sync.Map
- // URL of a Gentoo stage3 tarball.
- gentooStage3 string
- // Expected checksum of gentooStage3.
- gentooStage3Checksum pkg.Checksum
+ // Unpacked Gentoo LLVM stage3.
+ gentooStage3 pkg.Artifact
}
// Clone returns a copy of s.
@@ -485,6 +483,7 @@ func (s *S) getFrame() azalea.Frame {
k("gzip"): pkg.Gzip + compressOffset,
k("bzip2"): pkg.Bzip2 + compressOffset,
k("zstd"): pkg.Zstd + compressOffset,
+ k("xz"): pkg.XZ + compressOffset,
}
s.frame.Val = map[unique.Handle[azalea.Ident]]any{
@@ -803,6 +802,7 @@ func (s *S) getFrame() azalea.Frame {
k("gzip"): uint32(pkg.Gzip),
k("bzip2"): uint32(pkg.Bzip2),
k("zstd"): uint32(pkg.Zstd),
+ k("xz"): uint32(pkg.XZ),
}},
// high-level helpers
@@ -1372,12 +1372,15 @@ func (s *S) SetSource(fsys fs.FS) error {
// SetGentooStage3 sets the Gentoo stage3 tarball url and checksum. It panics
// if given zero values or if these values have already been set.
func (s *S) SetGentooStage3(url string, checksum pkg.Checksum) {
- if s.gentooStage3 != "" {
+ if s.gentooStage3 != nil {
panic(errors.New("attempting to set Gentoo stage3 url twice"))
}
if url == "" {
panic(errors.New("attempting to set Gentoo stage3 url to the zero value"))
}
- s.gentooStage3, s.gentooStage3Checksum = url, checksum
+ s.gentooStage3 = pkg.NewTar(pkg.NewDecompress(
+ pkg.NewHTTPGet(nil, url, checksum),
+ pkg.XZ,
+ ))
s.DropCaches(s.Arch(), s.Flags())
}