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.
This commit is contained in:
Ludovic Courtès 2022-02-09 21:38:05 +01:00
parent ee230f15c6
commit b9df2e2b4d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 32 additions and 10 deletions

View file

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

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013-2015, 2017-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
@ -104,6 +104,8 @@ (define (show-help)
(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 @@ (define %options
(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 @@ (define (package-alist generation)
(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 @@ (define (environment-variable)
(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