distro: expose BuildPackages
We want to be able to include the build packages when depsolving a blueprint, so expose the list. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
42e8ca19be
commit
7f0f6c001e
5 changed files with 65 additions and 26 deletions
|
|
@ -47,6 +47,9 @@ type Distro interface {
|
|||
// Returns the base packages for a given output type and architecture
|
||||
BasePackages(outputFormat, outputArchitecture string) ([]string, []string, error)
|
||||
|
||||
// Returns the build packages for a given output architecture
|
||||
BuildPackages(outputArchitecture string) ([]string, error)
|
||||
|
||||
// Returns an osbuild pipeline that generates an image in the given
|
||||
// output format with all packages and customizations specified in the
|
||||
// given blueprint.
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ import (
|
|||
)
|
||||
|
||||
type Fedora30 struct {
|
||||
arches map[string]arch
|
||||
outputs map[string]output
|
||||
arches map[string]arch
|
||||
outputs map[string]output
|
||||
buildPackages []string
|
||||
}
|
||||
|
||||
type arch struct {
|
||||
|
|
@ -51,6 +52,15 @@ func New(confPaths []string) *Fedora30 {
|
|||
r := Fedora30{
|
||||
arches: map[string]arch{},
|
||||
outputs: map[string]output{},
|
||||
buildPackages: []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
},
|
||||
}
|
||||
|
||||
repoMap, err := rpmmd.LoadRepositories(confPaths, r.Name())
|
||||
|
|
@ -367,6 +377,15 @@ func (r *Fedora30) BasePackages(outputFormat string, outputArchitecture string)
|
|||
return packages, output.ExcludedPackages, nil
|
||||
}
|
||||
|
||||
func (r *Fedora30) BuildPackages(outputArchitecture string) ([]string, error) {
|
||||
arch, exists := r.arches[outputArchitecture]
|
||||
if !exists {
|
||||
return nil, errors.New("invalid architecture: " + outputArchitecture)
|
||||
}
|
||||
|
||||
return append(r.buildPackages, arch.BuildPackages...), nil
|
||||
}
|
||||
|
||||
func (r *Fedora30) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string, size uint64) (*osbuild.Pipeline, error) {
|
||||
output, exists := r.outputs[outputFormat]
|
||||
if !exists {
|
||||
|
|
@ -455,16 +474,11 @@ func (r *Fedora30) Runner() string {
|
|||
}
|
||||
|
||||
func (r *Fedora30) buildPipeline(arch arch, checksums map[string]string) *osbuild.Pipeline {
|
||||
packages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
packages, err := r.BuildPackages(arch.Name)
|
||||
if err != nil {
|
||||
panic("impossibly invalid arch")
|
||||
}
|
||||
packages = append(packages, arch.BuildPackages...)
|
||||
|
||||
p := &osbuild.Pipeline{}
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, nil, checksums, packages, nil)))
|
||||
return p
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ func (d *FedoraTestDistro) BasePackages(outputFormat string, outputArchitecture
|
|||
return nil, nil, nil
|
||||
}
|
||||
|
||||
func (d *FedoraTestDistro) BuildPackages(outputArchitecture string) ([]string, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (d *FedoraTestDistro) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArch, outputFormat string, size uint64) (*osbuild.Pipeline, error) {
|
||||
if outputFormat == "qcow2" && outputArch == "x86_64" {
|
||||
return &osbuild.Pipeline{}, nil
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ import (
|
|||
)
|
||||
|
||||
type RHEL82 struct {
|
||||
arches map[string]arch
|
||||
outputs map[string]output
|
||||
arches map[string]arch
|
||||
outputs map[string]output
|
||||
buildPackages []string
|
||||
}
|
||||
|
||||
type arch struct {
|
||||
|
|
@ -52,6 +53,19 @@ func New(confPaths []string) *RHEL82 {
|
|||
r := RHEL82{
|
||||
arches: map[string]arch{},
|
||||
outputs: map[string]output{},
|
||||
buildPackages: []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"dracut-config-generic",
|
||||
"e2fsprogs",
|
||||
"glibc",
|
||||
"policycoreutils",
|
||||
"python36",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xfsprogs",
|
||||
},
|
||||
}
|
||||
|
||||
repoMap, err := rpmmd.LoadRepositories(confPaths, r.Name())
|
||||
|
|
@ -502,6 +516,15 @@ func (r *RHEL82) BasePackages(outputFormat string, outputArchitecture string) ([
|
|||
return packages, output.ExcludedPackages, nil
|
||||
}
|
||||
|
||||
func (r *RHEL82) BuildPackages(outputArchitecture string) ([]string, error) {
|
||||
arch, exists := r.arches[outputArchitecture]
|
||||
if !exists {
|
||||
return nil, errors.New("invalid architecture: " + outputArchitecture)
|
||||
}
|
||||
|
||||
return append(r.buildPackages, arch.BuildPackages...), nil
|
||||
}
|
||||
|
||||
func (r *RHEL82) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string, size uint64) (*osbuild.Pipeline, error) {
|
||||
output, exists := r.outputs[outputFormat]
|
||||
if !exists {
|
||||
|
|
@ -594,20 +617,11 @@ func (r *RHEL82) Runner() string {
|
|||
}
|
||||
|
||||
func (r *RHEL82) buildPipeline(arch arch, checksums map[string]string) *osbuild.Pipeline {
|
||||
packages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"dracut-config-generic",
|
||||
"e2fsprogs",
|
||||
"glibc",
|
||||
"policycoreutils",
|
||||
"python36",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xfsprogs",
|
||||
packages, err := r.BuildPackages(arch.Name)
|
||||
if err != nil {
|
||||
panic("impossibly invalid arch")
|
||||
}
|
||||
packages = append(packages, arch.BuildPackages...)
|
||||
|
||||
p := &osbuild.Pipeline{}
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, nil, checksums, packages, nil)))
|
||||
return p
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ func (d *TestDistro) BasePackages(outputFormat, outputArchitecture string) ([]st
|
|||
return nil, nil, nil
|
||||
}
|
||||
|
||||
func (d *TestDistro) BuildPackages(outputArchitecture string) ([]string, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (d *TestDistro) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArch, outputFormat string, size uint64) (*osbuild.Pipeline, error) {
|
||||
if outputFormat == "test_output" && outputArch == "test_arch" {
|
||||
return &osbuild.Pipeline{}, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue