-
Notifications
You must be signed in to change notification settings - Fork 49
/
ovf.go
52 lines (42 loc) · 1.15 KB
/
ovf.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package manifest
import (
"fmt"
"github.com/osbuild/images/pkg/osbuild"
)
// A OVF copies a vmdk image to it's own tree and generates an OVF descriptor
type OVF struct {
Base
imgPipeline *VMDK
}
// NewOVF creates a new OVF pipeline. imgPipeline is the pipeline producing the vmdk image.
func NewOVF(buidPipeline *Build, imgPipeline *VMDK) *OVF {
p := &OVF{
Base: NewBase(imgPipeline.Manifest(), "ovf", buidPipeline),
imgPipeline: imgPipeline,
}
buidPipeline.addDependent(p)
imgPipeline.Manifest().addPipeline(p)
return p
}
func (p *OVF) serialize() osbuild.Pipeline {
pipeline := p.Base.serialize()
inputName := "vmdk-tree"
pipeline.AddStage(osbuild.NewCopyStageSimple(
&osbuild.CopyStageOptions{
Paths: []osbuild.CopyStagePath{
{
From: fmt.Sprintf("input://%s/%s", inputName, p.imgPipeline.Export().Filename()),
To: "tree:///",
},
},
},
osbuild.NewPipelineTreeInputs(inputName, p.imgPipeline.Name()),
))
pipeline.AddStage(osbuild.NewOVFStage(&osbuild.OVFStageOptions{
Vmdk: p.imgPipeline.Filename(),
}))
return pipeline
}
func (p *OVF) getBuildPackages(Distro) []string {
return []string{"qemu-img"}
}