summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-03-12 14:38:10 +0100
committerLudovic Courtès <ludo@gnu.org>2021-03-12 15:59:46 +0100
commita04aef2430645357d7796969d4b6453478ff8a3f (patch)
treebb6154a00c10ab3690ddace7987f6133a375c4f0
parent97b45977f49470d70070b2ae4c66c5b802b172a1 (diff)
downloadguix-a04aef2430645357d7796969d4b6453478ff8a3f.tar.gz
utils: Use Guile-zlib for gzip compression and decompression.
Fixes <https://bugs.gnu.org/46967>.

* guix/utils.scm (decompressed-port): Call 'make-zlib-input-port'
instead of invoking %GZIP.
(compressed-output-port): Call 'make-zlib-output-port' instead of
invoking %GZIP.
* doc/guix.texi (Requirements): Require Guile-zlib >= 0.1.0.
-rw-r--r--doc/guix.texi3
-rw-r--r--guix/utils.scm7
2 files changed, 7 insertions, 3 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 77aafafd97..4cf241c56a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -831,7 +831,8 @@ Guile,, gnutls-guile, GnuTLS-Guile});
 @item
 @uref{https://notabug.org/guile-sqlite3/guile-sqlite3, Guile-SQLite3}, version 0.1.0
 or later;
-@item @uref{https://notabug.org/guile-zlib/guile-zlib, Guile-zlib};
+@item @uref{https://notabug.org/guile-zlib/guile-zlib, Guile-zlib},
+version 0.1.0 or later;
 @item @uref{https://notabug.org/guile-lzlib/guile-lzlib, Guile-lzlib};
 @item @uref{https://www.nongnu.org/guile-avahi/, Guile-Avahi};
 @item
diff --git a/guix/utils.scm b/guix/utils.scm
index 1625cab19b..21e3460b2c 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -45,6 +45,7 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 format)
   #:use-module ((ice-9 iconv) #:prefix iconv:)
+  #:autoload   (zlib) (make-zlib-input-port make-zlib-output-port)
   #:use-module (system foreign)
   #:re-export (<location>                         ;for backwards compatibility
                location
@@ -231,7 +232,8 @@ a symbol such as 'xz."
     ((or #f 'none) (values input '()))
     ('bzip2        (filtered-port `(,%bzip2 "-dc") input))
     ('xz           (filtered-port `(,%xz "-dc") input))
-    ('gzip         (filtered-port `(,%gzip "-dc") input))
+    ('gzip         (values (make-zlib-input-port input #:format 'gzip)
+                           '()))
     ('lzip         (values (lzip-port 'make-lzip-input-port input)
                            '()))
     ('zstd         (values (zstd-port 'make-zstd-input-port input)
@@ -292,7 +294,8 @@ program--e.g., '(\"--fast\")."
     ((or #f 'none) (values output '()))
     ('bzip2        (filtered-output-port `(,%bzip2 "-c" ,@options) output))
     ('xz           (filtered-output-port `(,%xz "-c" ,@options) output))
-    ('gzip         (filtered-output-port `(,%gzip "-c" ,@options) output))
+    ('gzip         (values (make-zlib-output-port output #:format 'gzip)
+                           '()))
     ('lzip         (values (lzip-port 'make-lzip-output-port output)
                            '()))
     ('zstd         (values (zstd-port 'make-zstd-output-port output)