all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 54000@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#54000] [PATCH 1/2] pull: '--news' no longer shows package lists.
Date: Mon, 14 Feb 2022 17:41:26 +0100	[thread overview]
Message-ID: <20220214164127.1248-1-ludo@gnu.org> (raw)
In-Reply-To: <20220214163838.1174-1-ludo@gnu.org>

* guix/scripts/pull.scm (display-channel-news): Return #t when news were
displayed.
(display-news): Remove call to 'display-profile-news'.  Print something
when there were no news.
(process-query): For 'display-news', call 'display-channel-news'
directly.
* doc/guix.texi (Invoking guix pull): Adjust accordingly.
---
 doc/guix.texi         | 10 ++---
 guix/scripts/pull.scm | 93 ++++++++++++++++++++++++-------------------
 2 files changed, 55 insertions(+), 48 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index a05f073c3d..534414ab8a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4486,13 +4486,11 @@ information.
 @cindex channel news
 @item --news
 @itemx -N
-Display the list of packages added or upgraded since the previous
-generation, as well as, occasionally, news written by channel authors
-for their users (@pxref{Channels, Writing Channel News}).
+Display news written by channel authors for their users for changes made
+since the previous generation (@pxref{Channels, Writing Channel News}).
 
-The package information is the same as displayed upon @command{guix
-pull} completion, but without ellipses; it is also similar to the output
-of @command{guix pull -l} for the last generation (see below).
+You can view that information for previous generations with
+@command{guix pull -l}.
 
 @item --list-generations[=@var{pattern}]
 @itemx -l [@var{pattern}]
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 205697b3bd..af1b27d7dd 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -352,45 +352,48 @@ (define* (display-channel-news profile
                                (previous
                                 (and=> (relative-generation profile -1)
                                        (cut generation-file-name profile <>))))
-  "Display news about the channels of PROFILE compared to PREVIOUS."
-  (when previous
-    (let ((old-channels (profile-channels previous))
-          (new-channels (profile-channels profile)))
-      (and (pair? old-channels) (pair? new-channels)
-           (begin
-             (match (lset-difference channel=? new-channels old-channels)
-               (()
-                #t)
-               (new
-                (let ((count (length new)))
-                  (format (current-error-port)
-                          (N_ "  ~a new channel:~%"
-                              "  ~a new channels:~%" count)
-                          count)
-                  (for-each display-channel new))))
-             (match (lset-difference channel=? old-channels new-channels)
-               (()
-                #t)
-               (removed
-                (let ((count (length removed)))
-                  (format (current-error-port)
-                          (N_ "  ~a channel removed:~%"
-                              "  ~a channels removed:~%" count)
-                          count)
-                  (for-each display-channel removed))))
+  "Display news about the channels of PROFILE compared to PREVIOUS.  Return
+true if news were displayed, false otherwise."
+  (and previous
+       (let ((old-channels (profile-channels previous))
+             (new-channels (profile-channels profile)))
+         (and (pair? old-channels) (pair? new-channels)
+              (begin
+                (match (lset-difference channel=? new-channels old-channels)
+                  (()
+                   #t)
+                  (new
+                   (let ((count (length new)))
+                     (format (current-error-port)
+                             (N_ "  ~a new channel:~%"
+                                 "  ~a new channels:~%" count)
+                             count)
+                     (for-each display-channel new))))
+                (match (lset-difference channel=? old-channels new-channels)
+                  (()
+                   #t)
+                  (removed
+                   (let ((count (length removed)))
+                     (format (current-error-port)
+                             (N_ "  ~a channel removed:~%"
+                                 "  ~a channels removed:~%" count)
+                             count)
+                     (for-each display-channel removed))))
 
-             ;; Display channel-specific news for those channels that were
-             ;; here before and are still around afterwards.
-             (for-each (match-lambda
-                         ((new old)
-                          (display-channel-specific-news new old)))
-                       (filter-map (lambda (new)
-                                     (define old
-                                       (find (cut channel=? new <>)
-                                             old-channels))
+                ;; Display channel-specific news for those channels that were
+                ;; here before and are still around afterwards.
+                (fold (match-lambda*
+                        (((new old) news?)
+                         (or (display-channel-specific-news new old)
+                             news?)))
+                      #f
+                      (filter-map (lambda (new)
+                                    (define old
+                                      (find (cut channel=? new <>)
+                                            old-channels))
 
-                                     (and old (list new old)))
-                                   new-channels)))))))
+                                    (and old (list new old)))
+                                  new-channels)))))))
 
 (define* (display-channel-news-headlines profile)
   "Display the titles of news about the channels of PROFILE compared to its
@@ -422,12 +425,18 @@ (define more?
              (any ->bool more?))))))
 
 (define (display-news profile)
-  ;; Display profile news, with the understanding that this process represents
-  ;; the newest generation.
-  (display-profile-news profile
-                        #:current-is-newer? #t)
+  "Display channel news for PROFILE compared to its previous generation."
+  (define previous
+    (relative-generation profile -1))
 
-  (display-channel-news profile))
+  (if previous
+      (unless (display-channel-news profile
+                                    (generation-file-name profile previous))
+        (info (G_ "no channel news since generation ~a~%") previous)
+        (display-hint (G_ "Run @command{guix pull -l} to view the
+news for earlier generations.")))
+      (leave (G_ "profile ~a does not have a previous generation~%")
+             profile)))
 
 (define* (build-and-install instances profile)
   "Build the tool from SOURCE, and install it in PROFILE.  When DRY-RUN? is
-- 
2.34.0





  reply	other threads:[~2022-02-14 16:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 16:38 [bug#54000] [PATCH 0/2] Not showing upgraded/added packages in 'guix pull' Ludovic Courtès
2022-02-14 16:41 ` Ludovic Courtès [this message]
2022-02-14 16:41   ` [bug#54000] [PATCH 2/2] pull: No longer print upgraded/added packages upon completion Ludovic Courtès
2022-02-15 13:55 ` [bug#54000] [PATCH 0/2] Not showing upgraded/added packages in 'guix pull' Liliana Marie Prikler
2022-02-17 10:19   ` Ludovic Courtès
2022-02-17 10:30     ` Liliana Marie Prikler
2022-02-17 12:04       ` zimoun
2022-02-17 12:52         ` Liliana Marie Prikler
2022-02-17 14:41           ` zimoun
2022-02-18  9:08             ` Ludovic Courtès
2022-02-18  9:20               ` Liliana Marie Prikler
2022-02-27 22:15                 ` bug#54000: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220214164127.1248-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=54000@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.