osbuild2: make inputs generic for copy stage ctor

Add a level of indirection for the copy stage constructor function
in order to be able to use it with existing input types, like the
files input.

Co-Developed-by: Achilleas Koutsou <achilleas@koutsou.net>
Co-Developed-by: Antonio Murdaca <runcom@linux.com>
This commit is contained in:
Christian Kellner 2021-08-20 12:10:37 +02:00 committed by Tom Gundersen
parent 2a98885953
commit d27596b24a

View file

@ -25,13 +25,23 @@ func (CopyStageInputs) isStageInputs() {}
type CopyStageReferences []string
type CopyStageInputsNew interface {
isCopyStageInputs()
}
func (CopyStageInputs) isCopyStageInputs() {}
func (CopyStageReferences) isReferences() {}
func NewCopyStage(options *CopyStageOptions, inputs *CopyStageInputs, devices *Devices, mounts *Mounts) *Stage {
func NewCopyStage(options *CopyStageOptions, inputs CopyStageInputsNew, devices *Devices, mounts *Mounts) *Stage {
var stageInputs Inputs
if inputs != nil {
stageInputs = inputs.(Inputs)
}
return &Stage{
Type: "org.osbuild.copy",
Options: options,
Inputs: inputs,
Inputs: stageInputs,
Devices: *devices,
Mounts: *mounts,
}