From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: guix pull package output truncated Date: Thu, 18 Apr 2019 17:25:43 +0200 Message-ID: <87imvbqqrs.fsf@gnu.org> References: <87h8aw72wp.fsf@gnu.org> <87ftqg8d5v.fsf@nckx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:43722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hH94X-0007d7-CC for help-guix@gnu.org; Thu, 18 Apr 2019 11:35:35 -0400 In-Reply-To: <87ftqg8d5v.fsf@nckx> (Tobias Geerinckx-Rice's message of "Thu, 18 Apr 2019 00:44:44 +0200") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Tobias Geerinckx-Rice Cc: help-guix@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Howdy! Tobias Geerinckx-Rice skribis: > Ludovic Court=C3=A8s wrote: >> There=E2=80=99s currently no flag to change this behavior. Instead, you >> have to >> run =E2=80=98guix pull -l=E2=80=99 but it=E2=80=99s arguably not very co= nvenient. >> >> Perhaps we could add an environment variable specifying whether/how >> to >> truncate? I=E2=80=99d keep the default as it is now. > > AIUC, this list of changes is displayed once and then =E2=80=98lost=E2=80= =99 (to the > average user) when they clear their screen, right? Yup. > Or is there a command that returns this nice list of differences > between two guix-profiles that we could suggest running when the > default is truncated? It could default to current and current-1, and > would solve both (minor) irritations. I think that=E2=80=99s a good idea. What about a =E2=80=98--news=E2=80=99 option along with a hint as in the at= tached patch? --8<---------------cut here---------------start------------->8--- $ guix pull --news New in this revision: 9 new packages: cl-log4cl, ecl-log4cl, emacs-ace-jump-mode, emacs-ace-lin= k, libomp, lucene++, mate-power-manager, poedit, sbcl-log4cl 63 packages upgraded: aj-snapshot@0.9.9, avrdude@6.3, bridge-utils@1.6, b= urp@2.3.4, calf@0.90.2, certbot@0.33.1, cl-bordeaux-threads@0.8.6-1.5dce49f, conky@1.11.3, conn= man@1.37, csound@6.12.2, darktable@2.6.2, docker-cli@18.09.5, docker@18.09.5, dungeon-crawl-stone-soup-tiles@0.23= .2, dungeon-crawl-stone-soup@0.23.2, ecl-bordeaux-threads@0.8.6-1.5dce49f, eolie@0.9.60, etl@1.2.2, eyed3@0.= 8.10, fswatch@1.14.0, gtkwave@3.3.100, guix@0.16.0-13.b8b1e4d, highlight@3.50, http-parser@2.9.2, hypre-openmp= i@2.15.1, hypre@2.15.1, java-openmpi@4.0.1, khal@0.10.1, knot@2.8.1, libmbim@1.18.2, libqmi@1.2= 2.4, libwacom@0.33, lm-sensors@3.5.0, meld@3.20.1, minetest@5.0.1, musl@1.1.22, ncdc@1.21, ncmpc@0.34, nginx@= 1.15.12, openmpi-thread-multiple@4.0.1, openmpi@4.0.1, perl-net-dns@1.20, python-acme@0.33.1, python-dask@1.2.0= , python-pygit2@0.28.0, python2-dask@1.2.0, python2-pygit2@0.28.0, qjackctl@0.5.7, qsynth@0.5.6= , quilt@0.66, rubberband@1.8.2, rust@1.34.0, sbcl-bordeaux-threads@0.8.6-1.5dce49f, singular@4.1.2p1, s= nd@19.3, socat@1.7.3.3, spice-gtk@0.36, synfig@1.2.2, synfigstudio@1.2.2, the-legend-of-edgar@1.31, toxic@0.8.3= , wireshark@3.0.1, yubikey-personalization@1.19.3 --8<---------------cut here---------------end--------------->8--- I=E2=80=99ll push it with documentation if there are no objections. Thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 71e13686c0..fe6ebb1656 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -117,6 +117,9 @@ Download and deploy the latest version of Guix.\n")) (lambda (opt name arg result) (cons `(query list-generations ,(or arg "")) result))) + (option '(#\N "news") #f #f + (lambda (opt name arg result) + (cons '(query display-news) result))) (option '("url") #t #f (lambda (opt name arg result) (alist-cons 'repository-url arg @@ -162,25 +165,28 @@ Download and deploy the latest version of Guix.\n")) (define indirect-root-added (store-lift add-indirect-root)) -(define (display-profile-news profile) +(define* (display-profile-news profile #:key concise? + current-is-newer?) "Display what's up in PROFILE--new packages, and all that." (match (memv (generation-number profile) (reverse (profile-generations profile))) ((current previous _ ...) - (newline) - (let ((old (fold-available-packages - (lambda* (name version result - #:key supported? deprecated? - #:allow-other-keys) - (if (and supported? (not deprecated?)) - (alist-cons name version result) - result)) - '())) - (new (profile-package-alist - (generation-file-name profile current)))) - (display-new/upgraded-packages old new - #:concise? #t - #:heading (G_ "New in this revision:\n")))) + (let ((these (fold-available-packages + (lambda* (name version result + #:key supported? deprecated? + #:allow-other-keys) + (if (and supported? (not deprecated?)) + (alist-cons name version result) + result)) + '())) + (those (profile-package-alist + (generation-file-name profile current)))) + (let ((old (if current-is-newer? those these)) + (new (if current-is-newer? these those))) + (display-new/upgraded-packages old new + #:concise? concise? + #:heading + (G_ "New in this revision:\n"))))) (_ #t))) (define* (build-and-install instances profile @@ -196,7 +202,8 @@ true, display what would be built without actually building it." #:hooks %channel-profile-hooks #:dry-run? dry-run?) (munless dry-run? - (return (display-profile-news profile)) + (return (newline)) + (return (display-profile-news profile #:concise? #t)) (match (which "guix") (#f (return #f)) (str @@ -394,9 +401,13 @@ display long package lists that would fill the user's screen." column) 4)) + (define concise/max-item-count + ;; Maximum number of items to display when CONCISE? is true. + 12) + (define list->enumeration (if concise? - (lambda* (lst #:optional (max 12)) + (lambda* (lst #:optional (max concise/max-item-count)) (if (> (length lst) max) (string-append (string-join (take lst max) ", ") ", " (ellipsis)) @@ -404,10 +415,13 @@ display long package lists that would fill the user's screen." (cut string-join <> ", "))) (let-values (((new upgraded) (new/upgraded-packages alist1 alist2))) + (define new-count (length new)) + (define upgraded-count (length upgraded)) + (unless (and (null? new) (null? upgraded)) (display heading)) - (match (length new) + (match new-count (0 #t) (count (format #t (N_ " ~h new package: ~a~%" @@ -415,14 +429,20 @@ display long package lists that would fill the user's screen." count (pretty (list->enumeration (sort (map first new) stringenumeration (sort upgraded string new-count concise/max-item-count) + (> upgraded-count concise/max-item-count))) + (display-hint (G_ "Run @command{guix pull --news} to view the complete +list of package changes."))))) (define (display-profile-content-diff profile gen1 gen2) "Display the changes in PROFILE GEN2 compared to generation GEN1." @@ -462,7 +482,12 @@ display long package lists that would fill the user's screen." (() (exit 1)) ((numbers ...) - (list-generations profile 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)))) (define (channel-list opts) "Return the list of channels to use. If OPTS specify a channel file, --=-=-=--