download: Support 'file://' URLs.
* guix/download.scm (download-to-store): When URL has a 'file' scheme or no scheme, use 'add-to-store' directly.master
parent
39e9f95d05
commit
d8907ac43f
|
@ -24,6 +24,7 @@
|
|||
#:use-module ((guix store) #:select (derivation-path? add-to-store))
|
||||
#:use-module ((guix build download) #:renamer (symbol-prefix-proc 'build:))
|
||||
#:use-module (guix utils)
|
||||
#:use-module (web uri)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:export (%mirrors
|
||||
|
@ -244,6 +245,11 @@ must be a list of symbol/URL-list pairs."
|
|||
#:key (log (current-error-port)))
|
||||
"Download from URL to STORE, either under NAME or URL's basename if
|
||||
omitted. Write progress reports to LOG."
|
||||
(define uri
|
||||
(string->uri url))
|
||||
|
||||
(if (memq (uri-scheme uri) '(file #f))
|
||||
(add-to-store store name #f "sha256" (uri-path uri))
|
||||
(call-with-temporary-output-file
|
||||
(lambda (temp port)
|
||||
(let ((result
|
||||
|
@ -251,6 +257,6 @@ omitted. Write progress reports to LOG."
|
|||
(build:url-fetch url temp #:mirrors %mirrors))))
|
||||
(close port)
|
||||
(and result
|
||||
(add-to-store store name #f "sha256" temp))))))
|
||||
(add-to-store store name #f "sha256" temp)))))))
|
||||
|
||||
;;; download.scm ends here
|
||||
|
|
Reference in New Issue