summaryrefslogtreecommitdiff
path: root/guix/download.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-10-08 11:23:22 +0200
committerLudovic Courtès <ludo@gnu.org>2019-10-08 11:37:07 +0200
commitcf3d1763ede1a329c2bc932c84591ab594bb6c96 (patch)
tree665f92418f8671474de3815241fb657384463c94 /guix/download.scm
parentd57660c54907cc6fba8b0adf6295fd2311ada6cf (diff)
parent2fa55c72476c73211cbb2d6b29c05a1ad58a6cf9 (diff)
downloadgnu-guix-cf3d1763ede1a329c2bc932c84591ab594bb6c96.tar
gnu-guix-cf3d1763ede1a329c2bc932c84591ab594bb6c96.tar.gz
Merge branch 'core-updates'
Diffstat (limited to 'guix/download.scm')
-rw-r--r--guix/download.scm28
1 files changed, 24 insertions, 4 deletions
diff --git a/guix/download.scm b/guix/download.scm
index b24aaa0a86..47c8087732 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -36,6 +36,7 @@
#:use-module (srfi srfi-26)
#:export (%mirrors
url-fetch
+ url-fetch/executable
url-fetch/tarbomb
url-fetch/zipbomb
download-to-store))
@@ -419,8 +420,10 @@
(define* (built-in-download file-name url
#:key system hash-algo hash
mirrors content-addressed-mirrors
+ executable?
(guile 'unused))
- "Download FILE-NAME from URL using the built-in 'download' builder.
+ "Download FILE-NAME from URL using the built-in 'download' builder. When
+EXECUTABLE? is true, make the downloaded file executable.
This is an \"out-of-band\" download in that the returned derivation does not
explicitly depend on Guile, GnuTLS, etc. Instead, the daemon performs the
@@ -432,6 +435,7 @@ download by itself using its own dependencies."
#:system system
#:hash-algo hash-algo
#:hash hash
+ #:recursive? executable?
#:sources (list mirrors content-addressed-mirrors)
;; Honor the user's proxy and locale settings.
@@ -442,7 +446,10 @@ download by itself using its own dependencies."
#:env-vars `(("url" . ,(object->string url))
("mirrors" . ,mirrors)
("content-addressed-mirrors"
- . ,content-addressed-mirrors))
+ . ,content-addressed-mirrors)
+ ,@(if executable?
+ '(("executable" . "1"))
+ '()))
;; Do not offload this derivation because we cannot be
;; sure that the remote daemon supports the 'download'
@@ -453,11 +460,13 @@ download by itself using its own dependencies."
(define* (url-fetch url hash-algo hash
#:optional name
#:key (system (%current-system))
- (guile (default-guile)))
+ (guile (default-guile))
+ executable?)
"Return a fixed-output derivation that fetches URL (a string, or a list of
strings denoting alternate URLs), which is expected to have hash HASH of type
HASH-ALGO (a symbol). By default, the file name is the base name of URL;
-optionally, NAME can specify a different file name.
+optionally, NAME can specify a different file name. When EXECUTABLE? is true,
+make the downloaded file executable.
When one of the URL starts with mirror://, then its host part is
interpreted as the name of a mirror scheme, taken from %MIRROR-FILE.
@@ -488,10 +497,21 @@ in the store."
#:system system
#:hash-algo hash-algo
#:hash hash
+ #:executable? executable?
#:mirrors %mirror-file
#:content-addressed-mirrors
%content-addressed-mirror-file)))))
+(define* (url-fetch/executable url hash-algo hash
+ #:optional name
+ #:key (system (%current-system))
+ (guile (default-guile)))
+ "Like 'url-fetch', but make the downloaded file executable."
+ (url-fetch url hash-algo hash name
+ #:system system
+ #:guile guile
+ #:executable? #t))
+
(define* (url-fetch/tarbomb url hash-algo hash
#:optional name
#:key (system (%current-system))