diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-02-20 22:59:35 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-02-27 20:55:41 +0100 |
commit | cc68ccc5b08fff76d33c7062db35bdb646ed7ece (patch) | |
tree | e994d01246b552b52bf5c60cb4b7a599426636b8 /guix | |
parent | e95da445761bf95ee1f251d3be79f05c1379a6fa (diff) | |
download | gnu-guix-cc68ccc5b08fff76d33c7062db35bdb646ed7ece.tar gnu-guix-cc68ccc5b08fff76d33c7062db35bdb646ed7ece.tar.gz |
download: Adjust to `http-get*' deprecation.
* guix/build/download.scm (http-fetch): Adjust to use #:streaming? when
using Guile 2.0.8+.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build/download.scm | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/guix/build/download.scm b/guix/build/download.scm index cda715993e..6c2e8235d0 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -178,17 +178,26 @@ which is not available during bootstrap." (define (http-fetch uri file) "Fetch data from URI and write it to FILE. Return FILE on success." + (define post-2.0.7? + (or (string>? (major-version) "2") + (string>? (minor-version) "0") + (string>? (micro-version) "7") + (string>? (version) "2.0.7"))) + (let*-values (((connection) (open-connection-for-uri uri)) ((resp bv-or-port) - ;; XXX: `http-get*' was introduced in 2.0.7. We know - ;; we're using it within the chroot, but - ;; `guix-download' might be using a different version. - ;; So keep this compatibility hack for now. - (if (module-defined? (resolve-interface '(web client)) - 'http-get*) - (http-get* uri #:port connection #:decode-body? #f) - (http-get uri #:port connection #:decode-body? #f))) + ;; XXX: `http-get*' was introduced in 2.0.7, and replaced by + ;; #:streaming? in 2.0.8. We know we're using it within the + ;; chroot, but `guix-download' might be using a different + ;; version. So keep this compatibility hack for now. + (if post-2.0.7? + (http-get uri #:port connection #:decode-body? #f + #:streaming? #t) + (if (module-defined? (resolve-interface '(web client)) + 'http-get*) + (http-get* uri #:port connection #:decode-body? #f) + (http-get uri #:port connection #:decode-body? #f)))) ((code) (response-code resp)) ((size) |