aboutsummaryrefslogtreecommitdiff
path: root/guix/scripts/substitute.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-15 00:10:22 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-15 00:32:18 +0200
commitb0a6a9713076347c14ee2dd0ea494ab086df2a82 (patch)
tree683306fb642f1974aafb720f6e2798598380d272 /guix/scripts/substitute.scm
parentcc44fbb8d9f47070c488faef3dc4b24f2a8a07d8 (diff)
downloadgnu-guix-b0a6a9713076347c14ee2dd0ea494ab086df2a82.tar
gnu-guix-b0a6a9713076347c14ee2dd0ea494ab086df2a82.tar.gz
substitute: Honor the number of columns of the client terminal.
* guix/store.scm (set-build-options): Add #:terminal-columns parameter and honor it. * guix/scripts/substitute.scm (client-terminal-columns): New procedure. (guix-substitute): Use it to parameterize 'current-terminal-columns'.
Diffstat (limited to 'guix/scripts/substitute.scm')
-rwxr-xr-xguix/scripts/substitute.scm20
1 files changed, 16 insertions, 4 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 82ce069598..db0416b0c0 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -31,7 +31,8 @@
#:use-module (guix pki)
#:use-module ((guix build utils) #:select (mkdir-p dump-port))
#:use-module ((guix build download)
- #:select (progress-proc uri-abbreviation
+ #:select (current-terminal-columns
+ progress-proc uri-abbreviation
open-connection-for-uri
close-connection
store-path-abbreviation byte-count->string))
@@ -973,6 +974,14 @@ found."
;; daemon.
'("http://hydra.gnu.org"))))
+(define (client-terminal-columns)
+ "Return the number of columns in the client's terminal, if it is known, or a
+default value."
+ (or (and=> (or (find-daemon-option "untrusted-terminal-columns")
+ (find-daemon-option "terminal-columns"))
+ string->number)
+ 80))
+
(define (guix-substitute . args)
"Implement the build daemon's substituter protocol."
(mkdir-p %narinfo-cache-directory)
@@ -1003,9 +1012,12 @@ found."
(loop (read-line)))))))
(("--substitute" store-path destination)
;; Download STORE-PATH and add store it as a Nar in file DESTINATION.
- (process-substitution store-path destination
- #:cache-urls %cache-urls
- #:acl (current-acl)))
+ ;; Specify the number of columns of the terminal so the progress
+ ;; report displays nicely.
+ (parameterize ((current-terminal-columns (client-terminal-columns)))
+ (process-substitution store-path destination
+ #:cache-urls %cache-urls
+ #:acl (current-acl))))
(("--version")
(show-version-and-exit "guix substitute"))
(("--help")