aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
author宋文武 <iyzsong@member.fsf.org>2017-08-19 20:41:44 +0800
committer宋文武 <iyzsong@member.fsf.org>2017-08-20 20:55:45 +0800
commita02967d77af03d6468e25d6e26dbea0db919ce96 (patch)
tree66ca3cdddb4ccbb37a0f053fcbd9af95ca1f0e30 /guix
parent6d7d9d9507484773eff697a01f422ea984936373 (diff)
downloadgnu-guix-a02967d77af03d6468e25d6e26dbea0db919ce96.tar
gnu-guix-a02967d77af03d6468e25d6e26dbea0db919ce96.tar.gz
guix download: Support retrieving local file without the URI scheme.
* guix/scripts/download.scm (guix-download): Treat the URL argument as a local file path when it fails on 'string->uri'. Call 'fetch' with the processed 'uri' instead of the original URL argument. * tests/guix-download.sh: Adjust accordingly.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/download.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/guix/scripts/download.scm b/guix/scripts/download.scm
index bb3dc76741..f40213be33 100644
--- a/guix/scripts/download.scm
+++ b/guix/scripts/download.scm
@@ -143,12 +143,15 @@ Supported formats: 'nix-base32' (default), 'base32', and 'base16'
(arg (or (assq-ref opts 'argument)
(leave (G_ "no download URI was specified~%"))))
(uri (or (string->uri arg)
+ (false-if-exception
+ (string->uri
+ (string-append "file://" (canonicalize-path arg))))
(leave (G_ "~a: failed to parse URI~%")
arg)))
(fetch (assq-ref opts 'download-proc))
(path (parameterize ((current-terminal-columns
(terminal-columns)))
- (fetch arg
+ (fetch (uri->string uri)
#:verify-certificate?
(assq-ref opts 'verify-certificate?))))
(hash (call-with-input-file