weldr: split blueprint into its own package

This will contain all the translation logic from blueprints to pipelines,
which will constitute the main part of composer, so let's separate that
out from the API.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-10-03 19:38:23 +02:00 committed by Lars Karlitski
parent 329964f2ab
commit 949d3464b5
3 changed files with 70 additions and 61 deletions

View file

@ -0,0 +1,28 @@
// Package blueprint contains primitives for representing weldr blueprints and
// translating them to OSBuild pipelines
package blueprint
import "osbuild-composer/internal/pipeline"
// A Blueprint is a high-level description of an image.
type Blueprint struct {
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version,omitempty"`
Packages []Package `json:"packages"`
Modules []Package `json:"modules"`
Groups []Package `json:"groups"`
}
// A Package specifies an RPM package.
type Package struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
}
// TranslateToPipeline converts the blueprint to a pipeline for a given output format.
func (b *Blueprint) TranslateToPipeline(outputFormat string) *pipeline.Pipeline {
p := &pipeline.Pipeline{}
p.SetAssembler(pipeline.NewTarAssembler(pipeline.NewTarAssemblerOptions("image.tar")))
return p
}