diff --git a/internal/distro/rhel85/pipelines.go b/internal/distro/rhel85/pipelines.go index 6a71b387f..a273e71a2 100644 --- a/internal/distro/rhel85/pipelines.go +++ b/internal/distro/rhel85/pipelines.go @@ -979,12 +979,12 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o } inputName := "root-tree" - copyInputs := copyPipelineTreeInputs(inputName, "efiboot-tree") + copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree") copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback) p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts)) inputName = "coi" - copyInputs = copyPipelineTreeInputs(inputName, "coi-tree") + copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "coi-tree") p.AddStage(osbuild.NewCopyStageSimple( &osbuild.CopyStageOptions{ Paths: []osbuild.CopyStagePath{ @@ -1002,7 +1002,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o )) inputName = "efi-tree" - copyInputs = copyPipelineTreeInputs(inputName, "efiboot-tree") + copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree") p.AddStage(osbuild.NewCopyStageSimple( &osbuild.CopyStageOptions{ Paths: []osbuild.CopyStagePath{ @@ -1235,7 +1235,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk inputName := "root-tree" 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(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback)) return p diff --git a/internal/distro/rhel85/stage_inputs.go b/internal/distro/rhel85/stage_inputs.go index 80bc2690a..10f2c47e9 100644 --- a/internal/distro/rhel85/stage_inputs.go +++ b/internal/distro/rhel85/stage_inputs.go @@ -50,15 +50,6 @@ func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs { 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 { stageKey := "name:" + stage ref := map[string]osbuild.QEMUFile{ diff --git a/internal/distro/rhel86/pipelines.go b/internal/distro/rhel86/pipelines.go index 76137567e..18da3ce5f 100644 --- a/internal/distro/rhel86/pipelines.go +++ b/internal/distro/rhel86/pipelines.go @@ -716,12 +716,12 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o } inputName := "root-tree" - copyInputs := copyPipelineTreeInputs(inputName, "efiboot-tree") + copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree") copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback) p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts)) inputName = "coi" - copyInputs = copyPipelineTreeInputs(inputName, "coi-tree") + copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "coi-tree") p.AddStage(osbuild.NewCopyStageSimple( &osbuild.CopyStageOptions{ Paths: []osbuild.CopyStagePath{ @@ -739,7 +739,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o )) inputName = "efi-tree" - copyInputs = copyPipelineTreeInputs(inputName, "efiboot-tree") + copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree") p.AddStage(osbuild.NewCopyStageSimple( &osbuild.CopyStageOptions{ Paths: []osbuild.CopyStagePath{ @@ -958,7 +958,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk inputName := "root-tree" 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(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback)) return p diff --git a/internal/distro/rhel86/stage_inputs.go b/internal/distro/rhel86/stage_inputs.go index 206c6bc7e..5aaac0139 100644 --- a/internal/distro/rhel86/stage_inputs.go +++ b/internal/distro/rhel86/stage_inputs.go @@ -50,15 +50,6 @@ func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs { 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 { stageKey := "name:" + stage ref := map[string]osbuild.QEMUFile{ diff --git a/internal/distro/rhel90/pipelines.go b/internal/distro/rhel90/pipelines.go index c3f2e29f5..9ecb46143 100644 --- a/internal/distro/rhel90/pipelines.go +++ b/internal/distro/rhel90/pipelines.go @@ -713,12 +713,12 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string, rn } inputName := "root-tree" - copyInputs := copyPipelineTreeInputs(inputName, "efiboot-tree") + copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree") copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback) p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts)) inputName = "coi" - copyInputs = copyPipelineTreeInputs(inputName, "coi-tree") + copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "coi-tree") p.AddStage(osbuild.NewCopyStageSimple( &osbuild.CopyStageOptions{ Paths: []osbuild.CopyStagePath{ @@ -736,7 +736,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string, rn )) inputName = "efi-tree" - copyInputs = copyPipelineTreeInputs(inputName, "efiboot-tree") + copyInputs = osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree") p.AddStage(osbuild.NewCopyStageSimple( &osbuild.CopyStageOptions{ Paths: []osbuild.CopyStagePath{ @@ -955,7 +955,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk inputName := "root-tree" 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(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback)) return p diff --git a/internal/distro/rhel90/stage_inputs.go b/internal/distro/rhel90/stage_inputs.go index c1b27e311..987178832 100644 --- a/internal/distro/rhel90/stage_inputs.go +++ b/internal/distro/rhel90/stage_inputs.go @@ -50,15 +50,6 @@ func xorrisofsStageInputs(pipeline string) *osbuild.XorrisofsStageInputs { 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 { stageKey := "name:" + stage ref := map[string]osbuild.QEMUFile{ diff --git a/internal/distro/rhel90beta/pipelines.go b/internal/distro/rhel90beta/pipelines.go index 311790e7d..d3901e618 100644 --- a/internal/distro/rhel90beta/pipelines.go +++ b/internal/distro/rhel90beta/pipelines.go @@ -1045,7 +1045,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk inputName := "root-tree" 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(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback)) return p diff --git a/internal/distro/rhel90beta/stage_inputs.go b/internal/distro/rhel90beta/stage_inputs.go index 19ca6e8d9..76cdea243 100644 --- a/internal/distro/rhel90beta/stage_inputs.go +++ b/internal/distro/rhel90beta/stage_inputs.go @@ -50,15 +50,6 @@ func xorrisofsStageInputs() *osbuild.XorrisofsStageInputs { 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 { stageKey := "name:" + stage ref := map[string]osbuild.QEMUFile{ diff --git a/internal/osbuild2/copy_stage.go b/internal/osbuild2/copy_stage.go index 510ea3a67..8b8917f98 100644 --- a/internal/osbuild2/copy_stage.go +++ b/internal/osbuild2/copy_stage.go @@ -58,3 +58,11 @@ func NewCopyStageSimple(options *CopyStageOptions, inputs CopyStageInputsNew) *S 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} +}