download: Adjust to `http-get*' deprecation.

* guix/build/download.scm (http-fetch): Adjust to use #:streaming? when
  using Guile 2.0.8+.
master
Ludovic Courtès 2013-02-20 22:59:35 +01:00
parent e95da44576
commit cc68ccc5b0
1 changed files with 17 additions and 8 deletions

View File

@ -178,17 +178,26 @@ which is not available during bootstrap."
(define (http-fetch uri file) (define (http-fetch uri file)
"Fetch data from URI and write it to FILE. Return FILE on success." "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) (let*-values (((connection)
(open-connection-for-uri uri)) (open-connection-for-uri uri))
((resp bv-or-port) ((resp bv-or-port)
;; XXX: `http-get*' was introduced in 2.0.7. We know ;; XXX: `http-get*' was introduced in 2.0.7, and replaced by
;; we're using it within the chroot, but ;; #:streaming? in 2.0.8. We know we're using it within the
;; `guix-download' might be using a different version. ;; chroot, but `guix-download' might be using a different
;; So keep this compatibility hack for now. ;; version. So keep this compatibility hack for now.
(if (module-defined? (resolve-interface '(web client)) (if post-2.0.7?
'http-get*) (http-get uri #:port connection #:decode-body? #f
(http-get* uri #:port connection #:decode-body? #f) #:streaming? #t)
(http-get uri #:port connection #:decode-body? #f))) (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) ((code)
(response-code resp)) (response-code resp))
((size) ((size)