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:
parent
ffa1e1df17
commit
db431a565d
14 changed files with 114 additions and 69 deletions
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
rhel "github.com/osbuild/osbuild-composer/internal/distro/rhel8"
|
||||
"github.com/osbuild/osbuild-composer/internal/dnfjson"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
|
@ -47,7 +48,7 @@ func TestCrossArchDepsolve(t *testing.T) {
|
|||
|
||||
packages := imgType.PackageSets(blueprint.Blueprint{},
|
||||
distro.ImageOptions{
|
||||
OSTree: distro.OSTreeImageOptions{
|
||||
OSTree: &ostree.ImageOptions{
|
||||
URL: "foo",
|
||||
ImageRef: "bar",
|
||||
FetchChecksum: "baz",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -48,7 +49,7 @@ func main() {
|
|||
encoder := json.NewEncoder(os.Stdout)
|
||||
encoder.SetIndent("", " ")
|
||||
pkgset := image.PackageSets(blueprint.Blueprint{}, distro.ImageOptions{
|
||||
OSTree: distro.OSTreeImageOptions{
|
||||
OSTree: &ostree.ImageOptions{
|
||||
URL: "foo",
|
||||
ImageRef: "bar",
|
||||
FetchChecksum: "baz",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
"github.com/osbuild/osbuild-composer/internal/dnfjson"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
|
|
@ -179,7 +180,7 @@ func main() {
|
|||
|
||||
options := distro.ImageOptions{
|
||||
Size: imageType.Size(0),
|
||||
OSTree: distro.OSTreeImageOptions{
|
||||
OSTree: &ostree.ImageOptions{
|
||||
ImageRef: composeRequest.OSTree.Ref,
|
||||
FetchChecksum: composeRequest.OSTree.Parent,
|
||||
URL: composeRequest.OSTree.URL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue