debian-forge-composer/vendor/github.com/osbuild/images/pkg/manifest/zstd.go
Tomáš Hozza 06e232b55e go.mod: update osbuild/images to v0.120.0
This adds the RHEL 10.1 and 9.7 repositories

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-28 09:35:23 +01:00

55 lines
1.3 KiB
Go

package manifest
import (
"github.com/osbuild/images/pkg/artifact"
"github.com/osbuild/images/pkg/osbuild"
)
// The Zstd pipeline compresses a raw image file using zstd.
type Zstd struct {
Base
filename string
imgPipeline FilePipeline
}
func (p Zstd) Filename() string {
return p.filename
}
func (p *Zstd) SetFilename(filename string) {
p.filename = filename
}
// NewZstd creates a new Zstd pipeline. imgPipeline is the pipeline producing the
// raw image that will be zstd compressed.
func NewZstd(buildPipeline Build, imgPipeline FilePipeline) *Zstd {
p := &Zstd{
Base: NewBase("zstd", buildPipeline),
filename: "image.zst",
imgPipeline: imgPipeline,
}
buildPipeline.addDependent(p)
return p
}
func (p *Zstd) serialize() osbuild.Pipeline {
pipeline := p.Base.serialize()
pipeline.AddStage(osbuild.NewZstdStage(
osbuild.NewZstdStageOptions(p.Filename()),
osbuild.NewZstdStageInputs(osbuild.NewFilesInputPipelineObjectRef(p.imgPipeline.Name(), p.imgPipeline.Export().Filename(), nil)),
))
return pipeline
}
func (p *Zstd) getBuildPackages(Distro) []string {
return []string{"zstd"}
}
func (p *Zstd) Export() *artifact.Artifact {
p.Base.export = true
mimeType := "application/zstd"
return artifact.New(p.Name(), p.Filename(), &mimeType)
}