summaryrefslogtreecommitdiff
path: root/guix/scripts/substitute-binary.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/scripts/substitute-binary.scm')
-rwxr-xr-xguix/scripts/substitute-binary.scm39
1 files changed, 36 insertions, 3 deletions
diff --git a/guix/scripts/substitute-binary.scm b/guix/scripts/substitute-binary.scm
index 97bbfcbce8..1afc93bbc9 100755
--- a/guix/scripts/substitute-binary.scm
+++ b/guix/scripts/substitute-binary.scm
@@ -446,6 +446,30 @@ PORT. REPORT-PROGRESS is a two-argument procedure such as that returned by
;;;
+;;; Help.
+;;;
+
+(define (show-help)
+ (display (_ "Usage: guix substitute-binary [OPTION]...
+Internal tool to substitute a pre-built binary to a local build.\n"))
+ (display (_ "
+ --query report on the availability of substitutes for the
+ store file names passed on the standard input"))
+ (display (_ "
+ --substitute STORE-FILE DESTINATION
+ download STORE-FILE and store it as a Nar in file
+ DESTINATION"))
+ (newline)
+ (display (_ "
+ -h, --help display this help and exit"))
+ (display (_ "
+ -V, --version display version information and exit"))
+ (newline)
+ (show-bug-report-information))
+
+
+
+;;;
;;; Entry point.
;;;
@@ -508,8 +532,13 @@ PORT. REPORT-PROGRESS is a two-argument procedure such as that returned by
;; Tell the daemon what the expected hash of the Nar itself is.
(format #t "~a~%" (narinfo-hash narinfo))
- (format (current-error-port) "downloading `~a' from `~a'...~%"
- store-path (uri->string uri))
+ (format (current-error-port) "downloading `~a' from `~a'~:[~*~; (~,1f MiB installed)~]...~%"
+ store-path (uri->string uri)
+
+ ;; Use the Nar size as an estimate of the installed size.
+ (narinfo-size narinfo)
+ (and=> (narinfo-size narinfo)
+ (cute / <> (expt 2. 20))))
(let*-values (((raw download-size)
;; Note that Hydra currently generates Nars on the fly
;; and doesn't specify a Content-Length, so
@@ -531,7 +560,11 @@ PORT. REPORT-PROGRESS is a two-argument procedure such as that returned by
(restore-file input destination)
(every (compose zero? cdr waitpid) pids))))
(("--version")
- (show-version-and-exit "guix substitute-binary")))))
+ (show-version-and-exit "guix substitute-binary"))
+ (("--help")
+ (show-help))
+ (opts
+ (leave (_ "~a: unrecognized options~%") opts)))))
;;; Local Variables: