ostree: move OSTreeImageOptions to the ostree package

Move the ostree image options to the ostree package and rename the type
to ImageOptions (ostree.ImageOptions).
This commit is contained in:
Achilleas Koutsou 2023-05-05 15:11:39 +02:00 committed by Simon de Vlieger
parent ffa1e1df17
commit db431a565d
14 changed files with 114 additions and 69 deletions

View file

@ -22,6 +22,7 @@ import (
"github.com/osbuild/osbuild-composer/internal/distroregistry"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/osbuild-composer/internal/manifest"
"github.com/osbuild/osbuild-composer/internal/ostree"
"github.com/osbuild/osbuild-composer/internal/rhsm/facts"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
)
@ -122,12 +123,17 @@ func makeManifestJob(name string, imgType distro.ImageType, cr composeRequest, d
options := distro.ImageOptions{Size: 0}
if cr.OSTree != nil {
options.OSTree = distro.OSTreeImageOptions{
options.OSTree = &ostree.ImageOptions{
URL: cr.OSTree.URL,
ImageRef: cr.OSTree.Ref,
FetchChecksum: cr.OSTree.Parent,
RHSM: cr.OSTree.RHSM,
}
} else {
// use default OSTreeRef for image type
options.OSTree = &ostree.ImageOptions{
ImageRef: imgType.OSTreeRef(),
}
}
// add RHSM fact to detect changes
@ -155,11 +161,6 @@ func makeManifestJob(name string, imgType distro.ImageType, cr composeRequest, d
return fmt.Errorf("[%s] container resolution failed: %s", filename, err.Error())
}
if options.OSTree.ImageRef == "" {
// use default OSTreeRef for image type
options.OSTree.ImageRef = imgType.OSTreeRef()
}
packageSpecs, err := depsolve(cacheDir, imgType, bp, options, repos, distribution, archName)
if err != nil {
err = fmt.Errorf("[%s] depsolve failed: %s", filename, err.Error())