unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction.
@ 2020-09-02 17:20 Maxim Cournoyer
  2020-09-02 17:22 ` [bug#43170] [PATCH 2/2] ui: Lexicographically sort transaction entries based on their package name Maxim Cournoyer
  2020-09-04  8:47 ` [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Maxim Cournoyer @ 2020-09-02 17:20 UTC (permalink / raw)
  To: 43170; +Cc: Maxim Cournoyer

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 3957 bytes --]

* guix/ui.scm (show-manifest-transaction)[package-strings]: Add an
OLD-VERSIONS keyword parameter.  Absorb the code path previously found in the
upgrade-string.  Remove upgrade-string.
(show-manifest-transaction): Adjust to the above changes.
---
 guix/ui.scm | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index efc3f39186..01af3d93d3 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1232,31 +1233,24 @@ separator between subsequent columns."
 (define* (show-manifest-transaction store manifest transaction
                                     #:key dry-run?)
   "Display what will/would be installed/removed from MANIFEST by TRANSACTION."
-  (define (package-strings names versions outputs)
+  (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)
-                   versions)
-              #:initial-indent 3))
-
-  (define →                        ;an arrow that can be represented on stderr
-    (right-arrow (current-error-port)))
-
-  (define (upgrade-string names old-version new-version outputs)
-    (tabulate (zip (map (lambda (name output)
-                          (if (string=? output "out")
-                              name
-                              (string-append name ":" output)))
-                        names outputs)
-                   (map (lambda (old new)
+                   (if old-versions
+                       (map (lambda (old new)
                           (if (string=? old new)
                               (G_ "(dependencies or package changed)")
                               (string-append old " " → " " new)))
-                        old-version new-version))
+                            old-versions versions)
+                       versions))
               #:initial-indent 3))
 
+  (define →                        ;an arrow that can be represented on stderr
+    (right-arrow (current-error-port)))
+
   (let-values (((remove install upgrade downgrade)
                 (manifest-transaction-effects manifest transaction)))
     (match remove
@@ -1279,8 +1273,8 @@ separator between subsequent columns."
       (((($ <manifest-entry> name old-version)
          . ($ <manifest-entry> _ new-version output item)) ..1)
        (let ((len       (length name))
-             (downgrade (upgrade-string name old-version new-version
-                                        output)))
+             (downgrade (package-strings name new-version output
+                                         #:old-versions old-version)))
          (if dry-run?
              (format (current-error-port)
                      (N_ "The following package would be downgraded:~%~{~a~%~}~%"
@@ -1297,9 +1291,8 @@ separator between subsequent columns."
       (((($ <manifest-entry> name old-version)
          . ($ <manifest-entry> _ new-version output item)) ..1)
        (let ((len     (length name))
-             (upgrade (upgrade-string name
-                                      old-version new-version
-                                      output)))
+             (upgrade (package-strings name new-version output
+                                       #:old-versions old-version)))
          (if dry-run?
              (format (current-error-port)
                      (N_ "The following package would be upgraded:~%~{~a~%~}~%"
-- 
2.27.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#43170] [PATCH 2/2] ui: Lexicographically sort transaction entries based on their package name.
  2020-09-02 17:20 [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction Maxim Cournoyer
@ 2020-09-02 17:22 ` Maxim Cournoyer
       [not found]   ` <handler.43171.B.159906734217257.ack@debbugs.gnu.org>
  2020-09-04  8:47 ` [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction Ludovic Courtès
  1 sibling, 1 reply; 4+ messages in thread
From: Maxim Cournoyer @ 2020-09-02 17:22 UTC (permalink / raw)
  To: 43170; +Cc: Maxim Cournoyer

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 2052 bytes --]

* 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(-)

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
-- 
2.27.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#43171: Acknowledgement ([PATCH 2/2] ui: Lexicographically sort transaction entries based on their package name.)
       [not found]   ` <handler.43171.B.159906734217257.ack@debbugs.gnu.org>
@ 2020-09-02 17:25     ` Maxim Cournoyer
  0 siblings, 0 replies; 4+ messages in thread
From: Maxim Cournoyer @ 2020-09-02 17:25 UTC (permalink / raw)
  To: GNU bug Tracking System; +Cc: 43171-done

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction.
  2020-09-02 17:20 [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction Maxim Cournoyer
  2020-09-02 17:22 ` [bug#43170] [PATCH 2/2] ui: Lexicographically sort transaction entries based on their package name Maxim Cournoyer
@ 2020-09-04  8:47 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2020-09-04  8:47 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 43170

Hi!

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> * guix/ui.scm (show-manifest-transaction)[package-strings]: Add an
> OLD-VERSIONS keyword parameter.  Absorb the code path previously found in the
> upgrade-string.  Remove upgrade-string.
> (show-manifest-transaction): Adjust to the above changes.

[...]

> * guix/ui.scm (show-manifest-transaction): Sort entries to be displayed in a
> tabulated view.

LGTM, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-04  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02 17:20 [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction Maxim Cournoyer
2020-09-02 17:22 ` [bug#43170] [PATCH 2/2] ui: Lexicographically sort transaction entries based on their package name Maxim Cournoyer
     [not found]   ` <handler.43171.B.159906734217257.ack@debbugs.gnu.org>
2020-09-02 17:25     ` bug#43171: Acknowledgement ([PATCH 2/2] ui: Lexicographically sort transaction entries based on their package name.) Maxim Cournoyer
2020-09-04  8:47 ` [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).