From 3fc8fd2cb9acdc5fde50aead324856e13af2d6fe Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 7 Nov 2022 17:49:54 +0100 Subject: [PATCH] manifest: support all tar options in tar pipeline Make the tar pipeline take any implementation of the Pipeline interface as an input argument. Add support for all the tar stage options. --- internal/manifest/tar.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/internal/manifest/tar.go b/internal/manifest/tar.go index b1fd8006d..0ac953bea 100644 --- a/internal/manifest/tar.go +++ b/internal/manifest/tar.go @@ -10,7 +10,13 @@ type Tar struct { Base Filename string - inputPipeline *Base + Format osbuild.TarArchiveFormat + RootNode osbuild.TarRootNode + ACLs *bool + SELinux *bool + Xattrs *bool + + inputPipeline Pipeline } // NewTar creates a new TarPipeline. The inputPipeline represents the @@ -18,16 +24,13 @@ type Tar struct { // is the name of the pipeline. The filename is the name of the output tar file. func NewTar(m *Manifest, buildPipeline *Build, - inputPipeline *Base, + inputPipeline Pipeline, pipelinename string) *Tar { p := &Tar{ Base: NewBase(m, pipelinename, buildPipeline), inputPipeline: inputPipeline, Filename: "image.tar", } - if inputPipeline.manifest != m { - panic("tree pipeline from different manifest") - } buildPipeline.addDependent(p) m.addPipeline(p) return p @@ -36,7 +39,15 @@ func NewTar(m *Manifest, func (p *Tar) serialize() osbuild.Pipeline { pipeline := p.Base.serialize() - tarStage := osbuild.NewTarStage(&osbuild.TarStageOptions{Filename: p.Filename}, p.inputPipeline.Name()) + 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