all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful
@ 2019-01-09 13:31 Ludovic Courtès
  2019-01-09 13:33 ` [bug#34020] [PATCH 1/2] status: Add 'with-status-verbosity' Ludovic Courtès
  2019-01-10  3:38 ` [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful Mike Gerwitz
  0 siblings, 2 replies; 8+ messages in thread
From: Ludovic Courtès @ 2019-01-09 13:31 UTC (permalink / raw)
  To: 34020

Hello Guix!

These patches re-purposes ‘--verbosity’ so that it better matches
user expectations.  The previous ‘--verbosity’ option, which is
about the daemon’s debugging output, is renamed to ‘--debug’.
In addition, ‘--verbosity’ now has a shorthand ‘-v’.

Most commands that build stuff support -v/--verbosity so users can
easily override the default verbosity level.

Thoughts?

Thanks,
Ludo’.

Ludovic Courtès (2):
  status: Add 'with-status-verbosity'.
  guix build: Re-purpose '--verbosity' and add '--debug'.

 .dir-locals.el                 |   1 +
 build-aux/run-system-tests.scm |   4 +-
 doc/guix.texi                  |  30 +++++---
 guix/scripts/build.scm         | 134 +++++++++++++++++----------------
 guix/scripts/environment.scm   |  14 +++-
 guix/scripts/pack.scm          |  14 +++-
 guix/scripts/package.scm       |  23 ++++--
 guix/scripts/pull.scm          |  12 ++-
 guix/scripts/system.scm        |  18 +++--
 guix/status.scm                |  17 ++++-
 10 files changed, 165 insertions(+), 102 deletions(-)

-- 
2.20.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#34020] [PATCH 1/2] status: Add 'with-status-verbosity'.
  2019-01-09 13:31 [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful Ludovic Courtès
@ 2019-01-09 13:33 ` Ludovic Courtès
  2019-01-09 13:33   ` [bug#34020] [PATCH 2/2] guix build: Re-purpose '--verbosity' and add '--debug' Ludovic Courtès
  2019-01-10  3:38 ` [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful Mike Gerwitz
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2019-01-09 13:33 UTC (permalink / raw)
  To: 34020

* guix/status.scm (logger-for-level, call-with-status-verbosity): New
procedures.
(with-status-verbosity): New macro.
* guix/scripts/environment.scm (guix-environment): Use
'with-status-verbosity' instead of 'with-status-report'.
* guix/scripts/pack.scm (guix-pack): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* build-aux/run-system-tests.scm (run-system-tests): Likewise.
---
 .dir-locals.el                 |  1 +
 build-aux/run-system-tests.scm |  4 ++--
 guix/scripts/environment.scm   |  4 ++--
 guix/scripts/pack.scm          |  4 ++--
 guix/scripts/package.scm       |  4 ++--
 guix/scripts/pull.scm          |  2 +-
 guix/scripts/system.scm        |  7 +++----
 guix/status.scm                | 17 ++++++++++++++++-
 8 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index 1a3a05f100..593c767d2b 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -61,6 +61,7 @@
    (eval . (put 'with-derivation-narinfo 'scheme-indent-function 1))
    (eval . (put 'with-derivation-substitute 'scheme-indent-function 2))
    (eval . (put 'with-status-report 'scheme-indent-function 1))
+   (eval . (put 'with-status-verbosity 'scheme-indent-function 1))
 
    (eval . (put 'mlambda 'scheme-indent-function 1))
    (eval . (put 'mlambdaq 'scheme-indent-function 1))
diff --git a/build-aux/run-system-tests.scm b/build-aux/run-system-tests.scm
index 953ba3e221..bcd7547704 100644
--- a/build-aux/run-system-tests.scm
+++ b/build-aux/run-system-tests.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -64,7 +64,7 @@
           (length tests))
 
   (with-store store
-    (with-status-report print-build-event
+    (with-status-verbosity 2
       (run-with-store store
         (mlet* %store-monad ((drv (mapm %store-monad system-test-value tests))
                              (out -> (map derivation->output-path drv)))
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 86e1eb115f..9461d04976 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014, 2015, 2018 David Thompson <davet@gnu.org>
-;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Mike Gerwitz <mtg@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -674,7 +674,7 @@ message if any test fails."
         (leave (G_ "'--user' cannot be used without '--container'~%")))
 
       (with-store store
-        (with-status-report print-build-event
+        (with-status-verbosity 1
           (define manifest
             (options/resolve-packages store opts))
 
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 98b06971bd..173bdd1ef1 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
@@ -774,7 +774,7 @@ Create a bundle of PACKAGE.\n"))
 
   (with-error-handling
     (with-store store
-      (with-status-report print-build-event
+      (with-status-verbosity 2
         ;; Set the build options before we do anything else.
         (set-build-options-from-command-line store opts)
 
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 5743816324..876787fbe2 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2013, 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
@@ -914,7 +914,7 @@ processed, #f otherwise."
     (or (process-query opts)
         (parameterize ((%store  (open-connection))
                        (%graft? (assoc-ref opts 'graft?)))
-          (with-status-report print-build-event/quiet
+          (with-status-verbosity 1
             (set-build-options-from-command-line (%store) opts)
             (parameterize ((%guile-for-build
                             (package-derivation
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index e7ff44c0d5..6389d5ec09 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -510,7 +510,7 @@ Use '~/.config/guix/channels.scm' instead."))
               (process-query opts profile))
              (else
               (with-store store
-                (with-status-report print-build-event
+                (with-status-verbosity 2
                   (parameterize ((%current-system (assoc-ref opts 'system))
                                  (%graft? (assoc-ref opts 'graft?))
                                  (%repository-cache-directory cache))
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 6cda3ccbd6..9e31baaddb 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016, 2017, 2018 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -1267,9 +1267,8 @@ argument list and OPTS is the option alist."
            (args     (option-arguments opts))
            (command  (assoc-ref opts 'action)))
       (parameterize ((%graft? (assoc-ref opts 'graft?)))
-        (with-status-report (if (memq command '(init reconfigure))
-                                print-build-event/quiet
-                                print-build-event)
+        (with-status-verbosity (if (memq command '(init reconfigure))
+                                   1 2)
           (process-command command args opts))))))
 
 ;;; Local Variables:
diff --git a/guix/status.scm b/guix/status.scm
index d4fc4ca16e..ddbf461739 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -63,7 +63,8 @@
             print-build-event/quiet
             print-build-status
 
-            with-status-report))
+            with-status-report
+            with-status-verbosity))
 
 ;;; Commentary:
 ;;;
@@ -651,3 +652,17 @@ The second return value is a thunk to retrieve the current state."
   "Set up build status reporting to the user using the ON-EVENT procedure;
 evaluate EXP... in that context."
   (call-with-status-report on-event (lambda () exp ...)))
+
+(define (logger-for-level level)
+  "Return the logging procedure that corresponds to LEVEL."
+  (cond ((<= level 0) (const #t))
+        ((= level 1)  print-build-event/quiet)
+        (else         print-build-event)))
+
+(define (call-with-status-verbosity level thunk)
+  (call-with-status-report (logger-for-level level) thunk))
+
+(define-syntax-rule (with-status-verbosity level exp ...)
+  "Set up build status reporting to the user at the given LEVEL: 0 means
+silent, 1 means quiet, 2 means verbose.  Evaluate EXP... in that context."
+  (call-with-status-verbosity level (lambda () exp ...)))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#34020] [PATCH 2/2] guix build: Re-purpose '--verbosity' and add '--debug'.
  2019-01-09 13:33 ` [bug#34020] [PATCH 1/2] status: Add 'with-status-verbosity' Ludovic Courtès
@ 2019-01-09 13:33   ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2019-01-09 13:33 UTC (permalink / raw)
  To: 34020

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.
* doc/guix.texi (Common Build Options): Document '--verbosity' and
'--debug'.
(Additional Build Options): Adjust description of '--quiet'.
---
 doc/guix.texi                |  30 ++++----
 guix/scripts/build.scm       | 134 ++++++++++++++++++-----------------
 guix/scripts/environment.scm |  12 +++-
 guix/scripts/pack.scm        |  12 +++-
 guix/scripts/package.scm     |  21 ++++--
 guix/scripts/pull.scm        |  12 +++-
 guix/scripts/system.scm      |  15 +++-
 7 files changed, 142 insertions(+), 94 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index fcb5b8c088..b308bcdf0a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17,7 +17,7 @@
 @set SUBSTITUTE-SERVER ci.guix.info
 
 @copying
-Copyright @copyright{} 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès@*
+Copyright @copyright{} 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès@*
 Copyright @copyright{} 2013, 2014, 2016 Andreas Enge@*
 Copyright @copyright{} 2013 Nikita Karetnikov@*
 Copyright @copyright{} 2014, 2015, 2016 Alex Kost@*
@@ -2098,10 +2098,6 @@ By default, @command{guix package} reports as an error @dfn{collisions}
 in the profile.  Collisions happen when two or more different versions
 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
 Use the bootstrap Guile to build the profile.  This option is only
 useful to distribution developers.
@@ -6360,10 +6356,15 @@ Likewise, when the build or substitution process lasts for more than
 By default, the daemon's setting is honored (@pxref{Invoking
 guix-daemon, @code{--timeout}}).
 
-@item --verbosity=@var{level}
-Use the given verbosity level.  @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.
+@c Note: This option is actually not part of %standard-build-options but
+@c most programs honor it.
+@cindex verbosity, of the command-line tools
+@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}
 @itemx -c @var{n}
@@ -6376,6 +6377,11 @@ Allow at most @var{n} build jobs in parallel.  @xref{Invoking
 guix-daemon, @code{--max-jobs}}, for details about this option and the
 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
 
 Behind the scenes, @command{guix build} is essentially an interface to
@@ -6544,9 +6550,9 @@ build}.
 
 @item --quiet
 @itemx -q
