Move xorrisofsStageInputs() from distros to osbuild2

Move the `xorrisofsStageInputs()` function duplicated in all
distro definitions to the `osbuild2` package as
`NewXorrisofsStagePipelineTreeInputs()`.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2022-02-16 10:00:54 +01:00 committed by Ondřej Budai
parent c9b72033ee
commit 71ae94b40f
10 changed files with 13 additions and 45 deletions

View file

@ -482,7 +482,7 @@ func (t *imageTypeS2) bootISOPipeline() *osbuild.Pipeline {
p.Name = "assembler"
p.Build = "name:build"
p.AddStage(osbuild.NewXorrisofsStage(t.xorrisofsStageOptions(), t.xorrisofsStageInputs()))
p.AddStage(osbuild.NewXorrisofsStage(t.xorrisofsStageOptions(), osbuild.NewXorrisofsStagePipelineTreeInputs("bootiso-tree")))
p.AddStage(osbuild.NewImplantisomd5Stage(&osbuild.Implantisomd5StageOptions{Filename: t.Filename()}))
return p
@ -805,11 +805,3 @@ func (t *imageTypeS2) xorrisofsStageOptions() *osbuild.XorrisofsStageOptions {
IsohybridMBR: "/usr/share/syslinux/isohdpfx.bin",
}
}
func (t *imageTypeS2) xorrisofsStageInputs() *osbuild.XorrisofsStageInputs {
input := new(osbuild.XorrisofsStageInput)
input.Type = "org.osbuild.tree"
input.Origin = "org.osbuild.pipeline"
input.References = osbuild.XorrisofsStageReferences{"name:bootiso-tree"}
return &osbuild.XorrisofsStageInputs{Tree: input}
}

View file

@ -1213,7 +1213,7 @@ func bootISOPipeline(filename string, arch string, isolinux bool) *osbuild.Pipel
p.Name = "bootiso"
p.Build = "name:build"
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, arch, isolinux), xorrisofsStageInputs("bootiso-tree")))
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, arch, isolinux), osbuild.NewXorrisofsStagePipelineTreeInputs("bootiso-tree")))
p.AddStage(osbuild.NewImplantisomd5Stage(&osbuild.Implantisomd5StageOptions{Filename: filename}))
return p

View file

@ -42,14 +42,6 @@ func ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePull
return &osbuild.OSTreePullStageInputs{Commits: pullStageInput}
}
func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs {
input := new(osbuild.XorrisofsStageInput)
input.Type = "org.osbuild.tree"
input.Origin = "org.osbuild.pipeline"
input.References = osbuild.XorrisofsStageReferences{"name:" + pipeline}
return &osbuild.XorrisofsStageInputs{Tree: input}
}
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
stageKey := "name:" + stage
ref := map[string]osbuild.QEMUFile{

View file

@ -936,7 +936,7 @@ func bootISOPipeline(filename, isolabel, arch string, isolinux bool) *osbuild.Pi
p.Name = "bootiso"
p.Build = "name:build"
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, isolabel, arch, isolinux), xorrisofsStageInputs("bootiso-tree")))
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, isolabel, arch, isolinux), osbuild.NewXorrisofsStagePipelineTreeInputs("bootiso-tree")))
p.AddStage(osbuild.NewImplantisomd5Stage(&osbuild.Implantisomd5StageOptions{Filename: filename}))
return p

View file

@ -42,14 +42,6 @@ func ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePull
return &osbuild.OSTreePullStageInputs{Commits: pullStageInput}
}
func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs {
input := new(osbuild.XorrisofsStageInput)
input.Type = "org.osbuild.tree"
input.Origin = "org.osbuild.pipeline"
input.References = osbuild.XorrisofsStageReferences{"name:" + pipeline}
return &osbuild.XorrisofsStageInputs{Tree: input}
}
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
stageKey := "name:" + stage
ref := map[string]osbuild.QEMUFile{

View file

@ -933,7 +933,7 @@ func bootISOPipeline(filename, isolabel, arch string, isolinux bool) *osbuild.Pi
p.Name = "bootiso"
p.Build = "name:build"
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, isolabel, arch, isolinux), xorrisofsStageInputs("bootiso-tree")))
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, isolabel, arch, isolinux), osbuild.NewXorrisofsStagePipelineTreeInputs("bootiso-tree")))
p.AddStage(osbuild.NewImplantisomd5Stage(&osbuild.Implantisomd5StageOptions{Filename: filename}))
return p

View file

@ -42,14 +42,6 @@ func ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePull
return &osbuild.OSTreePullStageInputs{Commits: pullStageInput}
}
func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs {
input := new(osbuild.XorrisofsStageInput)
input.Type = "org.osbuild.tree"
input.Origin = "org.osbuild.pipeline"
input.References = osbuild.XorrisofsStageReferences{"name:" + pipeline}
return &osbuild.XorrisofsStageInputs{Tree: input}
}
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
stageKey := "name:" + stage
ref := map[string]osbuild.QEMUFile{

View file

@ -1023,7 +1023,7 @@ func bootISOPipeline(filename string, arch string) *osbuild.Pipeline {
p.Name = "bootiso"
p.Build = "name:build"
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, arch), xorrisofsStageInputs()))
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, arch), osbuild.NewXorrisofsStagePipelineTreeInputs("bootiso-tree")))
p.AddStage(osbuild.NewImplantisomd5Stage(&osbuild.Implantisomd5StageOptions{Filename: filename}))
return p

View file

@ -42,14 +42,6 @@ func ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePull
return &osbuild.OSTreePullStageInputs{Commits: pullStageInput}
}
func xorrisofsStageInputs() *osbuild.XorrisofsStageInputs {
input := new(osbuild.XorrisofsStageInput)
input.Type = "org.osbuild.tree"
input.Origin = "org.osbuild.pipeline"
input.References = osbuild.XorrisofsStageReferences{"name:bootiso-tree"}
return &osbuild.XorrisofsStageInputs{Tree: input}
}
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
stageKey := "name:" + stage
ref := map[string]osbuild.QEMUFile{

View file

@ -55,3 +55,11 @@ func NewXorrisofsStage(options *XorrisofsStageOptions, inputs *XorrisofsStageInp
Inputs: inputs,
}
}
func NewXorrisofsStagePipelineTreeInputs(pipeline string) *XorrisofsStageInputs {
input := new(XorrisofsStageInput)
input.Type = "org.osbuild.tree"
input.Origin = "org.osbuild.pipeline"
input.References = XorrisofsStageReferences{"name:" + pipeline}
return &XorrisofsStageInputs{Tree: input}
}