internal/rosa: assume file source is xz-compressed
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m51s
Test / Hakurei (push) Successful in 3m54s
Test / ShareFS (push) Successful in 3m55s
Test / Sandbox (race detector) (push) Successful in 5m15s
Test / Hakurei (race detector) (push) Successful in 6m20s
Test / Flake checks (push) Successful in 1m22s
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m51s
Test / Hakurei (push) Successful in 3m54s
Test / ShareFS (push) Successful in 3m55s
Test / Sandbox (race detector) (push) Successful in 5m15s
Test / Hakurei (race detector) (push) Successful in 6m20s
Test / Flake checks (push) Successful in 1m22s
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>
This commit is contained in:
@@ -43,8 +43,7 @@ var _ fmt.Stringer = new(tarArtifactNamed)
|
||||
func (a *tarArtifactNamed) String() string { return a.name + "-unpack" }
|
||||
|
||||
// NewTar returns a new [Artifact] backed by the supplied [Artifact] and
|
||||
// compression method. The source [Artifact] must be compatible with
|
||||
// [TContext.Open].
|
||||
// compression method. The source [Artifact] must be a [FileArtifact].
|
||||
func NewTar(a Artifact, compression uint32) Artifact {
|
||||
ta := tarArtifact{a, compression}
|
||||
if s, ok := a.(fmt.Stringer); ok {
|
||||
|
||||
@@ -639,7 +639,6 @@ func (t Toolchain) newFindutils() (pkg.Artifact, string) {
|
||||
nil, "https://ftpmirror.gnu.org/gnu/findutils/findutils-"+version+".tar.xz",
|
||||
mustDecode(checksum),
|
||||
), &PackageAttr{
|
||||
SourceKind: SourceKindTarXZ,
|
||||
ScriptEarly: `
|
||||
echo '#!/bin/sh' > gnulib-tests/test-c32ispunct.sh
|
||||
echo 'int main(){return 0;}' > tests/xargs/test-sigusr.c
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -11,8 +11,6 @@ func (t Toolchain) newStrace() (pkg.Artifact, string) {
|
||||
nil, "https://strace.io/files/"+version+"/strace-"+version+".tar.xz",
|
||||
mustDecode(checksum),
|
||||
), &PackageAttr{
|
||||
SourceKind: SourceKindTarXZ,
|
||||
|
||||
// patch not possible with nonzero SourceKind
|
||||
ScriptEarly: `
|
||||
sed -i 's/off64_t/off_t/g' \
|
||||
|
||||
Reference in New Issue
Block a user