manifest: remove private osTreeCommit type
Use the ostree.CommitSpec type instead and return it directly from the pipeline attributes when needed.
This commit is contained in:
parent
d32dff14b4
commit
785f9cb7dd
5 changed files with 18 additions and 39 deletions
|
|
@ -65,13 +65,8 @@ func (p *OSTreeDeployment) getBuildPackages() []string {
|
|||
return packages
|
||||
}
|
||||
|
||||
func (p *OSTreeDeployment) getOSTreeCommits() []osTreeCommit {
|
||||
return []osTreeCommit{
|
||||
{
|
||||
checksum: p.commit.Checksum,
|
||||
url: p.commit.URL,
|
||||
},
|
||||
}
|
||||
func (p *OSTreeDeployment) getOSTreeCommits() []ostree.CommitSpec {
|
||||
return []ostree.CommitSpec{p.commit}
|
||||
}
|
||||
|
||||
func (p *OSTreeDeployment) serialize() osbuild.Pipeline {
|
||||
|
|
|
|||
|
|
@ -56,18 +56,13 @@ func NewISOTree(m *Manifest,
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *ISOTree) getOSTreeCommits() []osTreeCommit {
|
||||
var checksum, url string
|
||||
if p.OSTree != nil {
|
||||
checksum = p.OSTree.Checksum
|
||||
url = p.OSTree.URL
|
||||
|
||||
// Return the ostree commit URL and checksum that will be included in this
|
||||
func (p *ISOTree) getOSTreeCommits() []ostree.CommitSpec {
|
||||
if p.OSTree == nil {
|
||||
return nil
|
||||
}
|
||||
return []osTreeCommit{
|
||||
{
|
||||
checksum: checksum,
|
||||
url: url,
|
||||
},
|
||||
return []ostree.CommitSpec{
|
||||
*p.OSTree,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,6 @@ const (
|
|||
ARCH_PPC64LE
|
||||
)
|
||||
|
||||
type osTreeCommit struct {
|
||||
checksum string
|
||||
url string
|
||||
}
|
||||
|
||||
// An OSBuildManifest is an opaque JSON object, which is a valid input to osbuild
|
||||
// TODO: use this instead of distro.Manifest below
|
||||
type OSBuildManifest []byte
|
||||
|
|
@ -67,11 +62,8 @@ func (m Manifest) Serialize(packageSets map[string][]rpmmd.PackageSpec) (distro.
|
|||
pipeline.serializeStart(packageSets[pipeline.Name()])
|
||||
}
|
||||
for _, pipeline := range m.pipelines {
|
||||
for _, commit := range pipeline.getOSTreeCommits() {
|
||||
commits = append(commits, ostree.CommitSpec{
|
||||
Checksum: commit.checksum, URL: commit.url,
|
||||
})
|
||||
}
|
||||
|
||||
commits = append(commits, pipeline.getOSTreeCommits()...)
|
||||
pipelines = append(pipelines, pipeline.serialize())
|
||||
packages = append(packages, packageSets[pipeline.Name()]...)
|
||||
inline = append(inline, pipeline.getInline()...)
|
||||
|
|
|
|||
|
|
@ -187,15 +187,11 @@ func (p *OS) getBuildPackages() []string {
|
|||
return packages
|
||||
}
|
||||
|
||||
func (p *OS) getOSTreeCommits() []osTreeCommit {
|
||||
commits := []osTreeCommit{}
|
||||
if p.OSTreeRef != "" && p.OSTreeParent != nil {
|
||||
commits = append(commits, osTreeCommit{
|
||||
checksum: p.OSTreeParent.Checksum,
|
||||
url: p.OSTreeParent.URL,
|
||||
})
|
||||
func (p *OS) getOSTreeCommits() []ostree.CommitSpec {
|
||||
if p.OSTreeParent == nil {
|
||||
return nil
|
||||
}
|
||||
return commits
|
||||
return []ostree.CommitSpec{*p.OSTreeParent}
|
||||
}
|
||||
|
||||
func (p *OS) getPackageSpecs() []rpmmd.PackageSpec {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ package manifest
|
|||
import (
|
||||
"github.com/osbuild/osbuild-composer/internal/artifact"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
|
@ -25,7 +26,7 @@ type Pipeline interface {
|
|||
serializeEnd()
|
||||
serialize() osbuild.Pipeline
|
||||
getPackageSpecs() []rpmmd.PackageSpec
|
||||
getOSTreeCommits() []osTreeCommit
|
||||
getOSTreeCommits() []ostree.CommitSpec
|
||||
getInline() []string
|
||||
}
|
||||
|
||||
|
|
@ -78,8 +79,8 @@ func (p Base) getPackageSpecs() []rpmmd.PackageSpec {
|
|||
return []rpmmd.PackageSpec{}
|
||||
}
|
||||
|
||||
func (p Base) getOSTreeCommits() []osTreeCommit {
|
||||
return []osTreeCommit{}
|
||||
func (p Base) getOSTreeCommits() []ostree.CommitSpec {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p Base) getInline() []string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue