From fcd1105b26ea14131d5aa3a476439a6bfc37c8ef Mon Sep 17 00:00:00 2001 From: Evan Gibler <20933572+egibs@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:14:00 -0600 Subject: [PATCH] Add support for zstd RPM files (#732) Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> --- pkg/archive/rpm.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/archive/rpm.go b/pkg/archive/rpm.go index 56a38ec8c..10d04c06a 100644 --- a/pkg/archive/rpm.go +++ b/pkg/archive/rpm.go @@ -13,6 +13,7 @@ import ( "github.com/cavaliergopher/cpio" "github.com/cavaliergopher/rpm" "github.com/chainguard-dev/clog" + "github.com/klauspost/compress/zstd" "github.com/ulikunitz/xz" ) @@ -60,6 +61,12 @@ func ExtractRPM(ctx context.Context, d, f string) error { return fmt.Errorf("failed to create xz reader: %w", err) } cr = cpio.NewReader(xzStream) + case "zstd": + zstdStream, err := zstd.NewReader(rpmFile) + if err != nil { + return fmt.Errorf("failed to create zstd reader: %w", err) + } + cr = cpio.NewReader(zstdStream) default: return fmt.Errorf("unsupported compression format: %s", compression) }