blueprint: add support for extra packages, "modules" and groups

"modules" because they're not actual modules. Currently, it's just
a synonym to packages. This is the same behavior as lorax-composer has.
This commit is contained in:
Ondřej Budai 2019-10-31 07:00:18 +01:00 committed by Tom Gundersen
parent 93e7a26785
commit dc359fca3a
10 changed files with 32 additions and 9 deletions

View file

@ -21,7 +21,7 @@ func (t *amiOutput) translate(b *Blueprint) *pipeline.Pipeline {
excludedPackages := [...]string{
"dracut-config-rescue",
}
p := getCustomF30PackageSet(packages[:], excludedPackages[:])
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
addF30FixBlsStage(p)
addF30LocaleStage(p)
addF30FSTabStage(p)

View file

@ -95,3 +95,12 @@ func FilenameFromType(outputFormat string) (string, string, error) {
return "", "", &InvalidOutputFormatError{outputFormat}
}
func (p Package) ToNameVersion() string {
// Omit version to prevent all packages with prefix of name to be installed
if p.Version == "*" {
return p.Name
}
return p.Name + "-" + p.Version
}

View file

@ -17,7 +17,7 @@ func (t *diskOutput) translate(b *Blueprint) *pipeline.Pipeline {
excludedPackages := [...]string{
"dracut-config-rescue",
}
p := getCustomF30PackageSet(packages[:], excludedPackages[:])
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
addF30LocaleStage(p)
addF30FSTabStage(p)
addF30GRUB2Stage(p, b.getKernelCustomization())

View file

@ -16,7 +16,7 @@ func (t *ext4Output) translate(b *Blueprint) *pipeline.Pipeline {
excludedPackages := [...]string{
"dracut-config-rescue",
}
p := getCustomF30PackageSet(packages[:], excludedPackages[:])
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
addF30LocaleStage(p)
addF30GRUB2Stage(p, b.getKernelCustomization())
addF30FixBlsStage(p)

View file

@ -89,7 +89,7 @@ func getF30Pipeline() *pipeline.Pipeline {
return p
}
func getCustomF30PackageSet(packages []string, excludedPackages []string) *pipeline.Pipeline {
func getCustomF30PackageSet(packages []string, excludedPackages []string, blueprint *Blueprint) *pipeline.Pipeline {
p := &pipeline.Pipeline{
BuildPipeline: getF30BuildPipeline(),
}
@ -104,6 +104,20 @@ func getCustomF30PackageSet(packages []string, excludedPackages []string) *pipel
for _, pkg := range excludedPackages {
options.ExcludePackage(pkg)
}
// handle extra packages, modules (currently synonym to packages) and groups
for _, pkg := range blueprint.Packages {
options.AddPackage(pkg.ToNameVersion())
}
for _, pkg := range blueprint.Modules {
options.AddPackage(pkg.ToNameVersion())
}
for _, group := range blueprint.Groups {
options.AddPackage(group.Name)
}
p.AddStage(pipeline.NewDNFStage(options))
return p
}

View file

@ -21,7 +21,7 @@ func (t *openstackOutput) translate(b *Blueprint) *pipeline.Pipeline {
excludedPackages := [...]string{
"dracut-config-rescue",
}
p := getCustomF30PackageSet(packages[:], excludedPackages[:])
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
addF30LocaleStage(p)
addF30FSTabStage(p)
addF30GRUB2Stage(p, b.getKernelCustomization())

View file

@ -22,7 +22,7 @@ func (t *qcow2Output) translate(b *Blueprint) *pipeline.Pipeline {
"gobject-introspection",
"plymouth",
}
p := getCustomF30PackageSet(packages[:], excludedPackages[:])
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
addF30LocaleStage(p)
addF30FSTabStage(p)
addF30GRUB2Stage(p, b.getKernelCustomization())

View file

@ -16,7 +16,7 @@ func (t *tarOutput) translate(b *Blueprint) *pipeline.Pipeline {
excludedPackages := [...]string{
"dracut-config-rescue",
}
p := getCustomF30PackageSet(packages[:], excludedPackages[:])
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
addF30LocaleStage(p)
addF30GRUB2Stage(p, b.getKernelCustomization())
addF30FixBlsStage(p)

View file

@ -20,7 +20,7 @@ func (t *vhdOutput) translate(b *Blueprint) *pipeline.Pipeline {
excludedPackages := [...]string{
"dracut-config-rescue",
}
p := getCustomF30PackageSet(packages[:], excludedPackages[:])
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
addF30LocaleStage(p)
addF30FSTabStage(p)
addF30GRUB2Stage(p, b.getKernelCustomization())

View file

@ -18,7 +18,7 @@ func (t *vmdkOutput) translate(b *Blueprint) *pipeline.Pipeline {
excludedPackages := [...]string{
"dracut-config-rescue",
}
p := getCustomF30PackageSet(packages[:], excludedPackages[:])
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
addF30LocaleStage(p)
addF30FSTabStage(p)
addF30GRUB2Stage(p, b.getKernelCustomization())