From 21a22211dff5d3f3e54bae672e0e02c2ce752a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Mon, 2 Feb 2026 15:45:30 +0900 Subject: [PATCH] build: Revert misadaptation to http-client's http-fetch. (guix build download) defines its own http-fetch and does not use (guix http-client). (guix build download-nar) also uses http-fetch from the former module. * guix/build/download.scm (url-fetch): Revert usage of http-fetch to that of the procedure defined in the module. * guix/build/download-nar.scm (download-nar): Revert usage of http-fetch to the one in (guix build download-nar). Fixes: 392cf48739f0 ("http-client: Alter http-fetch to return the response.") Change-Id: Iaccd9d8ed038e5b25a9cae4c1f4c1a6f809d1c6d Signed-off-by: Christopher Baines --- guix/build/download-nar.scm | 5 ++--- guix/build/download.scm | 11 +++-------- 2 files changed, 5 insertions(+), 11 deletions(-) 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)))