debian-forge-composer/vendor/github.com/osbuild/images/pkg/manifest/commit.go
Tomáš Hozza 625b1578fa Port osbuild/images v0.33.0 with dot-notation to composer
Update the osbuild/images to the version which introduces "dot notation"
for distro release versions.

 - Replace all uses of distroregistry by distrofactory.
 - Delete local version of reporegistry and use the one from the
   osbuild/images.
 - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single
   `createTestWeldrAPI()` function`.
 - store/fixture: rework fixtures to allow overriding the host distro
   name and host architecture name. A cleanup function to restore the
   host distro and arch names is always part of the fixture struct.
 - Delete `distro_mock` package, since it is no longer used.
 - Bump the required version of osbuild to 98, because the OSCAP
   customization is using the 'compress_results' stage option, which is
   not available in older versions of osbuild.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00

65 lines
1.5 KiB
Go

package manifest
import (
"github.com/osbuild/images/pkg/osbuild"
)
// OSTreeCommit represents an ostree with one commit.
type OSTreeCommit struct {
Base
OSVersion string
treePipeline *OS
ref string
}
// NewOSTreeCommit creates a new OSTree commit pipeline. The
// treePipeline is the tree representing the content of the commit.
// ref is the ref to create the commit under.
func NewOSTreeCommit(buildPipeline Build, treePipeline *OS, ref string) *OSTreeCommit {
p := &OSTreeCommit{
Base: NewBase("ostree-commit", buildPipeline),
treePipeline: treePipeline,
ref: ref,
}
buildPipeline.addDependent(p)
return p
}
func (p *OSTreeCommit) getBuildPackages(Distro) []string {
packages := []string{
"rpm-ostree",
}
return packages
}
func (p *OSTreeCommit) serialize() osbuild.Pipeline {
pipeline := p.Base.serialize()
if p.treePipeline.OSTreeRef == "" {
panic("tree is not ostree")
}
pipeline.AddStage(osbuild.NewOSTreeInitStage(&osbuild.OSTreeInitStageOptions{Path: "/repo"}))
var parentID string
treeCommits := p.treePipeline.getOSTreeCommits()
if len(treeCommits) > 0 {
if len(treeCommits) > 1 {
panic("multiple ostree commit specs found; this is a programming error")
}
parentCommit := &treeCommits[0]
parentID = parentCommit.Checksum
}
pipeline.AddStage(osbuild.NewOSTreeCommitStage(
&osbuild.OSTreeCommitStageOptions{
Ref: p.ref,
OSVersion: p.OSVersion,
Parent: parentID,
},
p.treePipeline.Name()),
)
return pipeline
}