guix build: Re-purpose '--verbosity' and add '--debug'.

The previous '--verbosity' option was misleading and rarely what users
were looking for.  The new option provides a consistent way to choose
whether or not to display the build log.

* guix/scripts/build.scm (show-build-options-help): Remove "--verbosity"
and add "--debug".
(set-build-options-from-command-line): Use the 'debug key of OPTS for
 #:verbosity.
(%standard-build-options): Change "verbosity" to "debug".  Use
'string->number*' instead of 'string->number'.
(%default-options): Change 'verbosity to 'debug and add a 'verbosity
key.
(show-help): Add '--verbosity'.
(%options): Likewise, and change '--quiet' to set the 'verbosity key of
RESULT.
(guix-build): Use 'with-status-verbosity' instead of parameterizing
CURRENT-BUILD-OUTPUT-PORT, honor the 'verbosity key of OPTS, and remove
'quiet?'.
* guix/scripts/environment.scm (show-help, %options): Add '--verbosity'.
(%default-options): Add 'debug'.
(guix-environment): Honor the 'verbosity key of OPTS.
* guix/scripts/pack.scm (%default-options): Add 'debug.
(%options, show-help): Add '--verbosity'.
(guix-pack): Honor the 'verbosity key of OPTS.
* guix/scripts/package.scm (%default-options): Add 'debug.
(show-help, %options): Add '--verbosity'.  Mark '--verbose' as
deprecated and change it to set 'verbosity.
(guix-package): Honor the 'verbosity key of OPTS and remove 'verbose?'.
* guix/scripts/pull.scm (%default-options): Add 'debug.
(show-help, %options): Add '--verbosity'.
(guix-pull): Honor the 'verbosity key of OPTS.
* guix/scripts/system.scm (show-help, %options): Add '--verbosity'.
(%default-options): Add 'debug.
(guix-system): Honor the 'verbosity key of OPTS.
* guix/scripts/archive.scm (%default-options): Add 'debug,
'print-build-trace?, 'print-extended-build-trace?, and
'multiplexed-build-output?.
(show-help, %options): Add '--verbosity'.
(export-from-store): Remove call to 'set-build-options-from-command-line'.
(guix-archive): Wrap body in 'with-status-verbosity'. Add call to
'set-build-options-from-command-line.
* doc/guix.texi (Common Build Options): Document '--verbosity' and
'--debug'.
(Additional Build Options): Adjust description of '--quiet'.
master
Ludovic Courtès 2019-01-09 14:17:19 +01:00
parent 7804c45b9c
commit f1de676ea8
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
8 changed files with 175 additions and 114 deletions

View File

