From b9df2e2b4d8a8efa5983aeb69a5ed394e7bcba60 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 9 Feb 2022 21:38:05 +0100 Subject: pull: '--list-generations' lists packages only with '--details'. * guix/scripts/pull.scm (show-help, %options): Add "--details". (process-query): Honor it. * doc/guix.texi (Invoking guix pull): Document it. --- doc/guix.texi | 15 +++++++++------ guix/scripts/pull.scm | 27 +++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index c116be8907..a05f073c3d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4426,18 +4426,12 @@ Generation 2 Jun 11 2018 11:02:49 repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master commit: e0cc7f669bec22c37481dd03a7941c7d11a64f1d - 2 new packages: keepalived, libnfnetlink - 6 packages upgraded: emacs-nix-mode@@2.0.4, - guile2.0-guix@@0.14.0-12.77a1aac, guix@@0.14.0-12.77a1aac, - heimdal@@7.5.0, milkytracker@@1.02.00, nix@@2.0.4 Generation 3 Jun 13 2018 23:31:07 (current) guix 844cc1c repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master commit: 844cc1c8f394f03b404c5bb3aee086922373490c - 28 new packages: emacs-helm-ls-git, emacs-helm-mu, @dots{} - 69 packages upgraded: borg@@1.1.6, cheese@@3.28.0, @dots{} @end example @xref{Invoking guix describe, @command{guix describe}}, for other ways to @@ -4507,6 +4501,15 @@ is provided, the subset of generations that match @var{pattern}. The syntax of @var{pattern} is the same as with @code{guix package --list-generations} (@pxref{Invoking guix package}). +By default, this prints information about the channels used in each +revision as well as the corresponding news entries. If you pass +@option{--details}, it will also print the list of packages added and +upgraded in each generation compared to the previous one. + +@item --details +Instruct @option{--list-generations} to display more information about +the differences between subsequent generations---see above. + @item --roll-back @cindex rolling back @cindex undoing transactions diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index fb8ce50fa7..a3bb6db8c6 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2013-2015, 2017-2022 Ludovic Courtès ;;; Copyright © 2017 Marius Bakke ;;; Copyright © 2020, 2021 Tobias Geerinckx-Rice ;;; @@ -104,6 +104,8 @@ Download and deploy the latest version of Guix.\n")) (display (G_ " -l, --list-generations[=PATTERN] list generations matching PATTERN")) + (display (G_ " + --details show details when listing generations")) (display (G_ " --roll-back roll back to the previous generation")) (display (G_ " @@ -138,6 +140,17 @@ Download and deploy the latest version of Guix.\n")) (lambda (opt name arg result) (cons `(query list-generations ,arg) result))) + (option '("details") #f #f + (lambda (opt name arg result) + (alist-cons 'details? #t + (match (find (match-lambda + (('query 'list-generations _) + #t) + (_ #f)) + result) + (#t result) + (#f (cons `(query list-generations #f) + result)))))) (option '("roll-back") #f #f (lambda (opt name arg result) (cons '(generation roll-back) @@ -640,17 +653,23 @@ Return true when there is more package info to display." (define (process-query opts profile) "Process any query on PROFILE specified by OPTS." + (define details? + (assoc-ref opts 'details?)) + (match (assoc-ref opts 'query) (('list-generations pattern) (define (list-generations profile numbers) (match numbers ((first rest ...) (display-profile-content profile first) + (let loop ((numbers numbers)) (match numbers ((first second rest ...) - (display-profile-content-diff profile - first second) + (if details? + (display-profile-content-diff profile + first second) + (display-profile-content profile second)) (display-channel-news (generation-file-name profile second) (generation-file-name profile first)) (loop (cons second rest))) @@ -754,7 +773,7 @@ Use '~/.config/guix/channels.scm' instead.")) (define-command (guix-pull . args) (synopsis "pull the latest revision of Guix") - (define (no-arguments arg _‌) + (define (no-arguments arg _) (leave (G_ "~A: extraneous argument~%") arg)) (with-error-handling -- cgit v1.2.3