import: github: Sort releases before picking the latest one.

* guix/import/github.scm (latest-released-version): Sort releases before
picking the first one as the latest.
This commit is contained in:
Arun Isaac 2019-05-14 15:46:19 +05:30
parent c558772b0f
commit 06c7b1f614
No known key found for this signature in database
GPG Key ID: 2E25EE8B61802BB3
1 changed files with 7 additions and 4 deletions

View File

@ -206,10 +206,13 @@ API when using a GitHub token")
API. This may be fixed by using an access token and setting the environment
variable GUIX_GITHUB_TOKEN, for instance one procured from
https://github.com/settings/tokens"))
(any release->version
(match (remove pre-release? json)
(() json) ; keep everything
(releases releases))))))
(match (sort (filter-map release->version
(match (remove pre-release? json)
(() json) ; keep everything
(releases releases)))
version>?)
((latest-release . _) latest-release)
(() #f)))))
(define (latest-release pkg)
"Return an <upstream-source> for the latest release of PKG."