aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/rosa.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-04-13 15:06:53 +0900
committerOphestra <cat@gensokyo.uk>2026-04-13 15:07:30 +0900
commitb587caf2e863902eb04a6540462db5852fd1a0b5 (patch)
tree68c5eb1ad06849b69dfba973a7cb83f53948d8d0 /internal/rosa/rosa.go
parentf1c2ca492879d96702155328e2d7b9f6e34ad9db (diff)
internal/rosa: assume file source is xz-compressed
XZ happens to be the only widely-used format that is awful to deal with, everything else is natively supported. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
-rw-r--r--internal/rosa/rosa.go28
1 files changed, 11 insertions, 17 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index 930a1896..556ed44b 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -443,11 +443,6 @@ type Helper interface {
script(name string) string
}
-const (
- // SourceKindTarXZ denotes a source tarball to be decompressed using [XZ].
- SourceKindTarXZ = 1 + iota
-)
-
// PackageAttr holds build-system-agnostic attributes.
type PackageAttr struct {
// Mount the source tree writable.
@@ -464,8 +459,6 @@ type PackageAttr struct {
// Passed to [Toolchain.NewPatchedSource].
Patches []KV
- // Kind of source artifact.
- SourceKind int
// Dependencies not provided by stage0.
NonStage0 []pkg.Artifact
@@ -537,11 +530,6 @@ func (t Toolchain) NewPackage(
panic("source must be non-nil")
}
wantsChmod, wantsWrite := helper.wantsChmod(), helper.wantsWrite()
- if attr.SourceKind > 0 &&
- (attr.Writable || attr.Chmod || wantsChmod || wantsWrite || len(attr.Patches) > 0) {
- panic("source processing requested on a non-unpacked kind")
- }
-
dc := len(attr.NonStage0)
if !t.isStage0() {
dc += 1<<3 + len(extra)
@@ -560,17 +548,23 @@ func (t Toolchain) NewPackage(
paPut(pv)
}
- var scriptEarly string
+ var (
+ scriptEarly string
+ 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")
+ }
- var sourceSuffix string
- switch attr.SourceKind {
- case SourceKindTarXZ:
sourceSuffix = ".tar.xz"
scriptEarly += `
tar -C /usr/src/ -xf '/usr/src/` + name + `.tar.xz'
mv '/usr/src/` + name + `-` + version + `' '/usr/src/` + name + `'
`
- break
}
dir := helper.wantsDir()