diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-06-04 18:37:07 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-06-04 18:54:43 +0900 |
| commit | db69dcf0be0c1be4e3187027fa4199538013e76d (patch) | |
| tree | 78513e0ec30c375af15270852d551f326c7f663f /internal/rosa | |
| parent | 76c1fb84c87ba12a22b64f7c471a92603365837f (diff) | |
internal/pkg: remove tar built-in decompressor
This is replaced by decompressArtifact and is no longer necessary.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa')
| -rw-r--r-- | internal/rosa/builtins.go | 15 | ||||
| -rw-r--r-- | internal/rosa/etc.go | 2 | ||||
| -rw-r--r-- | internal/rosa/go.go | 4 | ||||
| -rw-r--r-- | internal/rosa/llvm_test.go | 2 | ||||
| -rw-r--r-- | internal/rosa/state.go | 24 |
5 files changed, 30 insertions, 17 deletions
diff --git a/internal/rosa/builtins.go b/internal/rosa/builtins.go index b0ec65b1..55ac0cf1 100644 --- a/internal/rosa/builtins.go +++ b/internal/rosa/builtins.go @@ -21,8 +21,13 @@ const ( ) // newTar wraps [pkg.NewHTTPGetTar] with a simpler function signature. -func newTar(url, checksum string, compression uint32) pkg.Artifact { - return pkg.NewHTTPGetTar(nil, url, mustDecode(checksum), compression) +func newTar(url, checksum string, compress uint32) pkg.Artifact { + return pkg.NewTar( + pkg.NewDecompress( + pkg.NewHTTPGet(nil, url, mustDecode(checksum)), + compress, + ), + ) } // newFromCPAN is a helper for downloading release from CPAN. @@ -32,7 +37,7 @@ func newFromCPAN(author, name, version, checksum string) pkg.Artifact { author[:1]+"/"+author[:2]+"/"+author+"/"+ name+"-"+version+".tar.gz", checksum, - pkg.TarGzip, + pkg.Gzip, ) } @@ -43,7 +48,7 @@ func newFromGitLab(domain, suffix, ref, checksum string) pkg.Artifact { ref+"/"+path.Base(suffix)+"-"+ strings.ReplaceAll(ref, "/", "-")+".tar.bz2", checksum, - pkg.TarBzip2, + pkg.Bzip2, ) } @@ -53,7 +58,7 @@ func newFromGitHub(suffix, tag, checksum string) pkg.Artifact { "https://github.com/"+suffix+ "/archive/refs/tags/"+tag+".tar.gz", checksum, - pkg.TarGzip, + pkg.Gzip, ) } diff --git a/internal/rosa/etc.go b/internal/rosa/etc.go index 7b5542db..4ffebdba 100644 --- a/internal/rosa/etc.go +++ b/internal/rosa/etc.go @@ -140,7 +140,7 @@ func newIANAEtc() pkg.Artifact { version, "iana-etc-"+version+".tar.gz", checksum, - pkg.TarGzip, + pkg.Gzip, ) } diff --git a/internal/rosa/go.go b/internal/rosa/go.go index fbee360b..26b99929 100644 --- a/internal/rosa/go.go +++ b/internal/rosa/go.go @@ -16,7 +16,7 @@ func (t Toolchain) newGo( return t.NewPackage("go", version, newTar( "https://go.dev/dl/go"+version+".src.tar.gz", checksum, - pkg.TarGzip, + pkg.Gzip, ), &PackageAttr{ EnterSource: true, Env: slices.Concat([]string{ @@ -79,7 +79,7 @@ func init() { bootstrapEarly = []pkg.Artifact{t.NewPackage("go", "1.4-bootstrap", newTar( "https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz", "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23", - pkg.TarGzip, + pkg.Gzip, ), &PackageAttr{ EnterSource: true, Env: []string{ diff --git a/internal/rosa/llvm_test.go b/internal/rosa/llvm_test.go index de63cb6b..48adcf20 100644 --- a/internal/rosa/llvm_test.go +++ b/internal/rosa/llvm_test.go @@ -8,7 +8,7 @@ import ( ) func TestLLVMInputs(t *testing.T) { - const wantInputCount = 688 + const wantInputCount = 857 _, llvm := rosa.Native().Std().MustLoad(rosa.H("llvm")) var n int diff --git a/internal/rosa/state.go b/internal/rosa/state.go index d55610fe..feb06f82 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -433,10 +433,11 @@ func (s *S) getFrame() azalea.Frame { identDefault := k("default") identArch := unique.Make(azalea.Ident(s.arch)) + const compressOffset = 1 << 8 enumCompress := map[unique.Handle[azalea.Ident]]any{ - k("uncompressed"): uint32(pkg.TarUncompressed), - k("gzip"): uint32(pkg.TarGzip), - k("bzip2"): uint32(pkg.TarBzip2), + k("uncompressed"): 0, + k("gzip"): pkg.Gzip + compressOffset, + k("bzip2"): pkg.Bzip2 + compressOffset, } s.frame.Val = map[unique.Handle[azalea.Ident]]any{ @@ -609,15 +610,19 @@ func (s *S) getFrame() azalea.Frame { args azalea.FArgs, ) (v any, set bool, err error) { var url, checksum string - var compress uint32 + var _compress int if err = args.Apply(map[unique.Handle[azalea.Ident]]any{ k("url"): &url, k("checksum"): &checksum, - k("compress"): &compress, + k("compress"): &_compress, }); err != nil { return } - v = pkg.NewHTTPGetTar(nil, url, mustDecode(checksum), compress) + f := pkg.NewHTTPGet(nil, url, mustDecode(checksum)) + if _compress != 0 { + f = pkg.NewDecompress(f, uint32(_compress-compressOffset)) + } + v = pkg.NewTar(f) set = true return }, V: enumCompress}, @@ -744,7 +749,10 @@ func (s *S) getFrame() azalea.Frame { v = newFromGitHubRelease(suffix, tag, name, checksum, compress) set = true return - }, V: enumCompress}, + }, V: map[unique.Handle[azalea.Ident]]any{ + k("gzip"): uint32(pkg.Gzip), + k("bzip2"): uint32(pkg.Bzip2), + }}, // high-level helpers @@ -1275,7 +1283,7 @@ func (s *S) SetSource(fsys fs.FS) error { Description: "hakurei source tree (current)", Version: "1.0.0-CURRENT", Exclude: true, - }, pkg.NewTar(a, pkg.TarGzip) + }, pkg.NewTar(pkg.NewDecompress(a, pkg.Gzip)) }), ) s.DropCaches(s.Arch(), s.Flags()) |