-Build quietly, without displaying the build log.  Upon completion, the
-build log is kept in @file{/var} (or similar) and can always be
-retrieved using the @option{--log-file} option.
+Build quietly, without displaying the build log; this is equivalent to
+@code{--verbosity=0}.  Upon completion, the build log is kept in @file{/var}
+(or similar) and can always be retrieved using the @option{--log-file} option.
 
 @item --file=@var{file}
 @itemx -f @var{file}
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 564bdf0ced..5a158799ae 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -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"))
   (display (G_ "
       --timeout=SECONDS  mark the build as failed after SECONDS of activity"))
-  (display (G_ "
-      --verbosity=LEVEL  use the given verbosity LEVEL"))
   (display (G_ "
       --rounds=N         build N times in a row to detect non-determinism"))
   (display (G_ "
   -c, --cores=N          allow the use of up to N CPU cores for the build"))
   (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)
   "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?)
                      #: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*
   (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
                          (alist-cons 'timeout (string->number* arg) result)
                          rest)))
-        (option '("verbosity") #t #f
+        (option '("debug") #t #f
                 (lambda (opt name arg result . rest)
-                  (let ((level (string->number arg)))
+                  (let ((level (string->number* arg)))
                     (apply values
-                           (alist-cons 'verbosity level
-                                       (alist-delete 'verbosity result))
+                           (alist-cons 'debug level
+                                       (alist-delete 'debug result))
                            rest))))
         (option '(#\c "cores") #t #f
                 (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-extended-build-trace? . #t)
     (multiplexed-build-output? . #t)
-    (verbosity . 0)))
+    (verbosity . 2)
+    (debug . 0)))
 
 (define (show-help)
   (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
                          as a garbage collector root"))
   (display (G_ "
+  -v, --verbosity=LEVEL  use the given verbosity LEVEL"))
+  (display (G_ "
   -q, --quiet            do not show the build log"))
   (display (G_ "
       --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
                  (lambda (opt name 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
                  (lambda (opt name arg result)
-                   (alist-cons 'quiet? #t result)))
+                   (alist-cons 'verbosity 0
+                               (alist-delete 'verbosity result))))
          (option '("log-file") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'log-file? #t result)))
@@ -819,66 +828,59 @@ needed."
     (parse-command-line args %options
                         (list %default-options)))
 
-  (define quiet?
-    (assoc-ref opts 'quiet?))
-
   (with-error-handling
     ;; Ask for absolute file names so that .drv file names passed from the
     ;; user to 'read-derivation' are absolute when it returns.
     (with-fluids ((%file-port-name-canonicalization 'absolute))
-      (with-store store
-        ;; Set the build options before we do anything else.
-        (set-build-options-from-command-line store opts)
+      (with-status-verbosity (assoc-ref opts 'verbosity)
+        (with-store store
+          ;; Set the build options before we do anything else.
+          (set-build-options-from-command-line store opts)
 
-        (parameterize ((current-terminal-columns (terminal-columns))
-                       (current-build-output-port
-                        (if quiet?
-                            (%make-void-port "w")
-                            (build-event-output-port
-                             (build-status-updater print-build-event)))))
-          (let* ((mode  (assoc-ref opts 'build-mode))
-                 (drv   (options->derivations store opts))
-                 (urls  (map (cut string-append <> "/log")
-                             (if (assoc-ref opts 'substitutes?)
-                                 (or (assoc-ref opts 'substitute-urls)
-                                     ;; XXX: This does not necessarily match the
-                                     ;; daemon's substitute URLs.
-                                     %default-substitute-urls)
-                                 '())))
-                 (items (filter-map (match-lambda
-                                      (('argument . (? store-path? file))
-                                       file)
-                                      (_ #f))
-                                    opts))
-                 (roots (filter-map (match-lambda
-                                      (('gc-root . root) root)
-                                      (_ #f))
-                                    opts)))
+          (parameterize ((current-terminal-columns (terminal-columns)))
+            (let* ((mode  (assoc-ref opts 'build-mode))
+                   (drv   (options->derivations store opts))
+                   (urls  (map (cut string-append <> "/log")
+                               (if (assoc-ref opts 'substitutes?)
+                                   (or (assoc-ref opts 'substitute-urls)
+                                       ;; XXX: This does not necessarily match the
+                                       ;; daemon's substitute URLs.
+                                       %default-substitute-urls)
+                                   '())))
+                   (items (filter-map (match-lambda
+                                        (('argument . (? store-path? file))
+                                         file)
+                                        (_ #f))
+                                      opts))
+                   (roots (filter-map (match-lambda
+                                        (('gc-root . root) root)
+                                        (_ #f))
+                                      opts)))
 
-            (unless (or (assoc-ref opts 'log-file?)
-                        (assoc-ref opts 'derivations-only?))
-              (show-what-to-build store drv
-                                  #:use-substitutes?
-                                  (assoc-ref opts 'substitutes?)
-                                  #:dry-run? (assoc-ref opts 'dry-run?)
-                                  #:mode mode))
+              (unless (or (assoc-ref opts 'log-file?)
+                          (assoc-ref opts 'derivations-only?))
+                (show-what-to-build store drv
+                                    #:use-substitutes?
+                                    (assoc-ref opts 'substitutes?)
+                                    #:dry-run? (assoc-ref opts 'dry-run?)
+                                    #:mode mode))
 
-            (cond ((assoc-ref opts 'log-file?)
-                   (for-each (cut show-build-log store <> urls)
-                             (delete-duplicates
-                              (append (map derivation-file-name drv)
-                                      items))))
-                  ((assoc-ref opts 'derivations-only?)
-                   (format #t "~{~a~%~}" (map derivation-file-name drv))
-                   (for-each (cut register-root store <> <>)
-                             (map (compose list derivation-file-name) drv)
-                             roots))
-                  ((not (assoc-ref opts 'dry-run?))
-                   (and (build-derivations store drv mode)
-                        (for-each show-derivation-outputs drv)
-                        (for-each (cut register-root store <> <>)
-                                  (map (lambda (drv)
-                                         (map cdr
-                                              (derivation->output-paths drv)))
-                                       drv)
-                                  roots))))))))))
+              (cond ((assoc-ref opts 'log-file?)
+                     (for-each (cut show-build-log store <> urls)
+                               (delete-duplicates
+                                (append (map derivation-file-name drv)
+                                        items))))
+                    ((assoc-ref opts 'derivations-only?)
+                     (format #t "~{~a~%~}" (map derivation-file-name drv))
+                     (for-each (cut register-root store <> <>)
+                               (map (compose list derivation-file-name) drv)
+                               roots))
+                    ((not (assoc-ref opts 'dry-run?))
+                     (and (build-derivations store drv mode)
+                          (for-each show-derivation-outputs drv)
+                          (for-each (cut register-root store <> <>)
+                                    (map (lambda (drv)
+                                           (map cdr
+                                                (derivation->output-paths drv)))
+                                         drv)
+                                    roots)))))))))))
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 9461d04976..116b8dcbce 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -157,6 +157,8 @@ COMMAND or an interactive shell in that environment.\n"))
   (display (G_ "
       --expose=SPEC      for containers, expose read-only host file system
                          according to SPEC"))
+  (display (G_ "
+  -v, --verbosity=LEVEL  use the given verbosity LEVEL"))
   (display (G_ "
       --bootstrap        use bootstrap binaries to build the environment"))
   (newline)
@@ -179,7 +181,8 @@ COMMAND or an interactive shell in that environment.\n"))
     (print-build-trace? . #t)
     (print-extended-build-trace? . #t)
     (multiplexed-build-output? . #t)
-    (verbosity . 0)))
+    (debug . 0)
+    (verbosity . 2)))
 
 (define (tag-package-arg opts arg)
   "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
                  (lambda (opt name 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
                  (lambda (opt name arg result)
                    (alist-cons 'bootstrap? #t result)))
@@ -674,7 +682,7 @@ message if any test fails."
         (leave (G_ "'--user' cannot be used without '--container'~%")))
 
       (with-store store
-        (with-status-verbosity 1
+        (with-status-verbosity (assoc-ref opts 'verbosity)
           (define manifest
             (options/resolve-packages store opts))
 
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 173bdd1ef1..003ba7b939 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -600,7 +600,8 @@ please email '~a'~%")
     (print-build-trace? . #t)
     (print-extended-build-trace? . #t)
     (multiplexed-build-output? . #t)
-    (verbosity . 0)
+    (debug . 0)
+    (verbosity . 2)
     (symlinks . ())
     (compressor . ,(first %compressors))))
 
@@ -687,6 +688,11 @@ please email '~a'~%")
                       (alist-cons 'profile-name arg result))
                      (_
                       (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
                  (lambda (opt name arg result)
                    (alist-cons 'bootstrap? #t result)))
@@ -724,6 +730,8 @@ Create a bundle of PACKAGE.\n"))
   (display (G_ "
       --profile-name=NAME
                          populate /var/guix/profiles/.../NAME"))
+  (display (G_ "
+  -v, --verbosity=LEVEL  use the given verbosity LEVEL"))
   (display (G_ "
       --bootstrap        use the bootstrap binaries to build the pack"))
   (newline)
@@ -774,7 +782,7 @@ Create a bundle of PACKAGE.\n"))
 
   (with-error-handling
     (with-store store
-      (with-status-verbosity 2
+      (with-status-verbosity (assoc-ref opts 'verbosity)
         ;; Set the build options before we do anything else.
         (set-build-options-from-command-line store opts)
 
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 876787fbe2..7ff6bfd6d8 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -293,7 +293,8 @@ ENTRIES, a list of manifest entries, in the context of PROFILE."
 
 (define %default-options
   ;; Alist of default option values.
-  `((verbosity . 0)
+  `((verbosity . 1)
+    (debug . 0)
     (graft? . #t)
     (substitutes? . #t)
     (build-hook? . #t)
@@ -346,7 +347,7 @@ Install, remove, or upgrade packages in a single transaction.\n"))
   (display (G_ "
       --bootstrap        use the bootstrap Guile to build the profile"))
   (display (G_ "
-      --verbose          produce verbose output"))
+  -v, --verbosity=LEVEL  use the given verbosity LEVEL"))
   (newline)
   (display (G_ "
   -s, --search=REGEXP    search in synopsis and description using REGEXP"))
@@ -472,13 +473,21 @@ kind of search path~%")
                    (values (alist-cons 'dry-run? #t
                                        (alist-cons 'graft? #f result))
                            #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
                  (lambda (opt name arg result arg-handler)
                    (values (alist-cons 'bootstrap? #t result)
                            #f)))
-         (option '("verbose") #f #f
+         (option '("verbose") #f #f               ;deprecated
                  (lambda (opt name arg result arg-handler)
-                   (values (alist-cons 'verbose? #t result)
+                   (values (alist-cons 'verbosity 2
+                                       (alist-delete 'verbosity
+                                                     result))
                            #f)))
          (option '("allow-collisions") #f #f
                  (lambda (opt name arg result arg-handler)
@@ -907,14 +916,12 @@ processed, #f otherwise."
   (define opts
     (parse-command-line args %options (list %default-options #f)
                         #:argument-handler handle-argument))
-  (define verbose?
-    (assoc-ref opts 'verbose?))
 
   (with-error-handling
     (or (process-query opts)
         (parameterize ((%store  (open-connection))
                        (%graft? (assoc-ref opts 'graft?)))
-          (with-status-verbosity 1
+          (with-status-verbosity (assoc-ref opts 'verbosity)
             (set-build-options-from-command-line (%store) opts)
             (parameterize ((%guile-for-build
                             (package-derivation
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 6389d5ec09..6d1914f7c2 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -66,7 +66,8 @@
     (print-extended-build-trace? . #t)
     (multiplexed-build-output? . #t)
     (graft? . #t)
-    (verbosity . 0)))
+    (debug . 0)
+    (verbosity . 2)))
 
 (define (show-help)
   (display (G_ "Usage: guix pull [OPTION]...
@@ -89,6 +90,8 @@ Download and deploy the latest version of Guix.\n"))
   (display (G_ "
   -n, --dry-run          show what would be pulled and built"))
   (display (G_ "
+  -v, --verbosity=LEVEL  use the given verbosity LEVEL"))
+  (display (G_ "
   -s, --system=SYSTEM    attempt to build for SYSTEM--e.g., \"i686-linux\""))
   (display (G_ "
       --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
                  (lambda (opt name arg 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
                  (lambda (opt name arg result)
                    (alist-cons 'bootstrap? #t result)))
@@ -510,7 +518,7 @@ Use '~/.config/guix/channels.scm' instead."))
               (process-query opts profile))
              (else
               (with-store store
-                (with-status-verbosity 2
+                (with-status-verbosity (assoc-ref opts 'verbosity)
                   (parameterize ((%current-system (assoc-ref opts 'system))
                                  (%graft? (assoc-ref opts 'graft?))
                                  (%repository-cache-directory cache))
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 9e31baaddb..569b826acd 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -1015,6 +1015,8 @@ Some ACTIONS support additional ARGS.\n"))
       --full-boot        for 'vm', make a full boot sequence"))
   (display (G_ "
       --skip-checks      skip file system and initrd module safety checks"))
+  (display (G_ "
+  -v, --verbosity=LEVEL  use the given verbosity LEVEL"))
   (newline)
   (display (G_ "
   -h, --help             display this help and exit"))
@@ -1074,6 +1076,11 @@ Some ACTIONS support additional ARGS.\n"))
          (option '(#\n "dry-run") #f #f
                  (lambda (opt name arg 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
                  (lambda (opt name arg result)
                    (alist-cons 'system arg
@@ -1092,7 +1099,8 @@ Some ACTIONS support additional ARGS.\n"))
     (print-extended-build-trace? . #t)
     (multiplexed-build-output? . #t)
     (graft? . #t)
-    (verbosity . 0)
+    (debug . 0)
+    (verbosity . #f)                              ;default
     (file-system-type . "ext4")
     (image-size . guess)
     (install-bootloader? . #t)))
@@ -1267,8 +1275,9 @@ argument list and OPTS is the option alist."
            (args     (option-arguments opts))
            (command  (assoc-ref opts 'action)))
       (parameterize ((%graft? (assoc-ref opts 'graft?)))
-        (with-status-verbosity (if (memq command '(init reconfigure))
-                                   1 2)
+        (with-status-verbosity (or (assoc-ref opts 'verbosity)
+                                   (if (memq command '(init reconfigure))
+                                       1 2))
           (process-command command args opts))))))
 
 ;;; Local Variables:
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful
  2019-01-09 13:31 [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful Ludovic Courtès
  2019-01-09 13:33 ` [bug#34020] [PATCH 1/2] status: Add 'with-status-verbosity' Ludovic Courtès
@ 2019-01-10  3:38 ` Mike Gerwitz
  2019-01-11 11:15   ` bug#34020: " Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Mike Gerwitz @ 2019-01-10  3:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 34020

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]

On Wed, Jan 09, 2019 at 14:31:45 +0100, Ludovic Courtès wrote:
> These patches re-purposes ‘--verbosity’ so that it better matches
> user expectations.  The previous ‘--verbosity’ option, which is
> about the daemon’s debugging output, is renamed to ‘--debug’.
> In addition, ‘--verbosity’ now has a shorthand ‘-v’.
>
> Most commands that build stuff support -v/--verbosity so users can
> easily override the default verbosity level.
>
> Thoughts?

(Just having looked at the patches, without actually trying it out.)

This is much better, thank you!  I was confused by the previous behavior.

-- 
Mike Gerwitz

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#34020: [PATCH 0/2] Re-purpose '--verbosity' to something useful
  2019-01-10  3:38 ` [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful Mike Gerwitz
@ 2019-01-11 11:15   ` Ludovic Courtès
  2019-01-11 14:02     ` ng0
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2019-01-11 11:15 UTC (permalink / raw)
  To: Mike Gerwitz; +Cc: 34020-done

Hi,

Mike Gerwitz <mtg@gnu.org> skribis:

> On Wed, Jan 09, 2019 at 14:31:45 +0100, Ludovic Courtès wrote:
>> These patches re-purposes ‘--verbosity’ so that it better matches
>> user expectations.  The previous ‘--verbosity’ option, which is
>> about the daemon’s debugging output, is renamed to ‘--debug’.
>> In addition, ‘--verbosity’ now has a shorthand ‘-v’.
>>
>> Most commands that build stuff support -v/--verbosity so users can
>> easily override the default verbosity level.
>>
>> Thoughts?
>
> (Just having looked at the patches, without actually trying it out.)
>
> This is much better, thank you!  I was confused by the previous behavior.

Thanks for your feedback, pushed now!

I’ve also adjust ‘guix archive’, which I had forgotten in the patch I
sent.

Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bug#34020: [PATCH 0/2] Re-purpose '--verbosity' to something useful
  2019-01-11 11:15   ` bug#34020: " Ludovic Courtès
@ 2019-01-11 14:02     ` ng0
  2019-01-13 20:55       ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: ng0 @ 2019-01-11 14:02 UTC (permalink / raw)
  To: Ludovic Court=C3=A8s; +Cc: guix-devel

Would you be open for a patch which adds BSD familiar -v behavior?
In other words, multiple v increase the verbosity level, like -vv is more
verbose than -v. I'll have to check the actual changes first, haven't had
access to something which runs plain Guix in a while.

On Fri, 11 Jan 2019 12:15:41 +0100, Ludovic Courtès <ludo@gnu.org> wrote:

> Hi,
> 
> Mike Gerwitz <mtg@gnu.org> skribis:
> 
> > On Wed, Jan 09, 2019 at 14:31:45 +0100, Ludovic Courtès wrote:
> >> These patches re-purposes ‘--verbosity’ so that it better matches
> >> user expectations.  The previous ‘--verbosity’ option, which is
> >> about the daemon’s debugging output, is renamed to ‘--debug’.
> >> In addition, ‘--verbosity’ now has a shorthand ‘-v’.
> >>
> >> Most commands that build stuff support -v/--verbosity so users can
> >> easily override the default verbosity level.
> >>
> >> Thoughts?
> >
> > (Just having looked at the patches, without actually trying it out.)
> >
> > This is much better, thank you!  I was confused by the previous behavior.
> 
> Thanks for your feedback, pushed now!
> 
> I’ve also adjust ‘guix archive’, which I had forgotten in the patch I
> sent.
> 
> Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bug#34020: [PATCH 0/2] Re-purpose '--verbosity' to something useful
  2019-01-11 14:02     ` ng0
@ 2019-01-13 20:55       ` Ludovic Courtès
  2019-01-13 21:01         ` ng0
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2019-01-13 20:55 UTC (permalink / raw)
  To: ng0; +Cc: guix-devel

Hi ng0,

<ng0@n0.is> skribis:

> Would you be open for a patch which adds BSD familiar -v behavior?
> In other words, multiple v increase the verbosity level, like -vv is more
> verbose than -v. I'll have to check the actual changes first, haven't had
> access to something which runs plain Guix in a while.

I don’t think (srfi srfi-37) would be able to parse it correctly, and
I’d also prefer to keep a single way to do that.

I like that ‘-vN’ is unambiguous: if you type ‘-v2’, you know you’ll get
exactly level 2 regardless of what options came before (and might come
from $GUIX_BUILD_OPTIONS, etc.)

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bug#34020: [PATCH 0/2] Re-purpose '--verbosity' to something useful
  2019-01-13 20:55       ` Ludovic Courtès
@ 2019-01-13 21:01         ` ng0
  0 siblings, 0 replies; 8+ messages in thread
From: ng0 @ 2019-01-13 21:01 UTC (permalink / raw)
  To: Ludovic Court=C3=A8s; +Cc: guix-devel

Okay, seems reasonable as well.

On Sun, 13 Jan 2019 21:55:55 +0100, Ludovic Courtès <ludo@gnu.org> wrote:

> Hi ng0,
> 
> <ng0@n0.is> skribis:
> 
> > Would you be open for a patch which adds BSD familiar -v behavior?
> > In other words, multiple v increase the verbosity level, like -vv is more
> > verbose than -v. I'll have to check the actual changes first, haven't had
> > access to something which runs plain Guix in a while.
> 
> I don’t think (srfi srfi-37) would be able to parse it correctly, and
> I’d also prefer to keep a single way to do that.
> 
> I like that ‘-vN’ is unambiguous: if you type ‘-v2’, you know you’ll get
> exactly level 2 regardless of what options came before (and might come
> from $GUIX_BUILD_OPTIONS, etc.)
> 
> Thanks,
> Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-01-13 21:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-09 13:31 [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful Ludovic Courtès
2019-01-09 13:33 ` [bug#34020] [PATCH 1/2] status: Add 'with-status-verbosity' Ludovic Courtès
2019-01-09 13:33   ` [bug#34020] [PATCH 2/2] guix build: Re-purpose '--verbosity' and add '--debug' Ludovic Courtès
2019-01-10  3:38 ` [bug#34020] [PATCH 0/2] Re-purpose '--verbosity' to something useful Mike Gerwitz
2019-01-11 11:15   ` bug#34020: " Ludovic Courtès
2019-01-11 14:02     ` ng0
2019-01-13 20:55       ` Ludovic Courtès
2019-01-13 21:01         ` ng0

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.