mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +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
|
||||
func (l *PackageList) Search(dep Dependency, allMatches bool) []*Package {
|
||||
func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*Package) {
|
||||
if !l.indexed {
|
||||
panic("list not indexed, can't search")
|
||||
}
|
||||
|
||||
searchResults := []*Package{}
|
||||
|
||||
if dep.Relation == VersionDontCare {
|
||||
for _, p := range l.providesIndex[dep.Pkg] {
|
||||
if p.MatchesArchitecture(dep.Architecture) {
|
||||
@@ -352,7 +350,7 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) []*Package {
|
||||
}
|
||||
}
|
||||
if len(searchResults) != 0 {
|
||||
return searchResults
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,11 +369,7 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) []*Package {
|
||||
i++
|
||||
}
|
||||
|
||||
if len(searchResults) != 0 {
|
||||
return searchResults
|
||||
}
|
||||
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
// Filter filters package index by specified queries (ORed together), possibly pulling dependencies
|
||||
|
||||
Reference in New Issue
Block a user