guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/05: import: gnome: Update for Guile-JSON 3.x.


From: guix-commits
Subject: 01/05: import: gnome: Update for Guile-JSON 3.x.
Date: Sat, 17 Aug 2019 17:18:25 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 8d64ef567f816d29a4b25fe1cfbeb8005dc7cc2e
Author: Ludovic Courtès <address@hidden>
Date:   Sat Aug 17 22:13:30 2019 +0200

    import: gnome: Update for Guile-JSON 3.x.
    
    This is a followup to 81c3dc32244a17241d74eea9fa265edfcb326f6d.
    
    * guix/import/gnome.scm (jsonish->upstream-source): Use 'assoc-ref'
    instead of 'hash-ref'.
    (latest-gnome-release): Match a vector containing an alist, not a hash
    table.  Use 'fold' instead of 'hash-fold' over RELEASES.
---
 guix/import/gnome.scm | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm
index 1ade63e..436ec88 100644
--- a/guix/import/gnome.scm
+++ b/guix/import/gnome.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2017, 2019 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,7 +46,7 @@ source for metadata."
       (package name)
       (version version)
       (urls (filter-map (lambda (extension)
-                          (match (hash-ref dictionary extension)
+                          (match (assoc-ref dictionary extension)
                             (#f
                              #f)
                             ((? string? relative-url)
@@ -86,21 +86,22 @@ not be determined."
            (json (json->scm port)))
       (close-port port)
       (match json
-        ((4 (? hash-table? releases) _ ...)
-         (let* ((releases (hash-ref releases upstream-name))
-                (latest   (hash-fold (lambda (key value result)
-                                       (cond ((even-minor-version? key)
-                                              (match result
-                                                (#f
-                                                 (cons key value))
-                                                ((newest . _)
-                                                 (if (version>? key newest)
-                                                     (cons key value)
-                                                     result))))
-                                             (else
-                                              result)))
-                                     #f
-                                     releases)))
+        (#(4 releases _ ...)
+         (let* ((releases (assoc-ref releases upstream-name))
+                (latest   (fold (match-lambda*
+                                  (((key . value) result)
+                                   (cond ((even-minor-version? key)
+                                          (match result
+                                            (#f
+                                             (cons key value))
+                                            ((newest . _)
+                                             (if (version>? key newest)
+                                                 (cons key value)
+                                                 result))))
+                                         (else
+                                          result))))
+                                #f
+                                releases)))
            (and latest
                 (jsonish->upstream-source upstream-name latest))))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]