aboutsummaryrefslogtreecommitdiff
path: root/guix/download.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-11-01 12:59:31 +0100
committerLudovic Courtès <ludo@gnu.org>2013-11-01 12:59:31 +0100
commitff8061b59161592690ab6ea526282fae11d87676 (patch)
tree09f00df03ec0a1f4922376ba1a0cd4f443a305e4 /guix/download.scm
parente50805251ae7386c2ddbd036885bcc4300cf336e (diff)
parentb645425f71a5a777e7658bbdac0e22e134d44db5 (diff)
downloadgnu-guix-ff8061b59161592690ab6ea526282fae11d87676.tar
gnu-guix-ff8061b59161592690ab6ea526282fae11d87676.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/download.scm')
-rw-r--r--guix/download.scm22
1 files changed, 14 insertions, 8 deletions
diff --git a/guix/download.scm b/guix/download.scm
index 03c2f8066f..837ff0e683 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -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,13 +245,18 @@ 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."
- (call-with-temporary-output-file
- (lambda (temp port)
- (let ((result
- (parameterize ((current-output-port log))
- (build:url-fetch url temp #:mirrors %mirrors))))
- (close port)
- (and result
- (add-to-store store name #f "sha256" temp))))))
+ (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
+ (parameterize ((current-output-port log))
+ (build:url-fetch url temp #:mirrors %mirrors))))
+ (close port)
+ (and result
+ (add-to-store store name #f "sha256" temp)))))))
;;; download.scm ends here