From 8670580efe1a10db6522d9e961f0600b918c0543 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 4 Dec 2026 03:00:02 +0900 Subject: internal/rosa: decompress zstd patches Some patches are unreasonably huge. This change supports zstd-compressed patches via the ".zst" file name suffix. Signed-off-by: Ophestra --- internal/rosa/state.go | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'internal') diff --git a/internal/rosa/state.go b/internal/rosa/state.go index 2666e646..01ddc53b 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -27,6 +27,7 @@ import ( "hakurei.app/check" "hakurei.app/container" "hakurei.app/internal/rosa/azalea" + "hakurei.app/internal/zstd" "hakurei.app/pkg" ) @@ -1305,10 +1306,28 @@ func (ctx *evalContext) pf( meta.ID = int(anitya) for _, pathname := range patches { var p []byte - p, err = fs.ReadFile(ctx.b, pathname) - if err != nil { - return + + if strings.HasSuffix(pathname, ".zst") { + var r fs.File + if r, err = ctx.b.Open(pathname); err != nil { + return + } + + if p, err = io.ReadAll(zstd.NewReader(r)); err != nil { + _ = r.Close() + return + } + + if err = r.Close(); err != nil { + return + } + } else { + p, err = fs.ReadFile(ctx.b, pathname) + if err != nil { + return + } } + attr.Patches = append(attr.Patches, KV{ filepath.Base(pathname), unsafe.String(unsafe.SliceData(p), len(p)), -- cgit v1.3.1