distro: new blueprint helper where kernel package is optional

Add a new extended helper `GetPackagesEx` that includes a flag
to specify if the target is bootlable or not and only include
the kernel package in case it is set to true. Delegate to this
new helper from the existing `GetPackages`.
This commit is contained in:
Christian Kellner 2022-06-27 17:08:07 +02:00
parent 986f076276
commit 516f30de17
2 changed files with 10 additions and 4 deletions

View file

@ -94,6 +94,10 @@ func (b *Blueprint) BumpVersion(old string) {
// packages, modules, and groups all resolve to rpm packages right now. This
// function returns a combined list of "name-version" strings.
func (b *Blueprint) GetPackages() []string {
return b.GetPackagesEx(true)
}
func (b *Blueprint) GetPackagesEx(bootable bool) []string {
packages := []string{}
for _, pkg := range b.Packages {
packages = append(packages, pkg.ToNameVersion())
@ -105,9 +109,11 @@ func (b *Blueprint) GetPackages() []string {
packages = append(packages, "@"+group.Name)
}
kc := b.Customizations.GetKernel()
kpkg := Package{Name: kc.Name}
packages = append(packages, kpkg.ToNameVersion())
if bootable {
kc := b.Customizations.GetKernel()
kpkg := Package{Name: kc.Name}
packages = append(packages, kpkg.ToNameVersion())
}
return packages
}

View file

@ -571,7 +571,7 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, repos []rpmmd.RepoConfig
}
// blueprint packages
bpPackages := bp.GetPackages()
bpPackages := bp.GetPackagesEx(t.bootable)
timezone, _ := bp.Customizations.GetTimezoneSettings()
if timezone != nil {
bpPackages = append(bpPackages, "chrony")