allow to exclude provided packages from list.Search

This commit is contained in:
André Roth
2024-11-04 16:04:00 +01:00
parent 74364544c2
commit eafec74c29
7 changed files with 61 additions and 58 deletions

View File

@@ -20,7 +20,7 @@ type PackageLike interface {
// PackageCatalog is abstraction on top of PackageCollection and PackageList
type PackageCatalog interface {
Scan(q PackageQuery) (result *PackageList)
Search(dep Dependency, allMatches bool) (searchResults []*Package)
Search(dep Dependency, allMatches bool, searchProvided bool) (searchResults []*Package)
SearchSupported() bool
SearchByKey(arch, name, version string) (result *PackageList)
}
@@ -244,7 +244,7 @@ func (q *DependencyQuery) Fast(list PackageCatalog) bool {
func (q *DependencyQuery) Query(list PackageCatalog) (result *PackageList) {
if q.Fast(list) {
result = NewPackageList()
for _, pkg := range list.Search(q.Dep, true) {
for _, pkg := range list.Search(q.Dep, true, true) {
result.Add(pkg)
}
} else {