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.
This commit is contained in:
Ludovic Courtès 2021-03-12 14:38:10 +01:00
parent 97b45977f4
commit a04aef2430
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 7 additions and 3 deletions

View file

@ -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

View file

@ -45,6 +45,7 @@ (define-module (guix utils)
#: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 @@ (define (decompressed-port compression input)
((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 @@ (define* (compressed-output-port compression output
((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)