From 1e036274470e5676f175c9e3e95bed4970210c4f Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 6 Jul 2022 00:48:18 +0100 Subject: [PATCH] manifest/os: only implicitly add to base packages Any package that is added by the pipeline definition should be in the base package set and the user package set should only be for packages explicitly added by the user. Any combination of implicitly added packages should depsolve, or it is a bug. However, user provided packages can have conflicts which must be handled gracefully. This change is not breaking, as that would be a bug (per the above) and it makes our behaviour more predictable as any conflicts are caused by explicitly added packages. Note that this changes the logic from the kernel package being depsolved twice to only being depsolved in the base package set. --- internal/manifest/os.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/internal/manifest/os.go b/internal/manifest/os.go index 5a408ceb3..a2bb421fa 100644 --- a/internal/manifest/os.go +++ b/internal/manifest/os.go @@ -125,14 +125,8 @@ func NewOSPipeline(m *Manifest, 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) } @@ -150,14 +144,12 @@ func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet { _ = p.PartitionTable.ForEachEntity(isLVM) if hasLVM { - // TODO: put this in the base packages instead - userPackages = append(userPackages, "lvm2") + packages = append(packages, "lvm2") } } if len(p.NTPServers) > 0 { - // TODO: move to base packages - userPackages = append(userPackages, "chrony") + packages = append(packages, "chrony") } chain := []rpmmd.PackageSet{ @@ -168,10 +160,9 @@ func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet { }, } - userPackages = append(userPackages, p.UserPackages...) - if len(userPackages) > 0 { + if len(p.UserPackages) > 0 { chain = append(chain, rpmmd.PackageSet{ - Include: userPackages, + Include: p.UserPackages, Repositories: append(p.repos, p.UserRepos...), }) }