Move rpmStageInputs() from distros to osbuild2

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

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2022-02-16 10:45:22 +01:00 committed by Ondřej Budai
parent 8e6826e743
commit 069423ea67
10 changed files with 43 additions and 111 deletions

View file

@ -107,3 +107,19 @@ func RPMPackageMetadataToSignature(pkg RPMPackageMetadata) *string {
}
return nil
}
func NewRpmStageSourceFilesInputs(specs []rpmmd.PackageSpec) *RPMStageInputs {
stageInput := new(RPMStageInput)
stageInput.Type = "org.osbuild.files"
stageInput.Origin = "org.osbuild.source"
stageInput.References = pkgRefs(specs)
return &RPMStageInputs{Packages: stageInput}
}
func pkgRefs(specs []rpmmd.PackageSpec) RPMStageReferences {
refs := make([]string, len(specs))
for idx, pkg := range specs {
refs[idx] = pkg.Checksum
}
return refs
}