mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
substitutes: Log the failing queries.
* guix/substitutes.scm (%debug?): New variable. (handle-narinfo-response): Log the failing queries if the %debug? parameter is set.
This commit is contained in:
parent
62f9f34525
commit
8b665a4ff3
1 changed files with 17 additions and 0 deletions
|
@ -90,6 +90,16 @@ (define %narinfo-cache-directory
|
|||
(string-append %state-directory "/substitute/cache"))
|
||||
(string-append (cache-directory #:ensure? #f) "/substitute")))
|
||||
|
||||
(define %debug?
|
||||
;; Enable debug mode by setting the GUIX_SUBSTITUTE_DEBUG environmnent
|
||||
;; variable.
|
||||
(make-parameter
|
||||
(getenv "GUIX_SUBSTITUTE_DEBUG")))
|
||||
|
||||
(define-syntax-rule (debug fmt args ...)
|
||||
(when (%debug?)
|
||||
(format #t fmt args ...)))
|
||||
|
||||
(define (narinfo-cache-file cache-url path)
|
||||
"Return the name of the local file that contains an entry for PATH. The
|
||||
entry is stored in a sub-directory specific to CACHE-URL."
|
||||
|
@ -224,6 +234,13 @@ (define (handle-narinfo-response request response port result)
|
|||
(let* ((path (uri-path (request-uri request)))
|
||||
(hash-part (basename
|
||||
(string-drop-right path 8)))) ;drop ".narinfo"
|
||||
;; Log the failing queries and indicate if it failed because the
|
||||
;; narinfo is being baked.
|
||||
(let ((baking?
|
||||
(assoc-ref (response-headers response) 'x-baking)))
|
||||
(debug "could not fetch ~a~a ~a~a~%"
|
||||
url path code
|
||||
(if baking? " (baking)" "")))
|
||||
(if len
|
||||
(get-bytevector-n port len)
|
||||
(read-to-eof port))
|
||||
|
|
Loading…
Reference in a new issue