mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Merge branch 'deterministic_package_search' of https://github.com/simonaquino/aptly into simonaquino-deterministic_package_search
This commit is contained in:
11
deb/list.go
11
deb/list.go
@@ -300,9 +300,16 @@ func (l *PackageList) Swap(i, j int) {
|
||||
l.packagesIndex[i], l.packagesIndex[j] = l.packagesIndex[j], l.packagesIndex[i]
|
||||
}
|
||||
|
||||
// Compare compares two names in lexographical order
|
||||
// Compare compares two packages by name (lexographical) and version (latest to oldest)
|
||||
func (l *PackageList) Less(i, j int) bool {
|
||||
return l.packagesIndex[i].Name < l.packagesIndex[j].Name
|
||||
iPkg := l.packagesIndex[i]
|
||||
jPkg := l.packagesIndex[j]
|
||||
|
||||
if iPkg.Name == jPkg.Name {
|
||||
return CompareVersions(iPkg.Version, jPkg.Version) == 1
|
||||
}
|
||||
|
||||
return iPkg.Name < jPkg.Name
|
||||
}
|
||||
|
||||
// PrepareIndex prepares list for indexing
|
||||
|
||||
Reference in New Issue
Block a user