Change the rpmmd cache directory structure to include the distro name
This causes dnf-json to use separate caches, allowing them to run in parallel, with one lock per distribution. Multiple depsolves with the same distribution in the blueprint will continue to be serial.
This commit is contained in:
parent
2ab0430d5d
commit
3481e1d3ba
10 changed files with 47 additions and 24 deletions
|
|
@ -245,7 +245,7 @@ func resolveContainers(containers []blueprint.Container, archName string) ([]con
|
|||
}
|
||||
|
||||
func depsolve(cacheDir string, imageType distro.ImageType, bp blueprint.Blueprint, options distro.ImageOptions, repos []rpmmd.RepoConfig, d distro.Distro, arch string) (map[string][]rpmmd.PackageSpec, error) {
|
||||
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), arch, cacheDir)
|
||||
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), arch, d.Name(), cacheDir)
|
||||
solver.SetDNFJSONPath("./dnf-json")
|
||||
packageSets := imageType.PackageSets(bp, options, repos)
|
||||
depsolvedSets := make(map[string][]rpmmd.PackageSpec)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func TestCrossArchDepsolve(t *testing.T) {
|
|||
t.Run(archStr, func(t *testing.T) {
|
||||
arch, err := cs9.GetArch(archStr)
|
||||
require.NoError(t, err)
|
||||
solver := baseSolver.NewWithConfig(cs9.ModulePlatformID(), cs9.Releasever(), archStr)
|
||||
solver := baseSolver.NewWithConfig(cs9.ModulePlatformID(), cs9.Releasever(), archStr, cs9.Name())
|
||||
for _, imgTypeStr := range arch.ListImageTypes() {
|
||||
t.Run(imgTypeStr, func(t *testing.T) {
|
||||
imgType, err := arch.GetImageType(imgTypeStr)
|
||||
|
|
@ -75,7 +75,7 @@ func TestDepsolvePackageSets(t *testing.T) {
|
|||
|
||||
// Set up temporary directory for rpm/dnf cache
|
||||
dir := t.TempDir()
|
||||
solver := dnfjson.NewSolver(cs9.ModulePlatformID(), cs9.Releasever(), distro.X86_64ArchName, dir)
|
||||
solver := dnfjson.NewSolver(cs9.ModulePlatformID(), cs9.Releasever(), distro.X86_64ArchName, cs9.Name(), dir)
|
||||
|
||||
repos, err := rpmmd.LoadRepositories([]string{repoDir}, cs9.Name())
|
||||
require.NoErrorf(t, err, "Failed to LoadRepositories %v", cs9.Name())
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ func main() {
|
|||
panic("os.UserHomeDir(): " + err.Error())
|
||||
}
|
||||
|
||||
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), arch.Name(), path.Join(home, ".cache/osbuild-composer/rpmmd"))
|
||||
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), arch.Name(), d.Name(), path.Join(home, ".cache/osbuild-composer/rpmmd"))
|
||||
solver.SetDNFJSONPath(findDnfJsonBin())
|
||||
|
||||
// Set cache size to 3 GiB
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import (
|
|||
|
||||
func RunPlayground(img image.ImageKind, d distro.Distro, arch distro.Arch, repos map[string][]rpmmd.RepoConfig, state_dir string) {
|
||||
|
||||
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), arch.Name(), path.Join(state_dir, "rpmmd"))
|
||||
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), arch.Name(), d.Name(), path.Join(state_dir, "rpmmd"))
|
||||
solver.SetDNFJSONPath(findDnfJsonBin())
|
||||
|
||||
// Set cache size to 3 GiB
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import (
|
|||
func getManifest(bp blueprint.Blueprint, t distro.ImageType, a distro.Arch, d distro.Distro, cacheDir string, repos []rpmmd.RepoConfig) (distro.Manifest, []rpmmd.PackageSpec) {
|
||||
packageSets := t.PackageSets(bp, distro.ImageOptions{}, repos)
|
||||
pkgSpecSets := make(map[string][]rpmmd.PackageSpec)
|
||||
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), a.Name(), cacheDir)
|
||||
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), a.Name(), d.Name(), cacheDir)
|
||||
for name, packages := range packageSets {
|
||||
res, err := solver.Depsolve(packages)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ type DepsolveJobImpl struct {
|
|||
// packageSetsRepos are only used for the package set with the same name
|
||||
// (matching map keys).
|
||||
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)
|
||||
solver := impl.Solver.NewWithConfig(modulePlatformID, releasever, arch, "")
|
||||
|
||||
depsolvedSets := make(map[string][]rpmmd.PackageSpec)
|
||||
for name, pkgSet := range packageSets {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue