Skip to content

Commit

Permalink
Add support for zstd RPM files (chainguard-dev#732)
Browse files Browse the repository at this point in the history
Signed-off-by: egibs <[email protected]>
  • Loading branch information
egibs authored Dec 19, 2024
1 parent 6e326a4 commit fcd1105
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/archive/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit fcd1105

Please sign in to comment.