1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

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: 392cf48739 ("http-client: Alter http-fetch to return the response.")
Change-Id: Iaccd9d8ed038e5b25a9cae4c1f4c1a6f809d1c6d
Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
Nguyễn Gia Phong
2026-02-02 15:45:30 +09:00
committed by Christopher Baines
parent 82d22e717c
commit 21a22211df
2 changed files with 5 additions and 11 deletions

View File

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

View File

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