internal/pkg: support tarball compressed via bzip2
All checks were successful
Test / Create distribution (push) Successful in 46s
Test / Sandbox (push) Successful in 2m56s
Test / ShareFS (push) Successful in 4m41s
Test / Sandbox (race detector) (push) Successful in 5m14s
Test / Hakurei (push) Successful in 5m30s
Test / Hpkg (push) Successful in 5m25s
Test / Hakurei (race detector) (push) Successful in 7m30s
Test / Flake checks (push) Successful in 1m38s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-01-07 20:18:28 +09:00
parent 5eefebcb48
commit 7ea4e8b643

View File

@@ -3,6 +3,7 @@ package pkg
import (
"archive/tar"
"bytes"
"compress/bzip2"
"compress/gzip"
"context"
"encoding/binary"
@@ -21,6 +22,8 @@ const (
TarUncompressed = iota
// TarGzip denotes a tarball compressed via [gzip].
TarGzip
// TarBzip2 denotes a tarball compressed via [bzip2].
TarBzip2
)
// A tarArtifact is an [Artifact] unpacking a tarball backed by a [File].
@@ -100,6 +103,10 @@ func (a *tarArtifact) Cure(c *CureContext) (err error) {
}
break
case TarBzip2:
tr = io.NopCloser(bzip2.NewReader(tr))
break
default:
return os.ErrInvalid
}