simplify package set chain handling
Move package set chain collation to the distro package and add repositories to the package sets while returning the package sets from their source, i.e., the ImageType.PackageSets() method. This also removes the concept of "base repositories". There are no longer repositories that are added implicitly to all package sets but instead each package set needs to specify *all* the repositories it will be depsolved against. This paves the way for the requirement we have for building RHEL 7 images with a RHEL 8 build root. The build root package set has to be depsolved against RHEL 8 repositories without any "base repos" included. This is now possible since package sets and repositories are explicitly associated from the start and there is no implicit global repository set. The change requires adding a list of PackageSet names to the core rpmmd.RepoConfig. In the cloud API, repositories that are limited to specific package sets already contain the correct package set names and these are now copied to the internal RepoConfig when converting types in genRepoConfig(). The user-specified repositories are only associated with the payload package sets like before.
This commit is contained in:
parent
6fbddeea35
commit
c092783a70
33 changed files with 323 additions and 401 deletions
|
|
@ -19,29 +19,12 @@ type DepsolveJobImpl struct {
|
|||
// in repos are used for all package sets, whereas the repositories in
|
||||
// packageSetsRepos are only used for the package set with the same name
|
||||
// (matching map keys).
|
||||
func (impl *DepsolveJobImpl) depsolve(packageSetsChains map[string][]string, packageSets map[string]rpmmd.PackageSet, repos []rpmmd.RepoConfig, packageSetsRepos map[string][]rpmmd.RepoConfig, modulePlatformID, arch, releasever string) (map[string][]rpmmd.PackageSpec, error) {
|
||||
func (impl *DepsolveJobImpl) depsolve(packageSets map[string][]rpmmd.PackageSet, modulePlatformID, arch, releasever string) (map[string][]rpmmd.PackageSpec, error) {
|
||||
solver := impl.Solver.NewWithConfig(modulePlatformID, releasever, arch)
|
||||
|
||||
depsolvedSets := make(map[string][]rpmmd.PackageSpec)
|
||||
// first depsolve package sets that are part of a chain
|
||||
for specName, setNames := range packageSetsChains {
|
||||
pkgSets := make([]rpmmd.PackageSet, len(setNames))
|
||||
for idx, pkgSetName := range setNames {
|
||||
pkgSets[idx] = packageSets[pkgSetName]
|
||||
pkgSets[idx].Repositories = packageSetsRepos[pkgSetName]
|
||||
delete(packageSets, pkgSetName) // will be depsolved here: remove from map
|
||||
}
|
||||
res, err := solver.Depsolve(pkgSets, repos)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
depsolvedSets[specName] = res.Dependencies
|
||||
}
|
||||
|
||||
// depsolve the rest of the package sets
|
||||
for name, pkgSet := range packageSets {
|
||||
pkgSet.Repositories = packageSetsRepos[name]
|
||||
res, err := solver.Depsolve([]rpmmd.PackageSet{pkgSet}, repos)
|
||||
res, err := solver.Depsolve(pkgSet)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -59,7 +42,7 @@ func (impl *DepsolveJobImpl) Run(job worker.Job) error {
|
|||
}
|
||||
|
||||
var result worker.DepsolveJobResult
|
||||
result.PackageSpecs, err = impl.depsolve(args.PackageSetsChains, args.PackageSets, args.Repos, args.PackageSetsRepos, args.ModulePlatformID, args.Arch, args.Releasever)
|
||||
result.PackageSpecs, err = impl.depsolve(args.PackageSets, args.ModulePlatformID, args.Arch, args.Releasever)
|
||||
if err != nil {
|
||||
switch e := err.(type) {
|
||||
case *dnfjson.Error:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue