Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer exact match on package name over provides match #643

Merged
merged 1 commit into from
Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions deb/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,18 +441,6 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*
panic("list not indexed, can't search")
}

if dep.Relation == VersionDontCare {
for _, p := range l.providesIndex[dep.Pkg] {
if dep.Architecture == "" || p.MatchesArchitecture(dep.Architecture) {
searchResults = append(searchResults, p)

if !allMatches {
break
}
}
}
}

i := sort.Search(len(l.packagesIndex), func(j int) bool { return l.packagesIndex[j].Name >= dep.Pkg })

for i < len(l.packagesIndex) && l.packagesIndex[i].Name == dep.Pkg {
Expand All @@ -468,6 +456,18 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*
i++
}

if dep.Relation == VersionDontCare {
for _, p := range l.providesIndex[dep.Pkg] {
if dep.Architecture == "" || p.MatchesArchitecture(dep.Architecture) {
searchResults = append(searchResults, p)

if !allMatches {
break
}
}
}
}

return
}

Expand Down
1 change: 1 addition & 0 deletions system/t04_mirror/SearchMirror4Test_gold
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
tar_1.26+dfsg-0.1_i386
ttf-bitstream-vera_1.10-8_all
ttf-dejavu-core_2.33-3_all
ttf-freefont_20120503-1_all
ucf_3.0025+nmu3_all
x11-common_1:7.7+3~deb7u1_all
xfonts-encodings_1:1.0.4-1_all
Expand Down
1 change: 1 addition & 0 deletions system/t05_snapshot/SearchSnapshot4Test_gold
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
tar_1.26+dfsg-0.1_i386
ttf-bitstream-vera_1.10-8_all
ttf-dejavu-core_2.33-3_all
ttf-freefont_20120503-1_all
ucf_3.0025+nmu3_all
x11-common_1:7.7+3~deb7u1_all
xfonts-encodings_1:1.0.4-1_all
Expand Down
1 change: 1 addition & 0 deletions system/t09_repo/SearchRepo4Test_gold
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
tar_1.26+dfsg-0.1_i386
ttf-bitstream-vera_1.10-8_all
ttf-dejavu-core_2.33-3_all
ttf-freefont_20120503-1_all
ucf_3.0025+nmu3_all
x11-common_1:7.7+3~deb7u1_all
xfonts-encodings_1:1.0.4-1_all
Expand Down