internal/pkg: tar optional file

This allows tar to take a single-file directory Artifact as input.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-01-07 22:15:55 +09:00
parent e8dda70c41
commit c86ff02d8d
5 changed files with 187 additions and 55 deletions

View File

@@ -300,26 +300,6 @@ func newTesttool() (
).String(), testtoolBin, 0500)
},
}}
testtoolDestroy = func(t *testing.T, base *check.Absolute, c *pkg.Cache) {
if pathname, checksum, err := c.Cure(testtool); err != nil {
t.Fatalf("Cure: error = %v", err)
} else if err = os.Remove(pathname.String()); err != nil {
t.Fatal(err)
} else {
p := base.Append(
"checksum",
pkg.Encode(checksum),
)
if err = os.Chmod(p.Append("bin").String(), 0700); err != nil {
t.Fatal(err)
}
if err = os.Chmod(p.String(), 0700); err != nil {
t.Fatal(err)
}
if err = os.RemoveAll(p.String()); err != nil {
t.Fatal(err)
}
}
}
testtoolDestroy = newDestroyArtifactFunc(testtool)
return
}