manifest/pipelines: add ExtraPackages

Allow the packages returned by a pipeline to be extended by setting
the optional property ExtraPackages.

In the case of OSPipeline, a further UserPackages property is added.
This allows the caller to set the set of packages that should be
depsolevd in a second transaction, on top of the one for the base
packages.

This functionality is currently unused so this is a noop.
This commit is contained in:
Tom Gundersen 2022-06-29 02:33:14 +01:00
parent fc08579c29
commit 8f9b6eef8f
4 changed files with 63 additions and 1 deletions

View file

@ -8,6 +8,9 @@ import (
// An AnacondaPipeline represents the installer tree as found on an ISO.
type AnacondaPipeline struct {
BasePipeline
// Packages to install in addition to the ones required by the
// pipeline.
ExtraPackages []string
// Users indicate whether or not the user spoke should be enabled in
// anaconda. If it is, users specified in a kickstart will be configured,
// and in case no users are provided in a kickstart the user will be
@ -57,6 +60,16 @@ func NewAnacondaPipeline(buildPipeline *BuildPipeline,
return p
}
func (p *AnacondaPipeline) getPackageSetChain() []rpmmd.PackageSet {
packages := []string{}
return []rpmmd.PackageSet{
{
Include: append(packages, p.ExtraPackages...),
Repositories: p.repos,
},
}
}
func (p *AnacondaPipeline) getPackageSpecs() []rpmmd.PackageSpec {
return p.packageSpecs
}

View file

@ -14,6 +14,9 @@ import (
// make minimal assumptions about what's available there.
type BuildPipeline struct {
BasePipeline
// Packages to install in addition to the ones required by the
// pipeline.
ExtraPackages []string
dependents []Pipeline
repos []rpmmd.RepoConfig
@ -45,7 +48,7 @@ func (p *BuildPipeline) getPackageSetChain() []rpmmd.PackageSet {
return []rpmmd.PackageSet{
{
Include: packages,
Include: append(packages, p.ExtraPackages...),
Repositories: p.repos,
},
}

View file

@ -12,6 +12,9 @@ import (
// an embedded ostree commit.
type OSTreeCommitServerTreePipeline struct {
BasePipeline
// Packages to install in addition to the ones required by the
// pipeline.
ExtraPackages []string
// TODO: should this be configurable?
Language string
@ -46,6 +49,16 @@ func NewOSTreeCommitServerTreePipeline(buildPipeline *BuildPipeline,
return p
}
func (p *OSTreeCommitServerTreePipeline) getPackageSetChain() []rpmmd.PackageSet {
packages := []string{}
return []rpmmd.PackageSet{
{
Include: append(packages, p.ExtraPackages...),
Repositories: p.repos,
},
}
}
func (p *OSTreeCommitServerTreePipeline) getPackageSpecs() []rpmmd.PackageSpec {
return p.packageSpecs
}

View file

@ -23,6 +23,19 @@ const (
// correpsonds to the root filesystem once an instance of the image is running.
type OSPipeline struct {
BasePipeline
// Packages to install in addition to the ones required by the
// pipeline.
ExtraBasePackages []string
// Packages to exclude from the base package set. This is useful in
// case of weak dependencies, comps groups, or where multiple packages
// can satisfy a dependency. Must not conflict with the included base
// package set.
ExcludeBasePackages []string
// Packages to install on top of the base packages in a seconadry dnf
// transaction.
UserPackages []string
// Repositories to install the user packages from.
UserRepos []rpmmd.RepoConfig
// KernelOptionsAppend are appended to the kernel commandline
KernelOptionsAppend []string
// UEFIVendor indicates whether or not the OS should support UEFI and
@ -126,6 +139,26 @@ func NewOSPipeline(buildPipeline *BuildPipeline,
return p
}
func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet {
packages := []string{}
chain := []rpmmd.PackageSet{
{
Include: append(packages, p.ExtraBasePackages...),
Exclude: p.ExcludeBasePackages,
Repositories: p.repos,
},
}
if len(p.UserPackages) > 0 {
chain = append(chain, rpmmd.PackageSet{
Include: p.UserPackages,
Repositories: append(p.repos, p.UserRepos...),
})
}
return chain
}
func (p *OSPipeline) getOSTreeCommits() []osTreeCommit {
commits := []osTreeCommit{}
if p.osTreeParent != "" && p.osTreeURL != "" {