guix-commits
[Top][All Lists]
Advanced

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

03/09: pull: Move profile comparison to 'new/upgraded-packages'.


From: guix-commits
Subject: 03/09: pull: Move profile comparison to 'new/upgraded-packages'.
Date: Tue, 12 Feb 2019 17:30:34 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit cf0eacceb46492515431fec6bcf25b750b7d402d
Author: Ludovic Courtès <address@hidden>
Date:   Tue Feb 12 22:35:28 2019 +0100

    pull: Move profile comparison to 'new/upgraded-packages'.
    
    * guix/scripts/pull.scm (new/upgraded-packages): New procedure, with
    code formerly in 'display-new/upgraded-packages'.
    (display-new/upgraded-packages): Use it.
---
 guix/scripts/pull.scm | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index a1d2740..408ff91 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -45,6 +45,7 @@
                 #:select (%bootstrap-guile))
   #:use-module ((gnu packages certs) #:select (le-certs))
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
@@ -346,11 +347,10 @@ way and displaying details about the channel's source 
code."
       (close-inferior inferior)
       packages)))
 
-(define* (display-new/upgraded-packages alist1 alist2
-                                        #:key (heading ""))
-  "Given the two package name/version alists ALIST1 and ALIST2, display the
-list of new and upgraded packages going from ALIST1 to ALIST2.  When ALIST1
-and ALIST2 differ, display HEADING upfront."
+(define (new/upgraded-packages alist1 alist2)
+  "Compare ALIST1 and ALIST2, both of which are lists of package name/version
+pairs, and return two values: the list of packages new in ALIST2, and the list
+of packages upgraded in ALIST2."
   (let* ((old      (fold (match-lambda*
                            (((name . version) table)
                             (vhash-cons name version table)))
@@ -370,6 +370,14 @@ and ALIST2 differ, display HEADING upfront."
                                           (string-append name "@"
                                                          new-version))))))
                                alist2)))
+    (values new upgraded)))
+
+(define* (display-new/upgraded-packages alist1 alist2
+                                        #:key (heading ""))
+  "Given the two package name/version alists ALIST1 and ALIST2, display the
+list of new and upgraded packages going from ALIST1 to ALIST2.  When ALIST1
+and ALIST2 differ, display HEADING upfront."
+  (let-values (((new upgraded) (new/upgraded-packages alist1 alist2)))
     (unless (and (null? new) (null? upgraded))
       (display heading))
 



reply via email to

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