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.
This commit is contained in:
Tom Gundersen 2022-07-06 00:48:18 +01:00
parent c296b666cf
commit 1e03627447

View file

@ -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...),
})
}