rpmmd: sort fetched package list

When dnf-json dumps the packages from the repos passed to it, it does
not sort the packages. In order to properly list and search the
packages, the package list is now sorted before being returned by the
FetchPackageList function.
This commit is contained in:
Jacob Kozol 2019-11-11 19:26:09 +01:00 committed by Ondřej Budai
parent 41a2ef9b9a
commit 11eb0b5226

View file

@ -86,6 +86,9 @@ func FetchPackageList(repos []RepoConfig) (PackageList, error) {
}{repos}
var packages PackageList
err := runDNF("dump", arguments, &packages)
sort.Slice(packages, func(i, j int) bool {
return packages[i].Name < packages[j].Name
})
return packages, err
}