Move RepoRegistry setup into Composer

This is so that both the weldr and cloud api's can use it as the source
of their repositories.
This commit is contained in:
Brian C. Lane 2024-02-02 16:15:09 -08:00 committed by Brian C. Lane
parent f660ed65b6
commit b8967d53bc
3 changed files with 14 additions and 13 deletions

View file

@ -156,7 +156,7 @@ func NewTestAPI(solver *dnfjson.BaseSolver, rr *reporegistry.RepoRegistry,
return setupRouter(api)
}
func New(repoPaths []string, stateDir string, solver *dnfjson.BaseSolver, df *distrofactory.Factory,
func New(rr *reporegistry.RepoRegistry, stateDir string, solver *dnfjson.BaseSolver, df *distrofactory.Factory,
logger *log.Logger, workers *worker.Server, distrosImageTypeDenylist map[string][]string) (*API, error) {
if logger == nil {
logger = log.New(os.Stdout, "", 0)
@ -168,14 +168,6 @@ func New(repoPaths []string, stateDir string, solver *dnfjson.BaseSolver, df *di
}
hostArch := arch.Current().String()
rr, err := reporegistry.New(repoPaths)
if err != nil {
return nil, fmt.Errorf("error loading repository definitions: %v", err)
}
// Clean up the cache, removes unknown distros and files
solver.CleanupOldCacheDirs(rr.ListDistros())
hostDistro := df.GetDistro(hostDistroName)
if hostDistro != nil {
// get canonical distro name if the host distro is supported