summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-09-02 13:08:46 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-09-12 02:08:14 -0400
commit140da556be06442192fbae5e2a07357f26fbc26b (patch)
tree13f95cc5b91059c1de652cd68f54349a88474bd2
parent7d3eb5e6b7404d7a481a67cb2f97b68d347c047f (diff)
downloadguix-140da556be06442192fbae5e2a07357f26fbc26b.tar.gz
ui: Lexicographically sort transaction entries based on their package name.
* guix/ui.scm (show-manifest-transaction): Sort entries to be displayed in a
tabulated view.
-rw-r--r--guix/ui.scm27
1 files changed, 15 insertions, 12 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 9c641afe3e..115d9801b2 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1240,18 +1240,21 @@ separator between subsequent columns."
                                     #:key dry-run?)
   "Display what will/would be installed/removed from MANIFEST by TRANSACTION."
   (define* (package-strings names versions outputs #:key old-versions)
-    (tabulate (zip (map (lambda (name output)
-                          (if (string=? output "out")
-                              name
-                              (string-append name ":" output)))
-                        names outputs)
-                   (if old-versions
-                       (map (lambda (old new)
-                          (if (string=? old new)
-                              (G_ "(dependencies or package changed)")
-                              (string-append old " " → " " new)))
-                            old-versions versions)
-                       versions))
+    (tabulate (stable-sort
+               (zip (map (lambda (name output)
+                           (if (string=? output "out")
+                               name
+                               (string-append name ":" output)))
+                         names outputs)
+                    (if old-versions
+                        (map (lambda (old new)
+                               (if (string=? old new)
+                                   (G_ "(dependencies or package changed)")
+                                   (string-append old " " → " " new)))
+                             old-versions versions)
+                        versions))
+               (lambda (x y)
+                 (string<? (first x) (first y))))
               #:initial-indent 3))
 
   (define →                        ;an arrow that can be represented on stderr