guix build: 'guix build --log-file' gracefully reports certificate errors.
Previously 'guix build --log-file' would print a backtrace upon X.509 certificate verification errors. * guix/scripts/build.scm (log-url): Catch 'tls-certificate-error' in addition to 'getaddrinfo-error'.master
parent
e784e2561e
commit
7d85fcde23
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -69,13 +69,21 @@
|
||||||
found. Return #f if no build log was found."
|
found. Return #f if no build log was found."
|
||||||
(define (valid-url? url)
|
(define (valid-url? url)
|
||||||
;; Probe URL and return #t if it is accessible.
|
;; Probe URL and return #t if it is accessible.
|
||||||
(catch 'getaddrinfo-error
|
(catch #t
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(guard (c ((http-get-error? c) #f))
|
(guard (c ((http-get-error? c) #f))
|
||||||
(close-port (http-fetch url #:buffered? #f))
|
(close-port (http-fetch url #:buffered? #f))
|
||||||
#t))
|
#t))
|
||||||
(lambda _
|
(match-lambda*
|
||||||
#f)))
|
(('getaddrinfo-error . _)
|
||||||
|
#f)
|
||||||
|
(('tls-certificate-error args ...)
|
||||||
|
(report-error (G_ "cannot access build log at '~a':~%") url)
|
||||||
|
(print-exception (current-error-port) #f
|
||||||
|
'tls-certificate-error args)
|
||||||
|
(exit 1))
|
||||||
|
((key . args)
|
||||||
|
(apply throw key args)))))
|
||||||
|
|
||||||
(define (find-url file)
|
(define (find-url file)
|
||||||
(let ((base (basename file)))
|
(let ((base (basename file)))
|
||||||
|
|
Reference in New Issue