Move cleaning up old dnfjson cache dirs from composer to Weldr API

Previously, the old dnfjson cache dirs for unsupported distributions
were deleted in the osbuild-composer binary on startup. This is no
longer possible, since the supported distros are determined by loading
available repositories. Loading repositories happens in the Weldr API
constructor. Move the cleanup code there.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-01-09 21:50:21 +01:00 committed by Achilleas Koutsou
parent 625b1578fa
commit fb1b27c0ef
3 changed files with 18 additions and 4 deletions

View file

@ -70,10 +70,6 @@ func NewComposer(config *ComposerConfigFile, stateDir, cacheDir string) (*Compos
c.distros = distrofactory.NewDefault()
// TODO: Move this to Weldr API initialization
// Clean up the cache, removes unknown distros and files
// dnfjson.CleanupOldCacheDirs(path.Join(c.cacheDir, "rpmmd"), c.distros.List())
c.solver = dnfjson.NewBaseSolver(path.Join(c.cacheDir, "rpmmd"))
c.solver.SetDNFJSONPath(c.config.DNFJson)