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
|
|
@ -81,12 +81,12 @@ func TestCrossArchDepsolve(t *testing.T) {
|
|||
imgType, err := arch.GetImageType(imgTypeStr)
|
||||
require.NoError(t, err)
|
||||
|
||||
packages := imgType.PackageSets(blueprint.Blueprint{})
|
||||
packages := imgType.PackageSets(blueprint.Blueprint{}, repos[archStr])
|
||||
|
||||
_, err = solver.Depsolve([]rpmmd.PackageSet{packages["build"]}, repos[archStr])
|
||||
_, err = solver.Depsolve(packages["build"])
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = solver.Depsolve([]rpmmd.PackageSet{packages["packages"]}, repos[archStr])
|
||||
_, err = solver.Depsolve(packages["packages"])
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
}
|
||||
|
|
@ -125,11 +125,11 @@ func TestDepsolvePackageSets(t *testing.T) {
|
|||
qcow2Image, err := x86Arch.GetImageType(qcow2ImageTypeName)
|
||||
require.Nilf(t, err, "failed to get %q image type of %q/%q distro/arch", qcow2ImageTypeName, distroStruct.Name(), distro.X86_64ArchName)
|
||||
|
||||
imagePkgSets := qcow2Image.PackageSets(blueprint.Blueprint{Packages: []blueprint.Package{{Name: "bind"}}})
|
||||
imagePkgSets := qcow2Image.PackageSets(blueprint.Blueprint{Packages: []blueprint.Package{{Name: "bind"}}}, x86Repos)
|
||||
imagePkgSetChains := qcow2Image.PackageSetsChains()
|
||||
require.NotEmptyf(t, imagePkgSetChains, "the %q image has no package set chains defined", qcow2ImageTypeName)
|
||||
|
||||
expectedPackageSpecsSetNames := func(pkgSets map[string]rpmmd.PackageSet, pkgSetChains map[string][]string) []string {
|
||||
expectedPackageSpecsSetNames := func(pkgSets map[string][]rpmmd.PackageSet, pkgSetChains map[string][]string) []string {
|
||||
expectedPkgSpecsSetNames := make([]string, 0, len(pkgSets))
|
||||
chainPkgSets := make(map[string]struct{}, len(pkgSets))
|
||||
for name, pkgSetChain := range pkgSetChains {
|
||||
|
|
@ -148,29 +148,14 @@ func TestDepsolvePackageSets(t *testing.T) {
|
|||
}(imagePkgSets, imagePkgSetChains)
|
||||
|
||||
gotPackageSpecsSets := make(map[string]*dnfjson.DepsolveResult, len(imagePkgSets))
|
||||
// first depsolve package sets that are part of a chain
|
||||
for specName, setNames := range imagePkgSetChains {
|
||||
pkgSets := make([]rpmmd.PackageSet, len(setNames))
|
||||
for idx, pkgSetName := range setNames {
|
||||
pkgSets[idx] = imagePkgSets[pkgSetName]
|
||||
delete(imagePkgSets, pkgSetName) // will be depsolved here: remove from map
|
||||
}
|
||||
res, err := solver.Depsolve(pkgSets, x86Repos)
|
||||
if err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
gotPackageSpecsSets[specName] = res
|
||||
}
|
||||
|
||||
// depsolve the rest of the package sets
|
||||
for name, pkgSet := range imagePkgSets {
|
||||
res, err := solver.Depsolve([]rpmmd.PackageSet{pkgSet}, x86Repos)
|
||||
res, err := solver.Depsolve(pkgSet)
|
||||
if err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
gotPackageSpecsSets[name] = res
|
||||
}
|
||||
require.Nil(t, err)
|
||||
require.EqualValues(t, len(expectedPackageSpecsSetNames), len(gotPackageSpecsSets))
|
||||
for _, name := range expectedPackageSpecsSetNames {
|
||||
_, ok := gotPackageSpecsSets[name]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue