summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac <arunisaac@systemreboot.net>2019-05-14 15:46:19 +0530
committerArun Isaac <arunisaac@systemreboot.net>2019-05-15 13:29:50 +0530
commit06c7b1f61446d44784cc137ebf7c2588f71c995b (patch)
tree2beffb7095d7f80a5cb7d1c5adf6daa8c1e71d0b
parentc558772b0f39b38f8aeed8f95041c466ace8f6cb (diff)
downloadguix-06c7b1f61446d44784cc137ebf7c2588f71c995b.tar.gz
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.
-rw-r--r--guix/import/github.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/guix/import/github.scm b/guix/import/github.scm
index 5f4d9c7267..cdac70420a 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -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."