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

View file

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