@ -2101,10 +2101,6 @@ By default, @command{guix package} reports as an error @dfn{collisions}
in the profile. Collisions happen when two or more different versions in the profile. Collisions happen when two or more different versions
or variants of a given package end up in the profile. or variants of a given package end up in the profile.
@item --verbose
Produce verbose output. In particular, emit the build log of the
environment on the standard error port.
@item --bootstrap @item --bootstrap
Use the bootstrap Guile to build the profile. This option is only Use the bootstrap Guile to build the profile. This option is only
useful to distribution developers. useful to distribution developers.
@ -6363,10 +6359,15 @@ Likewise, when the build or substitution process lasts for more than
By default, the daemon's setting is honored (@pxref{Invoking By default, the daemon's setting is honored (@pxref{Invoking
guix-daemon, @code{--timeout}}). guix-daemon, @code{--timeout}}).
@item --verbosity=@var{level} @c Note: This option is actually not part of %standard-build-options but
Use the given verbosity level. @var{level} must be an integer between 0 @c most programs honor it.
and 5; higher means more verbose output. Setting a level of 4 or more @cindex verbosity, of the command-line tools
may be helpful when debugging setup issues with the build daemon. @cindex build logs, verbosity
@item -v @var{level}
@itemx --verbosity=@var{level}
Use the given verbosity @var{level}, an integer. Choosing 0 means that no
output is produced, 1 is for quiet output, and 2 shows all the build log
output on standard error.
@item --cores=@var{n} @item --cores=@var{n}
@itemx -c @var{n} @itemx -c @var{n}
@ -6379,6 +6380,11 @@ Allow at most @var{n} build jobs in parallel. @xref{Invoking
guix-daemon, @code{--max-jobs}}, for details about this option and the guix-daemon, @code{--max-jobs}}, for details about this option and the
equivalent @command{guix-daemon} option. equivalent @command{guix-daemon} option.
@item --debug=@var{level}
Produce debugging output coming from the build daemon. @var{level} must be an
integer between 0 and 5; higher means more verbose output. Setting a level of
4 or more may be helpful when debugging setup issues with the build daemon.
@end table @end table
Behind the scenes, @command{guix build} is essentially an interface to Behind the scenes, @command{guix build} is essentially an interface to
@ -6547,9 +6553,9 @@ build}.
@item --quiet @item --quiet
@itemx -q @itemx -q
Build quietly, without displaying the build log. Upon completion, the Build quietly, without displaying the build log; this is equivalent to
build log is kept in @file{/var} (or similar) and can always be @code{--verbosity=0}. Upon completion, the build log is kept in @file{/var}
retrieved using the @option{--log-file} option. (or similar) and can always be retrieved using the @option{--log-file} option.
@item --file=@var{file} @item --file=@var{file}
@itemx -f @var{file} @itemx -f @var{file}

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -23,6 +23,7 @@
#:use-module ((guix build utils) #:select (mkdir-p)) #:use-module ((guix build utils) #:select (mkdir-p))
#:use-module ((guix serialization) #:select (restore-file)) #:use-module ((guix serialization) #:select (restore-file))
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix status)
#:use-module (guix grafts) #:use-module (guix grafts)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix derivations) #:use-module (guix derivations)
@ -55,7 +56,11 @@
(substitutes? . #t) (substitutes? . #t)
(build-hook? . #t) (build-hook? . #t)
(graft? . #t) (graft? . #t)
(verbosity . 0))) (print-build-trace? . #t)
(print-extended-build-trace? . #t)
(multiplexed-build-output? . #t)
(verbosity . 2)
(debug . 0)))
(define (show-help) (define (show-help)
(display (G_ "Usage: guix archive [OPTION]... PACKAGE... (display (G_ "Usage: guix archive [OPTION]... PACKAGE...
@ -85,6 +90,8 @@ Export/import one or more packages from/to the store.\n"))
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(display (G_ " (display (G_ "
--target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\"")) --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(newline) (newline)
(show-build-options-help) (show-build-options-help)
@ -161,6 +168,11 @@ Export/import one or more packages from/to the store.\n"))
(option '(#\e "expression") #t #f (option '(#\e "expression") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'expression arg result))) (alist-cons 'expression arg result)))
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result)
(let ((level (string->number* arg)))
(alist-cons 'verbosity level
(alist-delete 'verbosity result)))))
(option '(#\n "dry-run") #f #f (option '(#\n "dry-run") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) (alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
@ -239,7 +251,6 @@ build and a list of store files to transfer."
resulting archive to the standard output port." resulting archive to the standard output port."
(let-values (((drv files) (let-values (((drv files)
(options->derivations+files store opts))) (options->derivations+files store opts)))
(set-build-options-from-command-line store opts)
(show-what-to-build store drv (show-what-to-build store drv
#:use-substitutes? (assoc-ref opts 'substitutes?) #:use-substitutes? (assoc-ref opts 'substitutes?)
#:dry-run? (assoc-ref opts 'dry-run?)) #:dry-run? (assoc-ref opts 'dry-run?))
@ -329,21 +340,23 @@ the input port."
((assoc-ref opts 'authorize) ((assoc-ref opts 'authorize)
(authorize-key)) (authorize-key))
(else (else
(with-store store (with-status-verbosity (assoc-ref opts 'verbosity)
(cond ((assoc-ref opts 'export) (with-store store
(export-from-store store opts)) (set-build-options-from-command-line store opts)
((assoc-ref opts 'import) (cond ((assoc-ref opts 'export)
(import-paths store (current-input-port))) (export-from-store store opts))
((assoc-ref opts 'missing) ((assoc-ref opts 'import)
(let* ((files (lines (current-input-port))) (import-paths store (current-input-port)))
(missing (remove (cut valid-path? store <>) ((assoc-ref opts 'missing)
files))) (let* ((files (lines (current-input-port)))
(format #t "~{~a~%~}" missing))) (missing (remove (cut valid-path? store <>)
((assoc-ref opts 'extract) files)))
=> (format #t "~{~a~%~}" missing)))
(lambda (target) ((assoc-ref opts 'extract)
(restore-file (current-input-port) target))) =>
(else (lambda (target)
(leave (restore-file (current-input-port) target)))
(G_ "either '--export' or '--import' \ (else
must be specified~%")))))))))))) (leave
(G_ "either '--export' or '--import' \
must be specified~%")))))))))))))

View File

@ -449,14 +449,14 @@ options handled by 'set-build-options-from-command-line', and listed in
mark the build as failed after SECONDS of silence")) mark the build as failed after SECONDS of silence"))
(display (G_ " (display (G_ "
--timeout=SECONDS mark the build as failed after SECONDS of activity")) --timeout=SECONDS mark the build as failed after SECONDS of activity"))
(display (G_ "
--verbosity=LEVEL use the given verbosity LEVEL"))
(display (G_ " (display (G_ "
--rounds=N build N times in a row to detect non-determinism")) --rounds=N build N times in a row to detect non-determinism"))
(display (G_ " (display (G_ "
-c, --cores=N allow the use of up to N CPU cores for the build")) -c, --cores=N allow the use of up to N CPU cores for the build"))
(display (G_ " (display (G_ "
-M, --max-jobs=N allow at most N build jobs"))) -M, --max-jobs=N allow at most N build jobs"))
(display (G_ "
--debug=LEVEL produce debugging output at LEVEL")))
(define (set-build-options-from-command-line store opts) (define (set-build-options-from-command-line store opts)
"Given OPTS, an alist as returned by 'args-fold' given "Given OPTS, an alist as returned by 'args-fold' given
@ -479,7 +479,7 @@ options handled by 'set-build-options-from-command-line', and listed in
(assoc-ref opts 'print-extended-build-trace?) (assoc-ref opts 'print-extended-build-trace?)
#:multiplexed-build-output? #:multiplexed-build-output?
(assoc-ref opts 'multiplexed-build-output?) (assoc-ref opts 'multiplexed-build-output?)
#:verbosity (assoc-ref opts 'verbosity))) #:verbosity (assoc-ref opts 'debug)))
(define set-build-options-from-command-line* (define set-build-options-from-command-line*
(store-lift set-build-options-from-command-line)) (store-lift set-build-options-from-command-line))
@ -553,12 +553,12 @@ options handled by 'set-build-options-from-command-line', and listed in
(apply values (apply values
(alist-cons 'timeout (string->number* arg) result) (alist-cons 'timeout (string->number* arg) result)
rest))) rest)))
(option '("verbosity") #t #f (option '("debug") #t #f
(lambda (opt name arg result . rest) (lambda (opt name arg result . rest)
(let ((level (string->number arg))) (let ((level (string->number* arg)))
(apply values (apply values
(alist-cons 'verbosity level (alist-cons 'debug level
(alist-delete 'verbosity result)) (alist-delete 'debug result))
rest)))) rest))))
(option '(#\c "cores") #t #f (option '(#\c "cores") #t #f
(lambda (opt name arg result . rest) (lambda (opt name arg result . rest)
@ -590,7 +590,8 @@ options handled by 'set-build-options-from-command-line', and listed in
(print-build-trace? . #t) (print-build-trace? . #t)
(print-extended-build-trace? . #t) (print-extended-build-trace? . #t)
(multiplexed-build-output? . #t) (multiplexed-build-output? . #t)
(verbosity . 0))) (verbosity . 2)
(debug . 0)))
(define (show-help) (define (show-help)
(display (G_ "Usage: guix build [OPTION]... PACKAGE-OR-DERIVATION... (display (G_ "Usage: guix build [OPTION]... PACKAGE-OR-DERIVATION...
@ -619,6 +620,8 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n"))
-r, --root=FILE make FILE a symlink to the result, and register it -r, --root=FILE make FILE a symlink to the result, and register it
as a garbage collector root")) as a garbage collector root"))
(display (G_ " (display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(display (G_ "
-q, --quiet do not show the build log")) -q, --quiet do not show the build log"))
(display (G_ " (display (G_ "
--log-file return the log file names for the given derivations")) --log-file return the log file names for the given derivations"))
@ -694,9 +697,15 @@ must be one of 'package', 'all', or 'transitive'~%")
(option '(#\r "root") #t #f (option '(#\r "root") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'gc-root arg result))) (alist-cons 'gc-root arg result)))
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result)
(let ((level (string->number* arg)))
(alist-cons 'verbosity level
(alist-delete 'verbosity result)))))
(option '(#\q "quiet") #f #f (option '(#\q "quiet") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'quiet? #t result))) (alist-cons 'verbosity 0
(alist-delete 'verbosity result))))
(option '("log-file") #f #f (option '("log-file") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'log-file? #t result))) (alist-cons 'log-file? #t result)))
@ -819,66 +828,59 @@ needed."
(parse-command-line args %options (parse-command-line args %options
(list %default-options))) (list %default-options)))
(define quiet?
(assoc-ref opts 'quiet?))
(with-error-handling (with-error-handling
;; Ask for absolute file names so that .drv file names passed from the ;; Ask for absolute file names so that .drv file names passed from the
;; user to 'read-derivation' are absolute when it returns. ;; user to 'read-derivation' are absolute when it returns.
(with-fluids ((%file-port-name-canonicalization 'absolute)) (with-fluids ((%file-port-name-canonicalization 'absolute))
(with-store store (with-status-verbosity (assoc-ref opts 'verbosity)
;; Set the build options before we do anything else. (with-store store
(set-build-options-from-command-line store opts) ;; Set the build options before we do anything else.
(set-build-options-from-command-line store opts)
(parameterize ((current-terminal-columns (terminal-columns)) (parameterize ((current-terminal-columns (terminal-columns)))
(current-build-output-port (let* ((mode (assoc-ref opts 'build-mode))
(if quiet? (drv (options->derivations store opts))
(%make-void-port "w") (urls (map (cut string-append <> "/log")
(build-event-output-port (if (assoc-ref opts 'substitutes?)
(build-status-updater print-build-event))))) (or (assoc-ref opts 'substitute-urls)
(let* ((mode (assoc-ref opts 'build-mode)) ;; XXX: This does not necessarily match the
(drv (options->derivations store opts)) ;; daemon's substitute URLs.
(urls (map (cut string-append <> "/log") %default-substitute-urls)
(if (assoc-ref opts 'substitutes?) '())))
(or (assoc-ref opts 'substitute-urls) (items (filter-map (match-lambda
;; XXX: This does not necessarily match the (('argument . (? store-path? file))
;; daemon's substitute URLs. file)
%default-substitute-urls) (_ #f))
'()))) opts))
(items (filter-map (match-lambda (roots (filter-map (match-lambda
(('argument . (? store-path? file)) (('gc-root . root) root)
file) (_ #f))
(_ #f)) opts)))
opts))
(roots (filter-map (match-lambda
(('gc-root . root) root)
(_ #f))
opts)))
(unless (or (assoc-ref opts 'log-file?) (unless (or (assoc-ref opts 'log-file?)
(assoc-ref opts 'derivations-only?)) (assoc-ref opts 'derivations-only?))
(show-what-to-build store drv (show-what-to-build store drv
#:use-substitutes? #:use-substitutes?
(assoc-ref opts 'substitutes?) (assoc-ref opts 'substitutes?)
#:dry-run? (assoc-ref opts 'dry-run?) #:dry-run? (assoc-ref opts 'dry-run?)
#:mode mode)) #:mode mode))
(cond ((assoc-ref opts 'log-file?) (cond ((assoc-ref opts 'log-file?)
(for-each (cut show-build-log store <> urls) (for-each (cut show-build-log store <> urls)
(delete-duplicates (delete-duplicates
(append (map derivation-file-name drv) (append (map derivation-file-name drv)
items)))) items))))
((assoc-ref opts 'derivations-only?) ((assoc-ref opts 'derivations-only?)
(format #t "~{~a~%~}" (map derivation-file-name drv)) (format #t "~{~a~%~}" (map derivation-file-name drv))
(for-each (cut register-root store <> <>) (for-each (cut register-root store <> <>)
(map (compose list derivation-file-name) drv) (map (compose list derivation-file-name) drv)
roots)) roots))
((not (assoc-ref opts 'dry-run?)) ((not (assoc-ref opts 'dry-run?))
(and (build-derivations store drv mode) (and (build-derivations store drv mode)
(for-each show-derivation-outputs drv) (for-each show-derivation-outputs drv)
(for-each (cut register-root store <> <>) (for-each (cut register-root store <> <>)
(map (lambda (drv) (map (lambda (drv)
(map cdr (map cdr
(derivation->output-paths drv))) (derivation->output-paths drv)))
drv) drv)
roots)))))))))) roots)))))))))))

View File

@ -157,6 +157,8 @@ COMMAND or an interactive shell in that environment.\n"))
(display (G_ " (display (G_ "
--expose=SPEC for containers, expose read-only host file system --expose=SPEC for containers, expose read-only host file system
according to SPEC")) according to SPEC"))
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(display (G_ " (display (G_ "
--bootstrap use bootstrap binaries to build the environment")) --bootstrap use bootstrap binaries to build the environment"))
(newline) (newline)
@ -179,7 +181,8 @@ COMMAND or an interactive shell in that environment.\n"))
(print-build-trace? . #t) (print-build-trace? . #t)
(print-extended-build-trace? . #t) (print-extended-build-trace? . #t)
(multiplexed-build-output? . #t) (multiplexed-build-output? . #t)
(verbosity . 0))) (debug . 0)
(verbosity . 2)))
(define (tag-package-arg opts arg) (define (tag-package-arg opts arg)
"Return a two-element list with the form (TAG ARG) that tags ARG with either "Return a two-element list with the form (TAG ARG) that tags ARG with either
@ -260,6 +263,11 @@ COMMAND or an interactive shell in that environment.\n"))
(option '(#\r "root") #t #f (option '(#\r "root") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'gc-root arg result))) (alist-cons 'gc-root arg result)))
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result)
(let ((level (string->number* arg)))
(alist-cons 'verbosity level
(alist-delete 'verbosity result)))))
(option '("bootstrap") #f #f (option '("bootstrap") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'bootstrap? #t result))) (alist-cons 'bootstrap? #t result)))
@ -674,7 +682,7 @@ message if any test fails."
(leave (G_ "'--user' cannot be used without '--container'~%"))) (leave (G_ "'--user' cannot be used without '--container'~%")))
(with-store store (with-store store
(with-status-verbosity 1 (with-status-verbosity (assoc-ref opts 'verbosity)
(define manifest (define manifest
(options/resolve-packages store opts)) (options/resolve-packages store opts))

View File

@ -598,7 +598,8 @@ please email '~a'~%")
(print-build-trace? . #t) (print-build-trace? . #t)
(print-extended-build-trace? . #t) (print-extended-build-trace? . #t)
(multiplexed-build-output? . #t) (multiplexed-build-output? . #t)
(verbosity . 0) (debug . 0)
(verbosity . 2)
(symlinks . ()) (symlinks . ())
(compressor . ,(first %compressors)))) (compressor . ,(first %compressors))))
@ -685,6 +686,11 @@ please email '~a'~%")
(alist-cons 'profile-name arg result)) (alist-cons 'profile-name arg result))
(_ (_
(leave (G_ "~a: unsupported profile name~%") arg))))) (leave (G_ "~a: unsupported profile name~%") arg)))))
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result)
(let ((level (string->number* arg)))
(alist-cons 'verbosity level
(alist-delete 'verbosity result)))))
(option '("bootstrap") #f #f (option '("bootstrap") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'bootstrap? #t result))) (alist-cons 'bootstrap? #t result)))
@ -722,6 +728,8 @@ Create a bundle of PACKAGE.\n"))
(display (G_ " (display (G_ "
--profile-name=NAME --profile-name=NAME
populate /var/guix/profiles/.../NAME")) populate /var/guix/profiles/.../NAME"))
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(display (G_ " (display (G_ "
--bootstrap use the bootstrap binaries to build the pack")) --bootstrap use the bootstrap binaries to build the pack"))
(newline) (newline)
@ -772,7 +780,7 @@ Create a bundle of PACKAGE.\n"))
(with-error-handling (with-error-handling
(with-store store (with-store store
(with-status-verbosity 2 (with-status-verbosity (assoc-ref opts 'verbosity)
;; Set the build options before we do anything else. ;; Set the build options before we do anything else.
(set-build-options-from-command-line store opts) (set-build-options-from-command-line store opts)

View File

@ -293,7 +293,8 @@ ENTRIES, a list of manifest entries, in the context of PROFILE."
(define %default-options (define %default-options
;; Alist of default option values. ;; Alist of default option values.
`((verbosity . 0) `((verbosity . 1)
(debug . 0)
(graft? . #t) (graft? . #t)
(substitutes? . #t) (substitutes? . #t)
(build-hook? . #t) (build-hook? . #t)
@ -346,7 +347,7 @@ Install, remove, or upgrade packages in a single transaction.\n"))
(display (G_ " (display (G_ "
--bootstrap use the bootstrap Guile to build the profile")) --bootstrap use the bootstrap Guile to build the profile"))
(display (G_ " (display (G_ "
--verbose produce verbose output")) -v, --verbosity=LEVEL use the given verbosity LEVEL"))
(newline) (newline)
(display (G_ " (display (G_ "
-s, --search=REGEXP search in synopsis and description using REGEXP")) -s, --search=REGEXP search in synopsis and description using REGEXP"))
@ -472,13 +473,21 @@ kind of search path~%")
(values (alist-cons 'dry-run? #t (values (alist-cons 'dry-run? #t
(alist-cons 'graft? #f result)) (alist-cons 'graft? #f result))
#f))) #f)))
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result arg-handler)
(let ((level (string->number* arg)))
(values (alist-cons 'verbosity level
(alist-delete 'verbosity result))
#f))))
(option '("bootstrap") #f #f (option '("bootstrap") #f #f
(lambda (opt name arg result arg-handler) (lambda (opt name arg result arg-handler)
(values (alist-cons 'bootstrap? #t result) (values (alist-cons 'bootstrap? #t result)
#f))) #f)))
(option '("verbose") #f #f (option '("verbose") #f #f ;deprecated
(lambda (opt name arg result arg-handler) (lambda (opt name arg result arg-handler)
(values (alist-cons 'verbose? #t result) (values (alist-cons 'verbosity 2
(alist-delete 'verbosity
result))
#f))) #f)))
(option '("allow-collisions") #f #f (option '("allow-collisions") #f #f
(lambda (opt name arg result arg-handler) (lambda (opt name arg result arg-handler)
@ -907,14 +916,12 @@ processed, #f otherwise."
(define opts (define opts
(parse-command-line args %options (list %default-options #f) (parse-command-line args %options (list %default-options #f)
#:argument-handler handle-argument)) #:argument-handler handle-argument))
(define verbose?
(assoc-ref opts 'verbose?))
(with-error-handling (with-error-handling
(or (process-query opts) (or (process-query opts)
(parameterize ((%store (open-connection)) (parameterize ((%store (open-connection))
(%graft? (assoc-ref opts 'graft?))) (%graft? (assoc-ref opts 'graft?)))
(with-status-verbosity 1 (with-status-verbosity (assoc-ref opts 'verbosity)
(set-build-options-from-command-line (%store) opts) (set-build-options-from-command-line (%store) opts)
(parameterize ((%guile-for-build (parameterize ((%guile-for-build
(package-derivation (package-derivation

View File

@ -66,7 +66,8 @@
(print-extended-build-trace? . #t) (print-extended-build-trace? . #t)
(multiplexed-build-output? . #t) (multiplexed-build-output? . #t)
(graft? . #t) (graft? . #t)
(verbosity . 0))) (debug . 0)
(verbosity . 2)))
(define (show-help) (define (show-help)
(display (G_ "Usage: guix pull [OPTION]... (display (G_ "Usage: guix pull [OPTION]...
@ -89,6 +90,8 @@ Download and deploy the latest version of Guix.\n"))
(display (G_ " (display (G_ "
-n, --dry-run show what would be pulled and built")) -n, --dry-run show what would be pulled and built"))
(display (G_ " (display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(display (G_ "
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(display (G_ " (display (G_ "
--bootstrap use the bootstrap Guile to build the new Guix")) --bootstrap use the bootstrap Guile to build the new Guix"))
@ -135,6 +138,11 @@ Download and deploy the latest version of Guix.\n"))
(option '(#\n "dry-run") #f #f (option '(#\n "dry-run") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) (alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result)
(let ((level (string->number* arg)))
(alist-cons 'verbosity level
(alist-delete 'verbosity result)))))
(option '("bootstrap") #f #f (option '("bootstrap") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'bootstrap? #t result))) (alist-cons 'bootstrap? #t result)))
@ -510,7 +518,7 @@ Use '~/.config/guix/channels.scm' instead."))
(process-query opts profile)) (process-query opts profile))
(else (else
(with-store store (with-store store
(with-status-verbosity 2 (with-status-verbosity (assoc-ref opts 'verbosity)
(parameterize ((%current-system (assoc-ref opts 'system)) (parameterize ((%current-system (assoc-ref opts 'system))
(%graft? (assoc-ref opts 'graft?)) (%graft? (assoc-ref opts 'graft?))
(%repository-cache-directory cache)) (%repository-cache-directory cache))

View File

@ -1015,6 +1015,8 @@ Some ACTIONS support additional ARGS.\n"))
--full-boot for 'vm', make a full boot sequence")) --full-boot for 'vm', make a full boot sequence"))
(display (G_ " (display (G_ "
--skip-checks skip file system and initrd module safety checks")) --skip-checks skip file system and initrd module safety checks"))
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(newline) (newline)
(display (G_ " (display (G_ "
-h, --help display this help and exit")) -h, --help display this help and exit"))
@ -1074,6 +1076,11 @@ Some ACTIONS support additional ARGS.\n"))
(option '(#\n "dry-run") #f #f (option '(#\n "dry-run") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) (alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result)
(let ((level (string->number* arg)))
(alist-cons 'verbosity level
(alist-delete 'verbosity result)))))
(option '(#\s "system") #t #f (option '(#\s "system") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'system arg (alist-cons 'system arg
@ -1092,7 +1099,8 @@ Some ACTIONS support additional ARGS.\n"))
(print-extended-build-trace? . #t) (print-extended-build-trace? . #t)
(multiplexed-build-output? . #t) (multiplexed-build-output? . #t)
(graft? . #t) (graft? . #t)
(verbosity . 0) (debug . 0)
(verbosity . #f) ;default
(file-system-type . "ext4") (file-system-type . "ext4")
(image-size . guess) (image-size . guess)
(install-bootloader? . #t))) (install-bootloader? . #t)))
@ -1267,8 +1275,9 @@ argument list and OPTS is the option alist."
(args (option-arguments opts)) (args (option-arguments opts))
(command (assoc-ref opts 'action))) (command (assoc-ref opts 'action)))
(parameterize ((%graft? (assoc-ref opts 'graft?))) (parameterize ((%graft? (assoc-ref opts 'graft?)))
(with-status-verbosity (if (memq command '(init reconfigure)) (with-status-verbosity (or (assoc-ref opts 'verbosity)
1 2) (if (memq command '(init reconfigure))
1 2))
(process-command command args opts)))))) (process-command command args opts))))))
;;; Local Variables: ;;; Local Variables: