aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-12-04 03:00:02 +0900
committerOphestra <cat@gensokyo.uk>2026-12-04 03:00:02 +0900
commit8670580efe1a10db6522d9e961f0600b918c0543 (patch)
tree94e69f02ff5794437d4be5e6bfff98ff82ce5ddc /internal
parentb58c775f9006459c751dc93d880aeff41dbff25d (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'internal')
-rw-r--r--internal/rosa/state.go25
1 files changed, 22 insertions, 3 deletions
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)),