substitute: Error out on unsupported URL schemes.

Reported in <http://bugs.gnu.org/22937>
by Chris Marusich <cmmarusich@gmail.com>.

* guix/scripts/substitute.scm (fetch): Add 'else' case and call 'leave'.
This commit is contained in:
Ludovic Courtès 2016-03-09 18:34:04 +01:00
parent bec7f35214
commit 204d34ff96
1 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -204,7 +204,10 @@ to the caller without emitting an error message."
(set! port (open-socket-for-uri uri)) (set! port (open-socket-for-uri uri))
(unless buffered? (unless buffered?
(setvbuf port _IONBF))) (setvbuf port _IONBF)))
(http-fetch uri #:text? #f #:port port)))))))) (http-fetch uri #:text? #f #:port port))))))
(else
(leave (_ "unsupported substitute URI scheme: ~a~%")
(uri->string uri)))))
(define-record-type <cache-info> (define-record-type <cache-info>
(%make-cache-info url store-directory wants-mass-query?) (%make-cache-info url store-directory wants-mass-query?)