diff --git a/guix/build/download-nar.scm b/guix/build/download-nar.scm index eb358d69d9..f26ad28cd0 100644 --- a/guix/build/download-nar.scm +++ b/guix/build/download-nar.scm @@ -22,7 +22,6 @@ #:autoload (lzlib) (call-with-lzip-input-port) #:use-module (guix progress) #:use-module (web uri) - #:use-module (web response) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (ice-9 format) @@ -70,7 +69,7 @@ item. Return #t on success, #f otherwise." ((url rest ...) (format #t "Trying content-addressed mirror at ~a...~%" (uri-host (string->uri url))) - (let-values (((port response) + (let-values (((port size) (catch #t (lambda () (http-fetch (string->uri url))) @@ -82,7 +81,7 @@ item. Return #t on success, #f otherwise." (values #f #f))))) (if (not port) (loop rest) - (let ((size (response-content-length response))) + (begin (if size (format #t "Downloading from ~a (~,2h MiB)...~%" url (/ size (expt 2 20.))) diff --git a/guix/build/download.scm b/guix/build/download.scm index 53a0997164..509dcc08c7 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -22,7 +22,6 @@ (define-module (guix build download) #:use-module (web uri) #:use-module (web http) - #:use-module (web response) #:use-module ((web client) #:hide (open-socket-for-uri)) #:use-module (web response) #:use-module (guix base64) @@ -753,7 +752,7 @@ otherwise simply ignore them." (case (uri-scheme uri) ((http https) (false-if-exception* - (let-values (((port response) + (let-values (((port size) (http-fetch uri #:verify-certificate? verify-certificate? #:timeout timeout))) @@ -763,13 +762,9 @@ otherwise simply ignore them." #:buffer-size %http-receive-buffer-size #:reporter (if print-build-trace? (progress-reporter/trace - file (uri->string uri) - (response-content-length - response)) + file (uri->string uri) size) (progress-reporter/file - (uri-abbreviation uri) - (response-content-length - response)))) + (uri-abbreviation uri) size))) (newline))) (close-port port) file)))