debian-forge-composer/vendor/github.com/osbuild/images/pkg/manifest/tar.go
Achilleas Koutsou d4332f85d3 deps: update osbuild/images to v0.3.0
Bump the required osbuild version to v93 (due to the systemd units
change).

Pin the new osbuild version in Schutzfile.

Update repo snapshots in Schutzfile due to osbuild v93 depending on
new selinux-policy build.
2023-08-24 20:30:24 +02:00

69 lines
1.6 KiB
Go

package manifest
import (
"github.com/osbuild/images/pkg/artifact"
"github.com/osbuild/images/pkg/osbuild"
)
// A Tar represents the contents of another pipeline in a tar file
type Tar struct {
Base
filename string
Format osbuild.TarArchiveFormat
RootNode osbuild.TarRootNode
ACLs *bool
SELinux *bool
Xattrs *bool
inputPipeline Pipeline
}
func (p Tar) Filename() string {
return p.filename
}
func (p *Tar) SetFilename(filename string) {
p.filename = filename
}
// NewTar creates a new TarPipeline. The inputPipeline represents the
// filesystem tree which will be the contents of the tar file. The pipelinename
// is the name of the pipeline. The filename is the name of the output tar file.
func NewTar(buildPipeline *Build, inputPipeline Pipeline, pipelinename string) *Tar {
p := &Tar{
Base: NewBase(inputPipeline.Manifest(), pipelinename, buildPipeline),
inputPipeline: inputPipeline,
filename: "image.tar",
}
buildPipeline.addDependent(p)
inputPipeline.Manifest().addPipeline(p)
return p
}
func (p *Tar) serialize() osbuild.Pipeline {
pipeline := p.Base.serialize()
tarOptions := &osbuild.TarStageOptions{
Filename: p.Filename(),
Format: p.Format,
ACLs: p.ACLs,
SELinux: p.SELinux,
Xattrs: p.Xattrs,
RootNode: p.RootNode,
}
tarStage := osbuild.NewTarStage(tarOptions, p.inputPipeline.Name())
pipeline.AddStage(tarStage)
return pipeline
}
func (p *Tar) getBuildPackages(Distro) []string {
return []string{"tar"}
}
func (p *Tar) Export() *artifact.Artifact {
p.Base.export = true
mimeType := "application/x-tar"
return artifact.New(p.Name(), p.Filename(), &mimeType)
}