Skip repository if no candidate is found

FindPackageCandidate is idempotent and returns the same definition if no new is found.
This prevents installs from multiple-repos
This commit is contained in:
Ettore Di Giacinto
2020-02-17 17:20:52 +01:00
parent 26b94888c3
commit dd00d491b9

View File

@@ -530,14 +530,21 @@ func (re Repositories) ResolveSelectors(p []pkg.Package) []pkg.Package {
var matches []pkg.Package
PACKAGE:
for _, pack := range p {
REPOSITORY:
for _, r := range re {
if pack.IsSelector() {
c, err := r.GetTree().GetDatabase().FindPackageCandidate(pack)
// If FindPackageCandidate returns the same package, it means it couldn't find one.
// Skip this repository and keep looking.
if c.String() == pack.String() {
continue REPOSITORY
}
if err == nil {
matches = append(matches, c)
continue PACKAGE
}
} else {
// If it's not a selector, just append it
matches = append(matches, pack)
}
}