diff mbox series

[bug#43170,2/2] ui: Lexicographically sort transaction entries based on their package name.

Message ID 20200902172216.3813-1-maxim.cournoyer@gmail.com
State Accepted
Headers show
Series [bug#43170,1/2] ui: Refactor the package-strings helper in show-manifest-transaction. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Maxim Cournoyer Sept. 2, 2020, 5:22 p.m. UTC
* guix/ui.scm (show-manifest-transaction): Sort entries to be displayed in a
tabulated view.
---
 guix/ui.scm | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

Comments

Maxim Cournoyer Sept. 2, 2020, 5:25 p.m. UTC | #1
help-debbugs@gnu.org (GNU bug Tracking System) writes:

> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
>  guix-patches@gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 43171@debbugs.gnu.org.
>
> Please do not send mail to help-debbugs@gnu.org unless you wish
> to report a problem with the Bug-tracking system.

Closing, this was meant to be sent to 43170.

Maxim
diff mbox series

Patch

diff --git a/guix/ui.scm b/guix/ui.scm
index 01af3d93d3..e0d1dc1bb7 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1234,18 +1234,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