GNU bug report logs - #74878
[PATCH 0/2] Improve Guix Subsitute script usage.

Previous Next

Package: guix-patches;

Reported by: Richard Sent <richard <at> freakingpenguin.com>

Date: Sun, 15 Dec 2024 00:26:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 74878 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#74878; Package guix-patches. (Sun, 15 Dec 2024 00:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Richard Sent <richard <at> freakingpenguin.com>:
New bug report received and forwarded. Copy sent to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org. (Sun, 15 Dec 2024 00:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard Sent <richard <at> freakingpenguin.com>
To: guix-patches <at> gnu.org
Cc: Richard Sent <richard <at> freakingpenguin.com>
Subject: [PATCH 0/2] Improve Guix Subsitute script usage.
Date: Sat, 14 Dec 2024 19:23:35 -0500
Hi all,

A common question I hear is "why is guix updating substitutes so many
times". My thinking is by adding the number of substitutes being updated to
guix/scripts/substitute.scm, it might be a bit clearer that something
different is happening every time.

(This was a very "fun" adventure. Originally I used ~:*~p to refer to the
previous argument, but that emits a warning in Guile because
format-string-argument-count doesn't seem to handle ~:*. Fortunately a commit
[1] by Ludo in 2014 showed me I could use ~:p instead.)

I also tweaked the help output since I found it a bit unclear. I know it's an
internal tool, but unless I'm missing something (I very may be) the previous
help output seemed almost misleading.

Note that if anyone tests this you won't see any changes in regular guix CLI
usage unless/until the guix package proper is updated. Instead, you can use
commands like:

echo "have /gnu/store/0zahq56kff8cfrq9xhkq5wi2zdkysj6b-emacs-29.1" | guix substitute --query

[1]: 8ac39b38

Richard Sent (2):
  scripts: substitute: Report the number of substitutes being updated.
  scripts: substitute: Improve the help output.

 guix/scripts/substitute.scm | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)


base-commit: 64ac17035d66d98d3081bc7fc558c33e1be8e4f4
-- 
2.46.0





Information forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#74878; Package guix-patches. (Sun, 15 Dec 2024 00:28:02 GMT) Full text and rfc822 format available.

Message #8 received at 74878 <at> debbugs.gnu.org (full text, mbox):

From: Richard Sent <richard <at> freakingpenguin.com>
To: 74878 <at> debbugs.gnu.org
Cc: Richard Sent <richard <at> freakingpenguin.com>
Subject: [PATCH 2/2] scripts: substitute: Improve the help output.
Date: Sat, 14 Dec 2024 19:26:47 -0500
Clarify that arguments are read from standard input and that --query expects a
command.

* guix/scripts/substitute.scm (show-help): Reword.

Change-Id: Ifc197d5e10e43663f1e05039ce29086f6a21b943
---
 guix/scripts/substitute.scm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 08ec172675..d5c2a84c33 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -244,13 +244,16 @@ (define-syntax with-networking
 
 (define (show-help)
   (display (G_ "Usage: guix substitute OPTION [ARGUMENT]...
-Internal tool to substitute a pre-built binary to a local build.\n"))
+Internal tool to substitute a pre-built binary to a local build.
+
+ARGUMENT is read from standard input, not from the command line.\n"))
   (display (G_ "
-      --query            report on the availability of substitutes for the
-                         store file names passed on the standard input"))
+      --query COMMAND STORE-FILE ...
+                         Run query COMMAND with STORE-FILE to report on
+                         the availability of substitutes"))
   (display (G_ "
       --substitute STORE-FILE DESTINATION
-                         download STORE-FILE and store it as a Nar in file
+                         download STORE-FILE and store it as a nar in file
                          DESTINATION"))
   (newline)
   (display (G_ "
-- 
2.46.0





Information forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#74878; Package guix-patches. (Sun, 15 Dec 2024 00:28:03 GMT) Full text and rfc822 format available.

Message #11 received at 74878 <at> debbugs.gnu.org (full text, mbox):

From: Richard Sent <richard <at> freakingpenguin.com>
To: 74878 <at> debbugs.gnu.org
Cc: Richard Sent <richard <at> freakingpenguin.com>
Subject: [PATCH 1/2] scripts: substitute: Report the number of substitutes
 being updated.
Date: Sat, 14 Dec 2024 19:26:46 -0500
* guix/scripts/substitute.scm (process-query)[make-progress-reporter]: Report
the total number of substitutes.

Change-Id: I00c6fe7383a6093ce0567c0f391e613d36a563bc
---
 guix/scripts/substitute.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 8db730a9c0..08ec172675 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -328,8 +328,8 @@ (define* (process-query port command
       (erase-current-line (current-error-port)) ;erase current line
       (force-output (current-error-port))
       (format (current-error-port)
-              (G_ "updating substitutes from '~a'... ~5,1f%")
-              url (* 100. (/ done total)))
+              (G_ "updating ~d substitute~:p from '~a'... ~5,1f%")
+              total url (* 100. (/ done total)))
       (set! done (+ 1 done)))
 
     (progress-reporter
-- 
2.46.0





Information forwarded to guix-patches <at> gnu.org:
bug#74878; Package guix-patches. (Mon, 23 Dec 2024 17:40:02 GMT) Full text and rfc822 format available.

Message #14 received at 74878 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Richard Sent <richard <at> freakingpenguin.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, 74878 <at> debbugs.gnu.org,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#74878] [PATCH 2/2] scripts: substitute: Improve the help
 output.
Date: Mon, 23 Dec 2024 18:39:07 +0100
Hi,

Richard Sent <richard <at> freakingpenguin.com> skribis:

> Clarify that arguments are read from standard input and that --query expects a
> command.
>
> * guix/scripts/substitute.scm (show-help): Reword.
>
> Change-Id: Ifc197d5e10e43663f1e05039ce29086f6a21b943

[...]

>  (define (show-help)
>    (display (G_ "Usage: guix substitute OPTION [ARGUMENT]...
> -Internal tool to substitute a pre-built binary to a local build.\n"))
> +Internal tool to substitute a pre-built binary to a local build.
> +
> +ARGUMENT is read from standard input, not from the command line.\n"))

I find this sentence confusing since the usage line above shows that
it’s a command-line argument.  But since there’s no such argument, we
can just remove “[ARGUMENT]...” from the usage line.

>    (display (G_ "
> -      --query            report on the availability of substitutes for the
> -                         store file names passed on the standard input"))
> +      --query COMMAND STORE-FILE ...
> +                         Run query COMMAND with STORE-FILE to report on
> +                         the availability of substitutes"))

I think this also adds to the confusion since ‘--query’ doesn’t actually
take any arguments.

Note that the protocol ‘guix-daemon’ and ‘guix substitute’ is
purposefully undocumented: it’s an implementation detail and users are
not supposed to use ‘guix substitute’ directly.

Thoughts?

Ludo’.





This bug report was last modified 173 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.