unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#42481] [PATCH 0/2] Printing a more concise build plan
@ 2020-07-22 21:40 Ludovic Courtès
  2020-07-22 21:46 ` [bug#42481] [PATCH 1/2] ui: Add #:verbosity to 'show-what-to-build' Ludovic Courtès
  2020-07-31 16:34 ` [bug#42481] [PATCH 0/2] Printing a more concise build plan Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2020-07-22 21:40 UTC (permalink / raw)
  To: 42481; +Cc: Ludovic Courtès

Hello Guix!

These patches implement a suggestion Pierre made a while back:
showing by default fewer details about what will/would be built
or downloaded, and omitting info about grafts and hooks.

The verbosity level here is controlled via the existing
‘--verbosity’ or ‘-v’ flag (which thus now control two things).

Here are examples of the result:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix system disk-image --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl -n --no-grafts
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
The following derivations would be built:
   /gnu/store/y2inlprxbigqvknm5qwjwsqgljxfbri4-disk-image.drv
   /gnu/store/gclxh7i8smp71hz0p7wcj6qkf377wigy-image-dir.drv
   /gnu/store/21fin1j5pnjzfwbc70wdpzl3iyjym8xp-genimage.cfg.drv
   /gnu/store/aqcziad6ghfaainjibpdfypc8m2rr1vm-partition.img.drv
   /gnu/store/484d4fd9q9827bc09ia8bi1dgxl8gpwn-grub.cfg.drv
   /gnu/store/nnldmy339w9xxnybir48w14yz2xk0pmx-system.drv

[...]

   /gnu/store/ddxz08xvasphckdralifb624y3c7hrkx-rc.drv
   /gnu/store/kq9qvn0m063m02cxf4kjipkf6x8vbvip-profile.drv
   /gnu/store/y9if6nrykcqfnzxvb4cci2nzhmz1ipx5-parameters.drv
   /gnu/store/w09j0p6126qcacylb455m5dn008yi04g-module-import.drv
49.9 MB would be downloaded
--8<---------------cut here---------------end--------------->8---

Same with grafts:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix system disk-image --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl -n
36.2 MB would be downloaded
--8<---------------cut here---------------end--------------->8---

With ‘guix package’:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix install vim-full krita -n
The following packages would be installed:
   vim-full 8.2.1145
   krita    4.2.9

76.9 MB would be downloaded
$ ./pre-inst-env guix install vim-full krita -n --no-grafts
The following packages would be installed:
   vim-full 8.2.1145
   krita    4.2.9

The following derivation would be built:
   /gnu/store/shf0anw8l0y9hg4l8qp1fym4bvwq5kh9-profile.drv
76.9 MB would be downloaded
$ ./pre-inst-env guix install inkscape hugin -n
The following package would be upgraded:
   inkscape (dependencies or package changed)

The following package would be installed:
   hugin 2019.2.0

The following derivation would be built:
   /gnu/store/lsi56ap8lzchfy8y76y7wirzfiqvb3ca-hugin-2019.2.0.drv
46.2 MB would be downloaded
--8<---------------cut here---------------end--------------->8---

The current behavior is obtain with ‘-v2’, which remains the
default for ‘guix build’:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build inkscape hugin -n
The following derivation would be built:
   /gnu/store/lsi56ap8lzchfy8y76y7wirzfiqvb3ca-hugin-2019.2.0.drv
46.2 MB would be downloaded:
   /gnu/store/3jvjmwm0srgxxjwngv28bif8l4ksfbnp-autotrace-0.40.0-20190624.59
   /gnu/store/gg36g9h2nzmq4dzrcr21ndb09nybqys0-inkscape-1.0
   /gnu/store/n94n0ggdhck5a2prsd1r468x3p6i68p4-enblend-enfuse-4.2
   /gnu/store/89rj5fqcg48afgk99639ds602pgf92k4-cmake-minimal-3.16.5
   /gnu/store/0i4h5cf1a71pj319svzz88g2z07cvdk3-wxwidgets-3.0.5.1
   /gnu/store/bwz9f0lg9lxscj6jfcgxmzqng3s1f1n3-vigra-1.11.1
--8<---------------cut here---------------end--------------->8---

It’s also possible to use ‘-v0’ now.

How does that sound?

Personally, I’m find it a bit disconcerting that so few is displayed
when substitutes are available, but it also feels more “lightweight”
this way.  I really like that what would be built appears clearly,
whereas now you have to scroll up possibly several pages to find
that info, especially upon ‘guix upgrade’.

Feedback welcome!

Ludo’.

Ludovic Courtès (2):
  ui: Add #:verbosity to 'show-what-to-build'.
  scripts: Pass #:verbosity to 'build-notifier'.

 guix/scripts/archive.scm     |   2 +
 guix/scripts/build.scm       |   2 +
 guix/scripts/copy.scm        |   2 +
 guix/scripts/deploy.scm      |   4 +-
 guix/scripts/environment.scm |   2 +
 guix/scripts/pack.scm        |   2 +
 guix/scripts/package.scm     |   2 +
 guix/scripts/pull.scm        |   2 +
 guix/scripts/system.scm      |  11 ++-
 guix/ui.scm                  | 175 ++++++++++++++++++++++-------------
 10 files changed, 135 insertions(+), 69 deletions(-)

-- 
2.27.0





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

* [bug#42481] [PATCH 1/2] ui: Add #:verbosity to 'show-what-to-build'.
  2020-07-22 21:40 [bug#42481] [PATCH 0/2] Printing a more concise build plan Ludovic Courtès
@ 2020-07-22 21:46 ` Ludovic Courtès
  2020-07-22 21:46   ` [bug#42481] [PATCH 2/2] scripts: Pass #:verbosity to 'build-notifier' Ludovic Courtès
  2020-07-31 16:34 ` [bug#42481] [PATCH 0/2] Printing a more concise build plan Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2020-07-22 21:46 UTC (permalink / raw)
  To: 42481; +Cc: Ludovic Courtès

* guix/ui.scm (%default-verbosity): New variable.
(show-what-to-build): Add #:verbosity and honor it.
(build-notifier): Add #:verbosity and pass it to 'show-what-to-build'.
---
 guix/ui.scm | 175 ++++++++++++++++++++++++++++++++--------------------
 1 file changed, 109 insertions(+), 66 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 27bcade9dd..b8376c11a1 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -931,17 +931,25 @@ that the rest."
                                         (color DARK))
                        (string-drop file prefix)))))
 
+(define %default-verbosity
+  ;; Default verbosity level for 'show-what-to-build'.
+  2)
+
 (define* (show-what-to-build store drv
                              #:key dry-run? (use-substitutes? #t)
+                             (verbosity %default-verbosity)
                              (mode (build-mode normal)))
   "Show what will or would (depending on DRY-RUN?) be built in realizing the
 derivations listed in DRV using MODE, a 'build-mode' value.  The elements of
 DRV can be either derivations or derivation inputs.
 
 Return two values: a Boolean indicating whether there's something to build,
-and a Boolean indicating whether there's something to download.  When
-USE-SUBSTITUTES?, check and report what is prerequisites are available for
-download."
+and a Boolean indicating whether there's something to download.
+
+When USE-SUBSTITUTES?, check and report what is prerequisites are available
+for download.  VERBOSITY is an integer indicating the level of details to be
+shown: level 2 and higher provide all the details, level 1 shows a high-level
+summary, and level 0 shows nothing."
   (define inputs
     (map (match-lambda
            ((? derivation? drv) (derivation-input drv))
@@ -1000,71 +1008,104 @@ download."
       ;; display when we have information for all of DOWNLOAD.
       (not (any (compose zero? substitutable-download-size) download)))
 
+    ;; Combinatorial explosion ahead along two axes: DRY-RUN? and VERBOSITY.
+    ;; Unfortunately, this is hardly avoidable for proper i18n.
     (if dry-run?
         (begin
-          (format (current-error-port)
-                  (N_ "~:[The following derivation would be built:~%~{   ~a~%~}~;~]"
-                      "~:[The following derivations would be built:~%~{   ~a~%~}~;~]"
-                      (length build))
-                  (null? build) (map colorized-store-item build))
-          (if display-download-size?
-              (format (current-error-port)
-                      ;; TRANSLATORS: "MB" is for "megabyte"; it should be
-                      ;; translated to the corresponding abbreviation.
-                      (G_ "~:[~,1h MB would be downloaded:~%~{   ~a~%~}~;~]")
-                      (null? download)
-                      download-size
-                      (map (compose colorized-store-item substitutable-path)
-                           download))
-              (format (current-error-port)
-                      (N_ "~:[The following file would be downloaded:~%~{   ~a~%~}~;~]"
-                          "~:[The following files would be downloaded:~%~{   ~a~%~}~;~]"
-                          (length download))
-                      (null? download)
-                      (map (compose colorized-store-item substitutable-path)
-                           download)))
-          (format (current-error-port)
-                  (N_ "~:[The following graft would be made:~%~{   ~a~%~}~;~]"
-                      "~:[The following grafts would be made:~%~{   ~a~%~}~;~]"
-                      (length graft))
-                  (null? graft) (map colorized-store-item graft))
-          (format (current-error-port)
-                  (N_ "~:[The following profile hook would be built:~%~{   ~a~%~}~;~]"
-                      "~:[The following profile hooks would be built:~%~{   ~a~%~}~;~]"
-                      (length hook))
-                  (null? hook) (map colorized-store-item hook)))
+          (unless (zero? verbosity)
+            (format (current-error-port)
+                    (N_ "~:[The following derivation would be built:~%~{   ~a~%~}~;~]"
+                        "~:[The following derivations would be built:~%~{   ~a~%~}~;~]"
+                        (length build))
+                    (null? build) (map colorized-store-item build)))
+          (cond ((>= verbosity 2)
+                 (if display-download-size?
+                     (format (current-error-port)
+                             ;; TRANSLATORS: "MB" is for "megabyte"; it should be
+                             ;; translated to the corresponding abbreviation.
+                             (G_ "~:[~,1h MB would be downloaded:~%~{   ~a~%~}~;~]")
+                             (null? download)
+                             download-size
+                             (map (compose colorized-store-item substitutable-path)
+                                  download))
+                     (format (current-error-port)
+                             (N_ "~:[The following file would be downloaded:~%~{   ~a~%~}~;~]"
+                                 "~:[The following files would be downloaded:~%~{   ~a~%~}~;~]"
+                                 (length download))
+                             (null? download)
+                             (map (compose colorized-store-item substitutable-path)
+                                  download)))
+                 (format (current-error-port)
+                         (N_ "~:[The following graft would be made:~%~{   ~a~%~}~;~]"
+                             "~:[The following grafts would be made:~%~{   ~a~%~}~;~]"
+                             (length graft))
+                         (null? graft) (map colorized-store-item graft))
+                 (format (current-error-port)
+                         (N_ "~:[The following profile hook would be built:~%~{   ~a~%~}~;~]"
+                             "~:[The following profile hooks would be built:~%~{   ~a~%~}~;~]"
+                             (length hook))
+                         (null? hook) (map colorized-store-item hook)))
+                ((= verbosity 1)
+                 ;; Display the bare minimum; don't mention grafts and hooks.
+                 (if display-download-size?
+                     (format (current-error-port)
+                             ;; TRANSLATORS: "MB" is for "megabyte"; it should be
+                             ;; translated to the corresponding abbreviation.
+                             (G_ "~:[~,1h MB would be downloaded~%~;~]")
+                             (null? download) download-size)
+                     (format (current-error-port)
+                             (N_ "~:[~h item would be downloaded~%~;~]"
+                                 "~:[~h items would be downloaded~%~;~]"
+                                 (length download))
+                             (null? download) (length download))))))
+
         (begin
-          (format (current-error-port)
-                  (N_ "~:[The following derivation will be built:~%~{   ~a~%~}~;~]"
-                      "~:[The following derivations will be built:~%~{   ~a~%~}~;~]"
-                      (length build))
-                  (null? build) (map colorized-store-item build))
-          (if display-download-size?
-              (format (current-error-port)
-                      ;; TRANSLATORS: "MB" is for "megabyte"; it should be
-                      ;; translated to the corresponding abbreviation.
-                      (G_ "~:[~,1h MB will be downloaded:~%~{   ~a~%~}~;~]")
-                      (null? download)
-                      download-size
-                      (map (compose colorized-store-item substitutable-path)
-                           download))
-              (format (current-error-port)
-                      (N_ "~:[The following file will be downloaded:~%~{   ~a~%~}~;~]"
-                          "~:[The following files will be downloaded:~%~{   ~a~%~}~;~]"
-                          (length download))
-                      (null? download)
-                      (map (compose colorized-store-item substitutable-path)
-                           download)))
-          (format (current-error-port)
-                  (N_ "~:[The following graft will be made:~%~{   ~a~%~}~;~]"
-                      "~:[The following grafts will be made:~%~{   ~a~%~}~;~]"
-                      (length graft))
-                  (null? graft) (map colorized-store-item graft))
-          (format (current-error-port)
-                  (N_ "~:[The following profile hook will be built:~%~{   ~a~%~}~;~]"
-                      "~:[The following profile hooks will be built:~%~{   ~a~%~}~;~]"
-                      (length hook))
-                  (null? hook) (map colorized-store-item hook))))
+          (unless (zero? verbosity)
+            (format (current-error-port)
+                    (N_ "~:[The following derivation will be built:~%~{   ~a~%~}~;~]"
+                        "~:[The following derivations will be built:~%~{   ~a~%~}~;~]"
+                        (length build))
+                    (null? build) (map colorized-store-item build)))
+          (cond ((>= verbosity 2)
+                 (if display-download-size?
+                     (format (current-error-port)
+                             ;; TRANSLATORS: "MB" is for "megabyte"; it should be
+                             ;; translated to the corresponding abbreviation.
+                             (G_ "~:[~,1h MB will be downloaded:~%~{   ~a~%~}~;~]")
+                             (null? download)
+                             download-size
+                             (map (compose colorized-store-item substitutable-path)
+                                  download))
+                     (format (current-error-port)
+                             (N_ "~:[The following file will be downloaded:~%~{   ~a~%~}~;~]"
+                                 "~:[The following files will be downloaded:~%~{   ~a~%~}~;~]"
+                                 (length download))
+                             (null? download)
+                             (map (compose colorized-store-item substitutable-path)
+                                  download)))
+                 (format (current-error-port)
+                         (N_ "~:[The following graft will be made:~%~{   ~a~%~}~;~]"
+                             "~:[The following grafts will be made:~%~{   ~a~%~}~;~]"
+                             (length graft))
+                         (null? graft) (map colorized-store-item graft))
+                 (format (current-error-port)
+                         (N_ "~:[The following profile hook will be built:~%~{   ~a~%~}~;~]"
+                             "~:[The following profile hooks will be built:~%~{   ~a~%~}~;~]"
+                             (length hook))
+                         (null? hook) (map colorized-store-item hook)))
+                ((= verbosity 1)
+                 ;; Display the bare minimum; don't mention grafts and hooks.
+                 (if display-download-size?
+                     (format (current-error-port)
+                             ;; TRANSLATORS: "MB" is for "megabyte"; it should be
+                             ;; translated to the corresponding abbreviation.
+                             (G_ "~:[~,1h MB will be downloaded~%~;~]")
+                             (null? download) download-size)
+                     (format (current-error-port)
+                             (N_ "~:[~h item will be downloaded~%~;~]"
+                                 "~:[~h items will be downloaded~%~;~]"
+                                 (length download))
+                             (null? download) (length download)))))))
 
     (check-available-space installed-size)
 
@@ -1073,7 +1114,8 @@ download."
 (define show-what-to-build*
   (store-lift show-what-to-build))
 
-(define* (build-notifier #:key (dry-run? #f) (use-substitutes? #t))
+(define* (build-notifier #:key (dry-run? #f) (use-substitutes? #t)
+                         (verbosity %default-verbosity))
   "Return a procedure suitable for 'with-build-handler' that, when
 'build-things' is called, invokes 'show-what-to-build' to display the build
 plan.  When DRY-RUN? is true, the 'with-build-handler' form returns without
@@ -1107,6 +1149,7 @@ any build happening."
                   (show-what-to-build store inputs
                                       #:dry-run? dry-run?
                                       #:use-substitutes? use-substitutes?
+                                      #:verbosity verbosity
                                       #:mode mode)))
 
       (unless (and (or build? download?)
-- 
2.27.0





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

* [bug#42481] [PATCH 2/2] scripts: Pass #:verbosity to 'build-notifier'.
  2020-07-22 21:46 ` [bug#42481] [PATCH 1/2] ui: Add #:verbosity to 'show-what-to-build' Ludovic Courtès
@ 2020-07-22 21:46   ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2020-07-22 21:46 UTC (permalink / raw)
  To: 42481; +Cc: Ludovic Courtès

* guix/scripts/archive.scm (guix-archive): Pass #:verbosity to
'build-notifier'.
* guix/scripts/build.scm (guix-build): Likewise.
* guix/scripts/copy.scm (guix-copy): Likewise.
* guix/scripts/deploy.scm (guix-deploy): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* 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 (verbosity-level): New procedure.
(process-action): Pass #:verbosity to 'build-notifier'.
(guix-system): Use 'verbosity-level' for 'with-status-verbosity'.
---
 guix/scripts/archive.scm     |  2 ++
 guix/scripts/build.scm       |  2 ++
 guix/scripts/copy.scm        |  2 ++
 guix/scripts/deploy.scm      |  4 +++-
 guix/scripts/environment.scm |  2 ++
 guix/scripts/pack.scm        |  2 ++
 guix/scripts/package.scm     |  2 ++
 guix/scripts/pull.scm        |  2 ++
 guix/scripts/system.scm      | 11 +++++++++--
 9 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index 41a2a42c21..f3b86fba14 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -380,6 +380,8 @@ output port."
                    (with-build-handler
                        (build-notifier #:use-substitutes?
                                        (assoc-ref opts 'substitutes?)
+                                       #:verbosity
+                                       (assoc-ref opts 'verbosity)
                                        #:dry-run?
                                        (assoc-ref opts 'dry-run?))
                      (cond ((assoc-ref opts 'export)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 8ff2fd1910..6286a43c02 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -961,6 +961,8 @@ needed."
 
         (with-build-handler (build-notifier #:use-substitutes?
                                             (assoc-ref opts 'substitutes?)
+                                            #:verbosity
+                                            (assoc-ref opts 'verbosity)
                                             #:dry-run?
                                             (assoc-ref opts 'dry-run?))
           (parameterize ((current-terminal-columns (terminal-columns))
diff --git a/guix/scripts/copy.scm b/guix/scripts/copy.scm
index f6f64d0a11..16d2de30f7 100644
--- a/guix/scripts/copy.scm
+++ b/guix/scripts/copy.scm
@@ -175,6 +175,8 @@ Copy ITEMS to or from the specified host over SSH.\n"))
         (set-build-options-from-command-line store opts)
         (with-build-handler (build-notifier #:use-substitutes?
                                             (assoc-ref opts 'substitutes?)
+                                            #:verbosity
+                                            (assoc-ref opts 'verbosity)
                                             #:dry-run?
                                             (assoc-ref opts 'dry-run?))
           (with-status-verbosity (assoc-ref opts 'verbosity)
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index 4466a0c632..524067e989 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -150,7 +150,9 @@ Perform the deployment specified by FILE.\n"))
       (with-store store
         (set-build-options-from-command-line store opts)
         (with-build-handler (build-notifier #:use-substitutes?
-                                            (assoc-ref opts 'substitutes?))
+                                            (assoc-ref opts 'substitutes?)
+                                            #:verbosity
+                                            (assoc-ref opts 'verbosity))
           (parameterize ((%graft? (assq-ref opts 'graft?)))
             (map/accumulate-builds store
                                    (cut deploy-machine* store <>)
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index d3b8b57ccc..b8979cac19 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -708,6 +708,8 @@ message if any test fails."
       (with-store store
         (with-build-handler (build-notifier #:use-substitutes?
                                             (assoc-ref opts 'substitutes?)
+                                            #:verbosity
+                                            (assoc-ref opts 'verbosity)
                                             #:dry-run?
                                             (assoc-ref opts 'dry-run?))
           (with-status-verbosity (assoc-ref opts 'verbosity)
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 13ade37515..8d9733d911 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -1133,6 +1133,8 @@ Create a bundle of PACKAGE.\n"))
 
         (with-build-handler (build-notifier #:dry-run?
                                             (assoc-ref opts 'dry-run?)
+                                            #:verbosity
+                                            (assoc-ref opts 'verbosity)
                                             #:use-substitutes?
                                             (assoc-ref opts 'substitutes?))
           (parameterize ((%graft? (assoc-ref opts 'graft?))
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1246147798..ac8dedb5f3 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -965,6 +965,8 @@ option processing with 'parse-command-line'."
             (set-build-options-from-command-line (%store) opts)
             (with-build-handler (build-notifier #:use-substitutes?
                                                 (assoc-ref opts 'substitutes?)
+                                                #:verbosity
+                                                (assoc-ref opts 'verbosity)
                                                 #:dry-run?
                                                 (assoc-ref opts 'dry-run?))
               (parameterize ((%guile-for-build
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 807daec593..5b4ccf13fe 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -773,6 +773,8 @@ Use '~/.config/guix/channels.scm' instead."))
                                  (%graft? (assoc-ref opts 'graft?)))
                     (with-build-handler (build-notifier #:use-substitutes?
                                                         substitutes?
+                                                        #:verbosity
+                                                        (assoc-ref opts 'verbosity)
                                                         #:dry-run? dry-run?)
                       (set-build-options-from-command-line store opts)
                       (ensure-default-profile)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index f2b4367094..3a8443b86c 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -1057,6 +1057,12 @@ Some ACTIONS support additional ARGS.\n"))
     (image-size . guess)
     (install-bootloader? . #t)))
 
+(define (verbosity-level opts)
+  "Return the verbosity level based on OPTS, the alist of parsed options."
+  (or (assoc-ref opts 'verbosity)
+      (if (eq? (assoc-ref opts 'action) 'build)
+          2 1)))
+
 \f
 ;;;
 ;;; Entry point.
@@ -1116,6 +1122,8 @@ resulting from command-line parsing."
 
       (with-build-handler (build-notifier #:use-substitutes?
                                           (assoc-ref opts 'substitutes?)
+                                          #:verbosity
+                                          (verbosity-level opts)
                                           #:dry-run?
                                           (assoc-ref opts 'dry-run?))
         (run-with-store store
@@ -1270,8 +1278,7 @@ 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 (or (assoc-ref opts 'verbosity)
-                                   (if (eq? command 'build) 2 1))
+        (with-status-verbosity (verbosity-level opts)
           (process-command command args opts))))))
 
 ;;; Local Variables:
-- 
2.27.0





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

* [bug#42481] [PATCH 0/2] Printing a more concise build plan
  2020-07-22 21:40 [bug#42481] [PATCH 0/2] Printing a more concise build plan Ludovic Courtès
  2020-07-22 21:46 ` [bug#42481] [PATCH 1/2] ui: Add #:verbosity to 'show-what-to-build' Ludovic Courtès
@ 2020-07-31 16:34 ` Ludovic Courtès
  2020-07-31 18:18   ` Mathieu Othacehe
  2020-07-31 19:03   ` Marius Bakke
  1 sibling, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2020-07-31 16:34 UTC (permalink / raw)
  To: 42481

Hello Guix!

Thoughts on this change?

I think it’s a good idea but I’d be happy to hear what people think!

  https://issues.guix.gnu.org/42481

Ludo’.

Ludovic Courtès <ludo@gnu.org> skribis:

> Hello Guix!
>
> These patches implement a suggestion Pierre made a while back:
> showing by default fewer details about what will/would be built
> or downloaded, and omitting info about grafts and hooks.
>
> The verbosity level here is controlled via the existing
> ‘--verbosity’ or ‘-v’ flag (which thus now control two things).
>
> Here are examples of the result:
>
> $ ./pre-inst-env guix system disk-image --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl -n --no-grafts
> substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
> The following derivations would be built:
>    /gnu/store/y2inlprxbigqvknm5qwjwsqgljxfbri4-disk-image.drv
>    /gnu/store/gclxh7i8smp71hz0p7wcj6qkf377wigy-image-dir.drv
>    /gnu/store/21fin1j5pnjzfwbc70wdpzl3iyjym8xp-genimage.cfg.drv
>    /gnu/store/aqcziad6ghfaainjibpdfypc8m2rr1vm-partition.img.drv
>    /gnu/store/484d4fd9q9827bc09ia8bi1dgxl8gpwn-grub.cfg.drv
>    /gnu/store/nnldmy339w9xxnybir48w14yz2xk0pmx-system.drv
>
> [...]
>
>    /gnu/store/ddxz08xvasphckdralifb624y3c7hrkx-rc.drv
>    /gnu/store/kq9qvn0m063m02cxf4kjipkf6x8vbvip-profile.drv
>    /gnu/store/y9if6nrykcqfnzxvb4cci2nzhmz1ipx5-parameters.drv
>    /gnu/store/w09j0p6126qcacylb455m5dn008yi04g-module-import.drv
> 49.9 MB would be downloaded
>
>
> Same with grafts:
>
> $ ./pre-inst-env guix system disk-image --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl -n
> 36.2 MB would be downloaded
>
>
> With ‘guix package’:
>
> $ ./pre-inst-env guix install vim-full krita -n
> The following packages would be installed:
>    vim-full 8.2.1145
>    krita    4.2.9
>
> 76.9 MB would be downloaded
> $ ./pre-inst-env guix install vim-full krita -n --no-grafts
> The following packages would be installed:
>    vim-full 8.2.1145
>    krita    4.2.9
>
> The following derivation would be built:
>    /gnu/store/shf0anw8l0y9hg4l8qp1fym4bvwq5kh9-profile.drv
> 76.9 MB would be downloaded
> $ ./pre-inst-env guix install inkscape hugin -n
> The following package would be upgraded:
>    inkscape (dependencies or package changed)
>
> The following package would be installed:
>    hugin 2019.2.0
>
> The following derivation would be built:
>    /gnu/store/lsi56ap8lzchfy8y76y7wirzfiqvb3ca-hugin-2019.2.0.drv
> 46.2 MB would be downloaded
>
>
> The current behavior is obtain with ‘-v2’, which remains the
> default for ‘guix build’:
>
> $ ./pre-inst-env guix build inkscape hugin -n
> The following derivation would be built:
>    /gnu/store/lsi56ap8lzchfy8y76y7wirzfiqvb3ca-hugin-2019.2.0.drv
> 46.2 MB would be downloaded:
>    /gnu/store/3jvjmwm0srgxxjwngv28bif8l4ksfbnp-autotrace-0.40.0-20190624.59
>    /gnu/store/gg36g9h2nzmq4dzrcr21ndb09nybqys0-inkscape-1.0
>    /gnu/store/n94n0ggdhck5a2prsd1r468x3p6i68p4-enblend-enfuse-4.2
>    /gnu/store/89rj5fqcg48afgk99639ds602pgf92k4-cmake-minimal-3.16.5
>    /gnu/store/0i4h5cf1a71pj319svzz88g2z07cvdk3-wxwidgets-3.0.5.1
>    /gnu/store/bwz9f0lg9lxscj6jfcgxmzqng3s1f1n3-vigra-1.11.1
>
> It’s also possible to use ‘-v0’ now.
>
> How does that sound?
>
> Personally, I’m find it a bit disconcerting that so few is displayed
> when substitutes are available, but it also feels more “lightweight”
> this way.  I really like that what would be built appears clearly,
> whereas now you have to scroll up possibly several pages to find
> that info, especially upon ‘guix upgrade’.
>
> Feedback welcome!
>
> Ludo’.
>
> Ludovic Courtès (2):
>   ui: Add #:verbosity to 'show-what-to-build'.
>   scripts: Pass #:verbosity to 'build-notifier'.
>
>  guix/scripts/archive.scm     |   2 +
>  guix/scripts/build.scm       |   2 +
>  guix/scripts/copy.scm        |   2 +
>  guix/scripts/deploy.scm      |   4 +-
>  guix/scripts/environment.scm |   2 +
>  guix/scripts/pack.scm        |   2 +
>  guix/scripts/package.scm     |   2 +
>  guix/scripts/pull.scm        |   2 +
>  guix/scripts/system.scm      |  11 ++-
>  guix/ui.scm                  | 175 ++++++++++++++++++++++-------------
>  10 files changed, 135 insertions(+), 69 deletions(-)




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

* [bug#42481] [PATCH 0/2] Printing a more concise build plan
  2020-07-31 16:34 ` [bug#42481] [PATCH 0/2] Printing a more concise build plan Ludovic Courtès
@ 2020-07-31 18:18   ` Mathieu Othacehe
  2020-08-03 15:49     ` Ludovic Courtès
  2020-07-31 19:03   ` Marius Bakke
  1 sibling, 1 reply; 7+ messages in thread
From: Mathieu Othacehe @ 2020-07-31 18:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 42481


Hey Ludo,

> Thoughts on this change?
>
> I think it’s a good idea but I’d be happy to hear what people think!

Most of the times, I'm reading the build plan only for one purpose, stop
the command if I'm going to build (too many) things.

Trying to think more like a newcomer (recent DistroTube video helps in that
matter), I feel like information such as grafts and profile hooks are
way too low level.

So this serie looks really fine to me.

Small digression, something that troubles me in the aforementioned video
is that many things were apparently built. I don't know if besides
improving our CI, we could do other things, such as warn with more
insistence if the Guix version is too old?

Thanks,

Mathieu




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

* [bug#42481] [PATCH 0/2] Printing a more concise build plan
  2020-07-31 16:34 ` [bug#42481] [PATCH 0/2] Printing a more concise build plan Ludovic Courtès
  2020-07-31 18:18   ` Mathieu Othacehe
@ 2020-07-31 19:03   ` Marius Bakke
  1 sibling, 0 replies; 7+ messages in thread
From: Marius Bakke @ 2020-07-31 19:03 UTC (permalink / raw)
  To: Ludovic Courtès, 42481

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

Ludovic Courtès <ludo@gnu.org> writes:

> Hello Guix!
>
> Thoughts on this change?
>
> I think it’s a good idea but I’d be happy to hear what people think!
>
>   https://issues.guix.gnu.org/42481

I think it looks great.  It's good that 'guix build' retains the
previous verbosity, and that 'guix upgrade' et.al still prints the
profile derivation, but omits the uninteresting stuff.  LGTM!

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

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

* [bug#42481] [PATCH 0/2] Printing a more concise build plan
  2020-07-31 18:18   ` Mathieu Othacehe
@ 2020-08-03 15:49     ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2020-08-03 15:49 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 42481

Hi!

Mathieu Othacehe <othacehe@gnu.org> skribis:

> Most of the times, I'm reading the build plan only for one purpose, stop
> the command if I'm going to build (too many) things.
>
> Trying to think more like a newcomer (recent DistroTube video helps in that
> matter), I feel like information such as grafts and profile hooks are
> way too low level.

Yeah, that’s also my feeling.

Marius Bakke <marius@gnu.org> skribis:

> I think it looks great.  It's good that 'guix build' retains the
> previous verbosity, and that 'guix upgrade' et.al still prints the
> profile derivation, but omits the uninteresting stuff.  LGTM!

Alright, pushed as 898e6d0a07e4260600d0876d8d1f551ac8b647f9, thanks!

Ludo’.




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

end of thread, other threads:[~2020-08-03 15:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 21:40 [bug#42481] [PATCH 0/2] Printing a more concise build plan Ludovic Courtès
2020-07-22 21:46 ` [bug#42481] [PATCH 1/2] ui: Add #:verbosity to 'show-what-to-build' Ludovic Courtès
2020-07-22 21:46   ` [bug#42481] [PATCH 2/2] scripts: Pass #:verbosity to 'build-notifier' Ludovic Courtès
2020-07-31 16:34 ` [bug#42481] [PATCH 0/2] Printing a more concise build plan Ludovic Courtès
2020-07-31 18:18   ` Mathieu Othacehe
2020-08-03 15:49     ` Ludovic Courtès
2020-07-31 19:03   ` Marius Bakke

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).