manifest/os: include kernel in package set

If the kernel name is set, then the packaegSpecs must include the kernel package, ensure
this by including the kernel in the package list.

We currently include the kernel both in the userPackages and the base packages.
Including it only in the user packages does not work as the base could end up pulling it
in as well. However, it would be semantically more correct to include it only in the base
set, so if possible we should do that and drop it from the user packages (in a follow-up).
This commit is contained in:
Tom Gundersen 2022-07-05 20:55:50 +01:00
parent 1bccf72b6b
commit e4b5048d98
2 changed files with 11 additions and 9 deletions

View file

@ -568,8 +568,8 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
mergedSets[osPkgsKey] = rpmmd.PackageSet{}
}
// blueprint packages
bpPackages := bp.GetPackagesEx(t.rpmOstree || t.bootable)
// do not include the kernel package, this is added in the pipelines
bpPackages := bp.GetPackagesEx(false)
timezone, _ := bp.Customizations.GetTimezoneSettings()
if timezone != nil {
bpPackages = append(bpPackages, "chrony")
@ -578,13 +578,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
// depsolve bp packages separately
// bp packages aren't restricted by exclude lists
mergedSets[blueprintPkgsKey] = rpmmd.PackageSet{Include: bpPackages}
kernel := bp.Customizations.GetKernel().Name
// add bp kernel to main OS package set to avoid duplicate kernels,
// but we don't want to add the kernel for the container artefact
if t.rpmOstree || t.bootable {
mergedSets[osPkgsKey] = mergedSets[osPkgsKey].Append(rpmmd.PackageSet{Include: []string{kernel}})
}
// create a manifest object and instantiate it with the computed packageSetChains
manifest, err := t.initializeManifest(bp.Customizations, options, repos, distro.MakePackageSetChains(t, mergedSets, repos), 0)

View file

@ -125,6 +125,15 @@ func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet {
packages := p.platform.GetPackages()
userPackages := []string{}
if p.KernelName != "" {
userPackages = append(packages, p.KernelName)
// include the kernel also in the base packages to
// avoid ending up with two kernels
// TODO: only include the kernel here
packages = append(packages, p.KernelName)
}
// If we have a logical volume we need to include the lvm2 package
if p.PartitionTable != nil && p.OSTree == nil {
hasLVM := false