Move copyPipelineTreeInputs() from distros to osbuild2
Move the `copyPipelineTreeInputs()` function duplicated in many distro definitions to the `osbuild2` package as `NewCopyStagePipelineTreeInputs()`. This will prevent creating another copy of the code in rhel-84 for the `gce` image. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
0efbe0c55e
commit
c9b72033ee
9 changed files with 21 additions and 49 deletions
|
|
@ -979,12 +979,12 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o
|
||||||
}
|
}
|
||||||
|
|
||||||
inputName := "root-tree"
|
inputName := "root-tree"
|
||||||
copyInputs := copyPipelineTreeInputs(inputName, "efiboot-tree")
|
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
|
||||||
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
|
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
|
||||||
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
||||||
|
|
||||||
inputName = "coi"
|
inputName = "coi"
|
||||||
copyInputs = copyPipelineTreeInputs(inputName, "coi-tree")
|
copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "coi-tree")
|
||||||
p.AddStage(osbuild.NewCopyStageSimple(
|
p.AddStage(osbuild.NewCopyStageSimple(
|
||||||
&osbuild.CopyStageOptions{
|
&osbuild.CopyStageOptions{
|
||||||
Paths: []osbuild.CopyStagePath{
|
Paths: []osbuild.CopyStagePath{
|
||||||
|
|
@ -1002,7 +1002,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o
|
||||||
))
|
))
|
||||||
|
|
||||||
inputName = "efi-tree"
|
inputName = "efi-tree"
|
||||||
copyInputs = copyPipelineTreeInputs(inputName, "efiboot-tree")
|
copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
|
||||||
p.AddStage(osbuild.NewCopyStageSimple(
|
p.AddStage(osbuild.NewCopyStageSimple(
|
||||||
&osbuild.CopyStageOptions{
|
&osbuild.CopyStageOptions{
|
||||||
Paths: []osbuild.CopyStagePath{
|
Paths: []osbuild.CopyStagePath{
|
||||||
|
|
@ -1235,7 +1235,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk
|
||||||
|
|
||||||
inputName := "root-tree"
|
inputName := "root-tree"
|
||||||
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
|
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
|
||||||
copyInputs := copyPipelineTreeInputs(inputName, inputPipelineName)
|
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, inputPipelineName)
|
||||||
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
||||||
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))
|
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))
|
||||||
return p
|
return p
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,6 @@ func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs {
|
||||||
return &osbuild.XorrisofsStageInputs{Tree: input}
|
return &osbuild.XorrisofsStageInputs{Tree: input}
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyPipelineTreeInputs(name, inputPipeline string) *osbuild.CopyStageInputs {
|
|
||||||
inputName := name
|
|
||||||
treeInput := osbuild.CopyStageInput{}
|
|
||||||
treeInput.Type = "org.osbuild.tree"
|
|
||||||
treeInput.Origin = "org.osbuild.pipeline"
|
|
||||||
treeInput.References = []string{"name:" + inputPipeline}
|
|
||||||
return &osbuild.CopyStageInputs{inputName: treeInput}
|
|
||||||
}
|
|
||||||
|
|
||||||
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
|
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
|
||||||
stageKey := "name:" + stage
|
stageKey := "name:" + stage
|
||||||
ref := map[string]osbuild.QEMUFile{
|
ref := map[string]osbuild.QEMUFile{
|
||||||
|
|
|
||||||
|
|
@ -716,12 +716,12 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o
|
||||||
}
|
}
|
||||||
|
|
||||||
inputName := "root-tree"
|
inputName := "root-tree"
|
||||||
copyInputs := copyPipelineTreeInputs(inputName, "efiboot-tree")
|
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
|
||||||
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
|
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
|
||||||
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
||||||
|
|
||||||
inputName = "coi"
|
inputName = "coi"
|
||||||
copyInputs = copyPipelineTreeInputs(inputName, "coi-tree")
|
copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "coi-tree")
|
||||||
p.AddStage(osbuild.NewCopyStageSimple(
|
p.AddStage(osbuild.NewCopyStageSimple(
|
||||||
&osbuild.CopyStageOptions{
|
&osbuild.CopyStageOptions{
|
||||||
Paths: []osbuild.CopyStagePath{
|
Paths: []osbuild.CopyStagePath{
|
||||||
|
|
@ -739,7 +739,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o
|
||||||
))
|
))
|
||||||
|
|
||||||
inputName = "efi-tree"
|
inputName = "efi-tree"
|
||||||
copyInputs = copyPipelineTreeInputs(inputName, "efiboot-tree")
|
copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
|
||||||
p.AddStage(osbuild.NewCopyStageSimple(
|
p.AddStage(osbuild.NewCopyStageSimple(
|
||||||
&osbuild.CopyStageOptions{
|
&osbuild.CopyStageOptions{
|
||||||
Paths: []osbuild.CopyStagePath{
|
Paths: []osbuild.CopyStagePath{
|
||||||
|
|
@ -958,7 +958,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk
|
||||||
|
|
||||||
inputName := "root-tree"
|
inputName := "root-tree"
|
||||||
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
|
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
|
||||||
copyInputs := copyPipelineTreeInputs(inputName, inputPipelineName)
|
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, inputPipelineName)
|
||||||
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
||||||
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))
|
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))
|
||||||
return p
|
return p
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,6 @@ func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs {
|
||||||
return &osbuild.XorrisofsStageInputs{Tree: input}
|
return &osbuild.XorrisofsStageInputs{Tree: input}
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyPipelineTreeInputs(name, inputPipeline string) *osbuild.CopyStageInputs {
|
|
||||||
inputName := name
|
|
||||||
treeInput := osbuild.CopyStageInput{}
|
|
||||||
treeInput.Type = "org.osbuild.tree"
|
|
||||||
treeInput.Origin = "org.osbuild.pipeline"
|
|
||||||
treeInput.References = []string{"name:" + inputPipeline}
|
|
||||||
return &osbuild.CopyStageInputs{inputName: treeInput}
|
|
||||||
}
|
|
||||||
|
|
||||||
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
|
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
|
||||||
stageKey := "name:" + stage
|
stageKey := "name:" + stage
|
||||||
ref := map[string]osbuild.QEMUFile{
|
ref := map[string]osbuild.QEMUFile{
|
||||||
|
|
|
||||||
|
|
@ -713,12 +713,12 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string, rn
|
||||||
}
|
}
|
||||||
|
|
||||||
inputName := "root-tree"
|
inputName := "root-tree"
|
||||||
copyInputs := copyPipelineTreeInputs(inputName, "efiboot-tree")
|
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
|
||||||
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
|
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
|
||||||
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
||||||
|
|
||||||
inputName = "coi"
|
inputName = "coi"
|
||||||
copyInputs = copyPipelineTreeInputs(inputName, "coi-tree")
|
copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "coi-tree")
|
||||||
p.AddStage(osbuild.NewCopyStageSimple(
|
p.AddStage(osbuild.NewCopyStageSimple(
|
||||||
&osbuild.CopyStageOptions{
|
&osbuild.CopyStageOptions{
|
||||||
Paths: []osbuild.CopyStagePath{
|
Paths: []osbuild.CopyStagePath{
|
||||||
|
|
@ -736,7 +736,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string, rn
|
||||||
))
|
))
|
||||||
|
|
||||||
inputName = "efi-tree"
|
inputName = "efi-tree"
|
||||||
copyInputs = copyPipelineTreeInputs(inputName, "efiboot-tree")
|
copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
|
||||||
p.AddStage(osbuild.NewCopyStageSimple(
|
p.AddStage(osbuild.NewCopyStageSimple(
|
||||||
&osbuild.CopyStageOptions{
|
&osbuild.CopyStageOptions{
|
||||||
Paths: []osbuild.CopyStagePath{
|
Paths: []osbuild.CopyStagePath{
|
||||||
|
|
@ -955,7 +955,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk
|
||||||
|
|
||||||
inputName := "root-tree"
|
inputName := "root-tree"
|
||||||
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
|
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
|
||||||
copyInputs := copyPipelineTreeInputs(inputName, inputPipelineName)
|
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, inputPipelineName)
|
||||||
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
||||||
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))
|
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))
|
||||||
return p
|
return p
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,6 @@ func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs {
|
||||||
return &osbuild.XorrisofsStageInputs{Tree: input}
|
return &osbuild.XorrisofsStageInputs{Tree: input}
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyPipelineTreeInputs(name, inputPipeline string) *osbuild.CopyStageInputs {
|
|
||||||
inputName := name
|
|
||||||
treeInput := osbuild.CopyStageInput{}
|
|
||||||
treeInput.Type = "org.osbuild.tree"
|
|
||||||
treeInput.Origin = "org.osbuild.pipeline"
|
|
||||||
treeInput.References = []string{"name:" + inputPipeline}
|
|
||||||
return &osbuild.CopyStageInputs{inputName: treeInput}
|
|
||||||
}
|
|
||||||
|
|
||||||
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
|
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
|
||||||
stageKey := "name:" + stage
|
stageKey := "name:" + stage
|
||||||
ref := map[string]osbuild.QEMUFile{
|
ref := map[string]osbuild.QEMUFile{
|
||||||
|
|
|
||||||
|
|
@ -1045,7 +1045,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk
|
||||||
|
|
||||||
inputName := "root-tree"
|
inputName := "root-tree"
|
||||||
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
|
copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
|
||||||
copyInputs := copyPipelineTreeInputs(inputName, inputPipelineName)
|
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, inputPipelineName)
|
||||||
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
|
||||||
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))
|
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))
|
||||||
return p
|
return p
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,6 @@ func xorrisofsStageInputs() *osbuild.XorrisofsStageInputs {
|
||||||
return &osbuild.XorrisofsStageInputs{Tree: input}
|
return &osbuild.XorrisofsStageInputs{Tree: input}
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyPipelineTreeInputs(name, inputPipeline string) *osbuild.CopyStageInputs {
|
|
||||||
inputName := "root-tree"
|
|
||||||
treeInput := osbuild.CopyStageInput{}
|
|
||||||
treeInput.Type = "org.osbuild.tree"
|
|
||||||
treeInput.Origin = "org.osbuild.pipeline"
|
|
||||||
treeInput.References = []string{"name:" + inputPipeline}
|
|
||||||
return &osbuild.CopyStageInputs{inputName: treeInput}
|
|
||||||
}
|
|
||||||
|
|
||||||
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
|
func qemuStageInputs(stage, file string) *osbuild.QEMUStageInputs {
|
||||||
stageKey := "name:" + stage
|
stageKey := "name:" + stage
|
||||||
ref := map[string]osbuild.QEMUFile{
|
ref := map[string]osbuild.QEMUFile{
|
||||||
|
|
|
||||||
|
|
@ -58,3 +58,11 @@ func NewCopyStageSimple(options *CopyStageOptions, inputs CopyStageInputsNew) *S
|
||||||
Inputs: stageInputs,
|
Inputs: stageInputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewCopyStagePipelineTreeInputs(inputName, inputPipeline string) *CopyStageInputs {
|
||||||
|
treeInput := CopyStageInput{}
|
||||||
|
treeInput.Type = "org.osbuild.tree"
|
||||||
|
treeInput.Origin = "org.osbuild.pipeline"
|
||||||
|
treeInput.References = []string{"name:" + inputPipeline}
|
||||||
|
return &CopyStageInputs{inputName: treeInput}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue