diff options
Diffstat (limited to 'guix/utils.scm')
-rw-r--r-- | guix/utils.scm | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/guix/utils.scm b/guix/utils.scm index 0df46f1062..f8b05e7e80 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -110,7 +110,6 @@ edit-expression filtered-port - compressed-port decompressed-port call-with-decompressed-port compressed-output-port @@ -211,7 +210,13 @@ buffered data is lost." "Return the lzip port produced by calling PROC (a symbol) on PORT and ARGS. Raise an error if lzlib support is missing." (let ((make-port (module-ref (resolve-interface '(lzlib)) proc))) - (values (make-port port) '()))) + (make-port port))) + +(define (zstd-port proc port . args) + "Return the zstd port produced by calling PROC (a symbol) on PORT and ARGS. +Raise an error if zstd support is missing." + (let ((make-port (module-ref (resolve-interface '(zstd)) proc))) + (make-port port))) (define (decompressed-port compression input) "Return an input port where INPUT is decompressed according to COMPRESSION, @@ -223,17 +228,7 @@ a symbol such as 'xz." ('gzip (filtered-port `(,%gzip "-dc") input)) ('lzip (values (lzip-port 'make-lzip-input-port input) '())) - (_ (error "unsupported compression scheme" compression)))) - -(define (compressed-port compression input) - "Return an input port where INPUT is compressed according to COMPRESSION, -a symbol such as 'xz." - (match compression - ((or #f 'none) (values input '())) - ('bzip2 (filtered-port `(,%bzip2 "-c") input)) - ('xz (filtered-port `(,%xz "-c") input)) - ('gzip (filtered-port `(,%gzip "-c") input)) - ('lzip (values (lzip-port 'make-lzip-input-port/compressed input) + ('zstd (values (zstd-port 'make-zstd-input-port input) '())) (_ (error "unsupported compression scheme" compression)))) @@ -294,6 +289,8 @@ program--e.g., '(\"--fast\")." ('gzip (filtered-output-port `(,%gzip "-c" ,@options) output)) ('lzip (values (lzip-port 'make-lzip-output-port output) '())) + ('zstd (values (zstd-port 'make-zstd-output-port output) + '())) (_ (error "unsupported compression scheme" compression)))) (define* (call-with-compressed-output-port compression port proc |