Move bootISOMonoStageInputs() from distros to osbuild2

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

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2022-02-16 12:19:52 +01:00 committed by Ondřej Budai
parent 069423ea67
commit d946199441
10 changed files with 15 additions and 55 deletions

View file

@ -471,7 +471,7 @@ func (t *imageTypeS2) bootISOTreePipeline(kernelVer string) *osbuild.Pipeline {
p.Name = "bootiso-tree"
p.Build = "name:build"
p.AddStage(osbuild.NewBootISOMonoStage(t.bootISOMonoStageOptions(kernelVer), t.bootISOMonoStageInputs()))
p.AddStage(osbuild.NewBootISOMonoStage(t.bootISOMonoStageOptions(kernelVer), osbuild.NewBootISOMonoStagePipelineTreeInputs("anaconda-tree")))
p.AddStage(osbuild.NewDiscinfoStage(t.discinfoStageOptions()))
return p
@ -759,16 +759,6 @@ func (t *imageTypeS2) bootISOMonoStageOptions(kernelVer string) *osbuild.BootISO
}
}
func (t *imageTypeS2) bootISOMonoStageInputs() *osbuild.BootISOMonoStageInputs {
rootfsInput := new(osbuild.BootISOMonoStageInput)
rootfsInput.Type = "org.osbuild.tree"
rootfsInput.Origin = "org.osbuild.pipeline"
rootfsInput.References = osbuild.BootISOMonoStageReferences{"name:anaconda-tree"}
return &osbuild.BootISOMonoStageInputs{
RootFS: rootfsInput,
}
}
func (t *imageTypeS2) discinfoStageOptions() *osbuild.DiscinfoStageOptions {
return &osbuild.DiscinfoStageOptions{
BaseArch: t.Arch().Name(),

View file

@ -1198,7 +1198,7 @@ func bootISOTreePipeline(kernelVer string, arch string, ksOptions *osbuild.Kicks
p.Name = "bootiso-tree"
p.Build = "name:build"
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch), bootISOMonoStageInputs()))
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch), osbuild.NewBootISOMonoStagePipelineTreeInputs("anaconda-tree")))
p.AddStage(osbuild.NewKickstartStage(ksOptions))
p.AddStage(osbuild.NewDiscinfoStage(discinfoStageOptions(arch)))

View file

@ -4,16 +4,6 @@ import (
osbuild "github.com/osbuild/osbuild-composer/internal/osbuild2"
)
func bootISOMonoStageInputs() *osbuild.BootISOMonoStageInputs {
rootfsInput := new(osbuild.BootISOMonoStageInput)
rootfsInput.Type = "org.osbuild.tree"
rootfsInput.Origin = "org.osbuild.pipeline"
rootfsInput.References = osbuild.BootISOMonoStageReferences{"name:anaconda-tree"}
return &osbuild.BootISOMonoStageInputs{
RootFS: rootfsInput,
}
}
func ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePullStageInputs {
pullStageInput := new(osbuild.OSTreePullStageInput)
pullStageInput.Type = "org.osbuild.ostree"

View file

@ -921,7 +921,7 @@ func bootISOTreePipeline(kernelVer, arch, vendor, product, osVersion, isolabel s
p.Name = "bootiso-tree"
p.Build = "name:build"
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch, vendor, product, osVersion, isolabel), bootISOMonoStageInputs()))
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch, vendor, product, osVersion, isolabel), osbuild.NewBootISOMonoStagePipelineTreeInputs("anaconda-tree")))
p.AddStage(osbuild.NewKickstartStage(ksOptions))
p.AddStage(osbuild.NewDiscinfoStage(discinfoStageOptions(arch)))

View file

@ -4,16 +4,6 @@ import (
osbuild "github.com/osbuild/osbuild-composer/internal/osbuild2"
)
func bootISOMonoStageInputs() *osbuild.BootISOMonoStageInputs {
rootfsInput := new(osbuild.BootISOMonoStageInput)
rootfsInput.Type = "org.osbuild.tree"
rootfsInput.Origin = "org.osbuild.pipeline"
rootfsInput.References = osbuild.BootISOMonoStageReferences{"name:anaconda-tree"}
return &osbuild.BootISOMonoStageInputs{
RootFS: rootfsInput,
}
}
func ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePullStageInputs {
pullStageInput := new(osbuild.OSTreePullStageInput)
pullStageInput.Type = "org.osbuild.ostree"

View file

@ -918,7 +918,7 @@ func bootISOTreePipeline(kernelVer, arch, vendor, product, osVersion, isolabel s
p.Name = "bootiso-tree"
p.Build = "name:build"
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch, vendor, product, osVersion, isolabel), bootISOMonoStageInputs()))
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch, vendor, product, osVersion, isolabel), osbuild.NewBootISOMonoStagePipelineTreeInputs("anaconda-tree")))
p.AddStage(osbuild.NewKickstartStage(ksOptions))
p.AddStage(osbuild.NewDiscinfoStage(discinfoStageOptions(arch)))

View file

@ -4,16 +4,6 @@ import (
osbuild "github.com/osbuild/osbuild-composer/internal/osbuild2"
)
func bootISOMonoStageInputs() *osbuild.BootISOMonoStageInputs {
rootfsInput := new(osbuild.BootISOMonoStageInput)
rootfsInput.Type = "org.osbuild.tree"
rootfsInput.Origin = "org.osbuild.pipeline"
rootfsInput.References = osbuild.BootISOMonoStageReferences{"name:anaconda-tree"}
return &osbuild.BootISOMonoStageInputs{
RootFS: rootfsInput,
}
}
func ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePullStageInputs {
pullStageInput := new(osbuild.OSTreePullStageInput)
pullStageInput.Type = "org.osbuild.ostree"

View file

@ -1012,7 +1012,7 @@ func bootISOTreePipeline(kernelVer string, arch string, ksOptions *osbuild.Kicks
p.Name = "bootiso-tree"
p.Build = "name:build"
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch), bootISOMonoStageInputs()))
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch), osbuild.NewBootISOMonoStagePipelineTreeInputs("anaconda-tree")))
p.AddStage(osbuild.NewKickstartStage(ksOptions))
p.AddStage(osbuild.NewDiscinfoStage(discinfoStageOptions(arch)))

View file

@ -4,16 +4,6 @@ import (
osbuild "github.com/osbuild/osbuild-composer/internal/osbuild2"
)
func bootISOMonoStageInputs() *osbuild.BootISOMonoStageInputs {
rootfsInput := new(osbuild.BootISOMonoStageInput)
rootfsInput.Type = "org.osbuild.tree"
rootfsInput.Origin = "org.osbuild.pipeline"
rootfsInput.References = osbuild.BootISOMonoStageReferences{"name:anaconda-tree"}
return &osbuild.BootISOMonoStageInputs{
RootFS: rootfsInput,
}
}
func ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePullStageInputs {
pullStageInput := new(osbuild.OSTreePullStageInput)
pullStageInput.Type = "org.osbuild.ostree"

View file

@ -87,3 +87,13 @@ func NewBootISOMonoStage(options *BootISOMonoStageOptions, inputs *BootISOMonoSt
Inputs: inputs,
}
}
func NewBootISOMonoStagePipelineTreeInputs(pipeline string) *BootISOMonoStageInputs {
rootfsInput := new(BootISOMonoStageInput)
rootfsInput.Type = "org.osbuild.tree"
rootfsInput.Origin = "org.osbuild.pipeline"
rootfsInput.References = BootISOMonoStageReferences{"name:" + pipeline}
return &BootISOMonoStageInputs{
RootFS: rootfsInput,
}
}