summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-03-22 21:58:23 +0100
committerLudovic Courtès <ludo@gnu.org>2014-03-22 22:57:09 +0100
commit7a8024a33ad862fdbc8ae741f0a6f5338cb5b82b (patch)
treec2ab108d3f49f4ead6f964ae46e1c0c3678df66c /guix/scripts
parent443eb4e9506026094f5e0dadc3e11d3cf7a86a24 (diff)
utils: Add 'decompressed-port' and 'compressed-port'.
* guix/utils.scm (decompressed-port, compressed-port): New procedures. * guix/scripts/substitute-binary.scm (decompressed-port): Remove. (guix-substitute-binary): Pass a symbol or #f as the first argument to 'decompress-port'. * tests/utils.scm ("compressed-port, decompressed-port, non-file"): New test.
Diffstat (limited to 'guix/scripts')
-rwxr-xr-xguix/scripts/substitute-binary.scm13
1 files changed, 2 insertions, 11 deletions
diff --git a/guix/scripts/substitute-binary.scm b/guix/scripts/substitute-binary.scm
index 7ac12ddef2..4e49b0c3ac 100755
--- a/guix/scripts/substitute-binary.scm
+++ b/guix/scripts/substitute-binary.scm
@@ -400,16 +400,6 @@ indefinitely."
(call-with-output-file expiry-file
(cute write (time-second now) <>))))
-(define (decompressed-port compression input)
- "Return an input port where INPUT is decompressed according to COMPRESSION,
-along with a list of PIDs to wait for."
- (match compression
- ("none" (values input '()))
- ("bzip2" (filtered-port `(,%bzip2 "-dc") input))
- ("xz" (filtered-port `(,%xz "-dc") input))
- ("gzip" (filtered-port `(,%gzip "-dc") input))
- (else (error "unsupported compression scheme" compression))))
-
(define (progress-report-port report-progress port)
"Return a port that calls REPORT-PROGRESS every time something is read from
PORT. REPORT-PROGRESS is a two-argument procedure such as that returned by
@@ -598,7 +588,8 @@ substituter disabled~%")
(current-error-port))))
(progress-report-port progress raw)))
((input pids)
- (decompressed-port (narinfo-compression narinfo)
+ (decompressed-port (and=> (narinfo-compression narinfo)
+ string->symbol)
progress)))
;; Unpack the Nar at INPUT into DESTINATION.
(restore-file input destination)