debian-forge-composer/internal/manifest/vpc.go
Tom Gundersen f791bde0e4 pipeline: fully encapsulate manifest generation
Make it the responsibility of each pipeline to track its required
sources, and use this to generate a manifest from its pipelines.

This removes the dependency on osbuild2 from distro.go, and the
only other uses of osbuild2 are to specify parameters in
ImageConfig, which will eventually go away too.

As a consequence, this only attaches the required sources for a
given manifest, rather than all known packages in the package set
map.
2022-07-04 23:04:29 +01:00

35 lines
1 KiB
Go

package manifest
import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// A VPCPipeline turns a raw image file into qemu-based image format, such as qcow2.
type VPCPipeline struct {
BasePipeline
imgPipeline *LiveImgPipeline
filename string
}
// NewVPCPipeline createsa new Qemu pipeline. imgPipeline is the pipeline producing the
// raw image. The pipeline name is the name of the new pipeline. Filename is the name
// of the produced image.
func NewVPCPipeline(buildPipeline *BuildPipeline, imgPipeline *LiveImgPipeline, filename string) VPCPipeline {
return VPCPipeline{
BasePipeline: NewBasePipeline("vpc", buildPipeline, nil),
imgPipeline: imgPipeline,
filename: filename,
}
}
func (p VPCPipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
pipeline.AddStage(osbuild2.NewQEMUStage(
osbuild2.NewQEMUStageOptions(p.filename, osbuild2.QEMUFormatVPC, nil),
osbuild2.NewQemuStagePipelineFilesInputs(p.imgPipeline.Name(), p.imgPipeline.Filename()),
))
return pipeline
}