Skip to content

Commit 1c44b4f

Browse files
authored
Merge pull request #643 from smira/618-prefer-exact-match
Prefer exact match on package name over provides match
2 parents 325d391 + 6d2f265 commit 1c44b4f

4 files changed

Lines changed: 15 additions & 12 deletions

File tree

deb/list.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,18 +441,6 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*
441441
panic("list not indexed, can't search")
442442
}
443443

444-
if dep.Relation == VersionDontCare {
445-
for _, p := range l.providesIndex[dep.Pkg] {
446-
if dep.Architecture == "" || p.MatchesArchitecture(dep.Architecture) {
447-
searchResults = append(searchResults, p)
448-
449-
if !allMatches {
450-
break
451-
}
452-
}
453-
}
454-
}
455-
456444
i := sort.Search(len(l.packagesIndex), func(j int) bool { return l.packagesIndex[j].Name >= dep.Pkg })
457445

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

459+
if dep.Relation == VersionDontCare {
460+
for _, p := range l.providesIndex[dep.Pkg] {
461+
if dep.Architecture == "" || p.MatchesArchitecture(dep.Architecture) {
462+
searchResults = append(searchResults, p)
463+
464+
if !allMatches {
465+
break
466+
}
467+
}
468+
}
469+
}
470+
471471
return
472472
}
473473

system/t04_mirror/SearchMirror4Test_gold

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
8585
tar_1.26+dfsg-0.1_i386
8686
ttf-bitstream-vera_1.10-8_all
8787
ttf-dejavu-core_2.33-3_all
88+
ttf-freefont_20120503-1_all
8889
ucf_3.0025+nmu3_all
8990
x11-common_1:7.7+3~deb7u1_all
9091
xfonts-encodings_1:1.0.4-1_all

system/t05_snapshot/SearchSnapshot4Test_gold

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
8585
tar_1.26+dfsg-0.1_i386
8686
ttf-bitstream-vera_1.10-8_all
8787
ttf-dejavu-core_2.33-3_all
88+
ttf-freefont_20120503-1_all
8889
ucf_3.0025+nmu3_all
8990
x11-common_1:7.7+3~deb7u1_all
9091
xfonts-encodings_1:1.0.4-1_all

system/t09_repo/SearchRepo4Test_gold

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
8585
tar_1.26+dfsg-0.1_i386
8686
ttf-bitstream-vera_1.10-8_all
8787
ttf-dejavu-core_2.33-3_all
88+
ttf-freefont_20120503-1_all
8889
ucf_3.0025+nmu3_all
8990
x11-common_1:7.7+3~deb7u1_all
9091
xfonts-encodings_1:1.0.4-1_all

0 commit comments

Comments
 (0)