distro: expose BasePackages
We want to be able to include the base packages when depsolving a blueprint, so expose the list. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
f0f2e80a97
commit
42e8ca19be
5 changed files with 60 additions and 8 deletions
|
|
@ -44,6 +44,9 @@ type Distro interface {
|
|||
// is 0 the default value for the format will be returned.
|
||||
GetSizeForOutputType(outputFormat string, size uint64) uint64
|
||||
|
||||
// Returns the base packages for a given output type and architecture
|
||||
BasePackages(outputFormat, outputArchitecture string) ([]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.
|
||||
|
|
|
|||
|
|
@ -348,6 +348,25 @@ func (r *Fedora30) GetSizeForOutputType(outputFormat string, size uint64) uint64
|
|||
return size
|
||||
}
|
||||
|
||||
func (r *Fedora30) BasePackages(outputFormat string, outputArchitecture string) ([]string, []string, error) {
|
||||
output, exists := r.outputs[outputFormat]
|
||||
if !exists {
|
||||
return nil, nil, errors.New("invalid output format: " + outputFormat)
|
||||
}
|
||||
|
||||
packages := output.Packages
|
||||
if output.Bootable {
|
||||
arch, exists := r.arches[outputArchitecture]
|
||||
if !exists {
|
||||
return nil, nil, errors.New("invalid architecture: " + outputArchitecture)
|
||||
}
|
||||
|
||||
packages = append(packages, arch.BootloaderPackages...)
|
||||
}
|
||||
|
||||
return packages, output.ExcludedPackages, 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 {
|
||||
|
|
@ -362,11 +381,13 @@ func (r *Fedora30) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.Repo
|
|||
p := &osbuild.Pipeline{}
|
||||
p.SetBuild(r.buildPipeline(arch, checksums), "org.osbuild.fedora30")
|
||||
|
||||
packages := append(output.Packages, b.GetPackages()...)
|
||||
if output.Bootable {
|
||||
packages = append(packages, arch.BootloaderPackages...)
|
||||
packages, excludedPackages, err := r.BasePackages(outputFormat, outputArchitecture)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, additionalRepos, checksums, packages, output.ExcludedPackages)))
|
||||
packages = append(packages, b.GetPackages()...)
|
||||
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, additionalRepos, checksums, packages, excludedPackages)))
|
||||
p.AddStage(osbuild.NewFixBLSStage())
|
||||
|
||||
// TODO support setting all languages and install corresponding langpack-* package
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ func (r *FedoraTestDistro) GetSizeForOutputType(outputFormat string, size uint64
|
|||
return 0
|
||||
}
|
||||
|
||||
func (d *FedoraTestDistro) BasePackages(outputFormat string, outputArchitecture string) ([]string, []string, error) {
|
||||
return nil, 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
|
||||
|
|
|
|||
|
|
@ -483,6 +483,25 @@ func (r *RHEL82) GetSizeForOutputType(outputFormat string, size uint64) uint64 {
|
|||
return size
|
||||
}
|
||||
|
||||
func (r *RHEL82) BasePackages(outputFormat string, outputArchitecture string) ([]string, []string, error) {
|
||||
output, exists := r.outputs[outputFormat]
|
||||
if !exists {
|
||||
return nil, nil, errors.New("invalid output format: " + outputFormat)
|
||||
}
|
||||
|
||||
packages := output.Packages
|
||||
if output.Bootable {
|
||||
arch, exists := r.arches[outputArchitecture]
|
||||
if !exists {
|
||||
return nil, nil, errors.New("invalid architecture: " + outputArchitecture)
|
||||
}
|
||||
|
||||
packages = append(packages, arch.BootloaderPackages...)
|
||||
}
|
||||
|
||||
return packages, output.ExcludedPackages, 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 {
|
||||
|
|
@ -497,11 +516,12 @@ func (r *RHEL82) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoCo
|
|||
p := &osbuild.Pipeline{}
|
||||
p.SetBuild(r.buildPipeline(arch, checksums), "org.osbuild.rhel82")
|
||||
|
||||
packages := append(output.Packages, b.GetPackages()...)
|
||||
if output.Bootable {
|
||||
packages = append(packages, arch.BootloaderPackages...)
|
||||
packages, excludedPackages, err := r.BasePackages(outputFormat, outputArchitecture)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, additionalRepos, checksums, packages, output.ExcludedPackages)))
|
||||
packages = append(packages, b.GetPackages()...)
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, additionalRepos, checksums, packages, excludedPackages)))
|
||||
p.AddStage(osbuild.NewFixBLSStage())
|
||||
|
||||
if output.Bootable {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ func (d *TestDistro) FilenameFromType(outputFormat string) (string, string, erro
|
|||
return "", "", errors.New("invalid output format: " + outputFormat)
|
||||
}
|
||||
|
||||
func (d *TestDistro) BasePackages(outputFormat, outputArchitecture string) ([]string, []string, error) {
|
||||
return nil, 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