split: replace internal packages with images library

Remove all the internal package that are now in the
github.com/osbuild/images package and vendor it.

A new function in internal/blueprint/ converts from an osbuild-composer
blueprint to an images blueprint.  This is necessary for keeping the
blueprint implementation in both packages.  In the future, the images
package will change the blueprint (and most likely rename it) and it
will only be part of the osbuild-composer internals and interface.  The
Convert() function will be responsible for converting the blueprint into
the new configuration object.
This commit is contained in:
Achilleas Koutsou 2023-06-14 16:34:41 +02:00 committed by Sanne Raymaekers
parent d59199670f
commit 0e4a9e586f
446 changed files with 5690 additions and 13312 deletions

View file

@ -0,0 +1,72 @@
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(m *Manifest,
buildPipeline *Build,
treePipeline *OS,
ref string) *OSTreeCommit {
p := &OSTreeCommit{
Base: NewBase(m, "ostree-commit", buildPipeline),
treePipeline: treePipeline,
ref: ref,
}
if treePipeline.Base.manifest != m {
panic("tree pipeline from different manifest")
}
buildPipeline.addDependent(p)
m.addPipeline(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
}