[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#37413] [PATCH 1/9] pull: '--news' shows the list of channels added
From: |
Ludovic Courtès |
Subject: |
[bug#37413] [PATCH 1/9] pull: '--news' shows the list of channels added or removed. |
Date: |
Mon, 16 Sep 2019 00:20:58 +0200 |
* guix/scripts/pull.scm (display-channel, channel=?)
(display-channel-news, display-news): New procedures.
(process-query): Call 'display-news' instead of 'display-profile-news'.
---
guix/scripts/pull.scm | 61 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 57 insertions(+), 4 deletions(-)
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 54bbaddf30..ca3b36f98c 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -192,6 +192,62 @@ newest generation of PROFILE."
(G_ "New in this revision:\n")))))
(_ #t)))
+(define (display-channel channel)
+ "Display information about CHANNEL."
+ (format (current-error-port)
+ ;; TRANSLATORS: This describes a "channel"; the first placeholder is
+ ;; the channel name (e.g., "guix") and the second placeholder is its
+ ;; URL.
+ (G_ " ~a at ~a~%")
+ (channel-name channel)
+ (channel-url channel)))
+
+(define (channel=? channel1 channel2)
+ "Return true if CHANNEL1 and CHANNEL2 are the same for all practical
+purposes."
+ ;; Assume that the URL matters less than the name.
+ (eq? (channel-name channel1) (channel-name channel2)))
+
+(define (display-channel-news profile)
+ "Display new about the channels of PROFILE "
+ (define previous
+ (and=> (relative-generation profile -1)
+ (cut generation-file-name profile <>)))
+
+ (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_ " ~*One 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_ " ~*One channel removed:~%"
+ " ~a channels removed:~%" count)
+ count)
+ (for-each display-channel removed)))))))))
+
+(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 profile))
+
(define* (build-and-install instances profile
#:key use-substitutes? verbose? dry-run?)
"Build the tool from SOURCE, and install it in PROFILE. When DRY-RUN? is
@@ -493,10 +549,7 @@ list of package changes.")))))
((numbers ...)
(list-generations profile numbers)))))))
(('display-news)
- ;; Display profile news, with the understanding that this process
- ;; represents the newest generation.
- (display-profile-news profile
- #:current-is-newer? #t))))
+ (display-news profile))))
(define (channel-list opts)
"Return the list of channels to use. If OPTS specify a channel file,
--
2.23.0
- [bug#37413] [PATCH 0/9] Channel news distribution mechanism, Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 1/9] pull: '--news' shows the list of channels added or removed.,
Ludovic Courtès <=
- [bug#37413] [PATCH 2/9] git: 'update-cached-checkout' avoids network access when unnecessary., Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 5/9] ui: Add 'current-message-language'., Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 7/9] pull: '-l' displays channel news., Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 6/9] pull: Display channel news., Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 3/9] git: Add 'commit-difference'., Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 8/9] Add '.guix-channel' file., Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 9/9] DRAFT etc: Add channel news file., Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 4/9] channels: Add support for a news file., Ludovic Courtès, 2019/09/15
- [bug#37413] [PATCH 0/9] Channel news distribution mechanism, Ricardo Wurmus, 2019/09/16