mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-27 21:39:17 -05:00
scripts: substitute: Remove side effect warning from network-error?.
Instead, display the warning from process-substitution and process-substitution/fallback in the relevant places. I'm looking at this because I want to make the substitute code less tied to the script and usable in the Guile guix-daemon. * guix/scripts/substitute.scm (network-error?): Move warning to… (process-substitution/fallback, process-substitution): here. Change-Id: I082b482c0e6ec7e02a8d437ba22dcefca5c40787
This commit is contained in:
parent
ac19e038b4
commit
d9276a46bf
1 changed files with 13 additions and 8 deletions
|
@ -615,13 +615,7 @@ (define network-error?
|
|||
(and (kind-and-args? exception)
|
||||
(memq (exception-kind exception)
|
||||
'(gnutls-error getaddrinfo-error)))
|
||||
(and (http-get-error? exception)
|
||||
(begin
|
||||
(warning (G_ "download from '~a' failed: ~a, ~s~%")
|
||||
(uri->string (http-get-error-uri exception))
|
||||
(http-get-error-code exception)
|
||||
(http-get-error-reason exception))
|
||||
#t))))))
|
||||
(http-get-error? exception)))))
|
||||
|
||||
(define* (process-substitution/fallback port narinfo destination
|
||||
#:key cache-urls acl
|
||||
|
@ -649,7 +643,13 @@ (define* (process-substitution/fallback port narinfo destination
|
|||
(if (or (equivalent-narinfo? narinfo alternate)
|
||||
(valid-narinfo? alternate acl)
|
||||
(%allow-unauthenticated-substitutes?))
|
||||
(guard (c ((network-error? c) (loop rest)))
|
||||
(guard (c ((network-error? c)
|
||||
(when (http-get-error? c)
|
||||
(warning (G_ "download from '~a' failed: ~a, ~s~%")
|
||||
(uri->string (http-get-error-uri c))
|
||||
(http-get-error-code c)
|
||||
(http-get-error-reason c)))
|
||||
(loop rest)))
|
||||
(download-nar alternate destination
|
||||
#:status-port port
|
||||
#:deduplicate? deduplicate?
|
||||
|
@ -677,6 +677,11 @@ (define narinfo
|
|||
store-item))
|
||||
|
||||
(guard (c ((network-error? c)
|
||||
(when (http-get-error? c)
|
||||
(warning (G_ "download from '~a' failed: ~a, ~s~%")
|
||||
(uri->string (http-get-error-uri c))
|
||||
(http-get-error-code c)
|
||||
(http-get-error-reason c)))
|
||||
(format (current-error-port)
|
||||
(G_ "retrying download of '~a' with other substitute URLs...~%")
|
||||
store-item)
|
||||
|
|
Loading…
Reference in a new issue