mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-07 22:20:24 +00:00
Refactoring: simplification. #70
This commit is contained in:
+3
-9
@@ -334,13 +334,11 @@ func (l *PackageList) PrepareIndex() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search searches package index for specified package
|
// Search searches package index for specified package
|
||||||
func (l *PackageList) Search(dep Dependency, allMatches bool) []*Package {
|
func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*Package) {
|
||||||
if !l.indexed {
|
if !l.indexed {
|
||||||
panic("list not indexed, can't search")
|
panic("list not indexed, can't search")
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResults := []*Package{}
|
|
||||||
|
|
||||||
if dep.Relation == VersionDontCare {
|
if dep.Relation == VersionDontCare {
|
||||||
for _, p := range l.providesIndex[dep.Pkg] {
|
for _, p := range l.providesIndex[dep.Pkg] {
|
||||||
if p.MatchesArchitecture(dep.Architecture) {
|
if p.MatchesArchitecture(dep.Architecture) {
|
||||||
@@ -352,7 +350,7 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) []*Package {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(searchResults) != 0 {
|
if len(searchResults) != 0 {
|
||||||
return searchResults
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,11 +369,7 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) []*Package {
|
|||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(searchResults) != 0 {
|
return
|
||||||
return searchResults
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter filters package index by specified queries (ORed together), possibly pulling dependencies
|
// Filter filters package index by specified queries (ORed together), possibly pulling dependencies
|
||||||
|
|||||||
Reference in New Issue
Block a user