aboutsummaryrefslogtreecommitdiff
path: root/guix/svn-download.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-10-17 17:34:33 +0200
committerLudovic Courtès <ludo@gnu.org>2022-10-17 23:15:07 +0200
commit8599fccef84a2930280a5b2844829cfbafd593b0 (patch)
treeed8a91b2e9aded8f7fee87965751dce3d2d86821 /guix/svn-download.scm
parentec7ba6ae5308faba68181f3fffc7d115d37cd1d4 (diff)
downloadguix-8599fccef84a2930280a5b2844829cfbafd593b0.tar
guix-8599fccef84a2930280a5b2844829cfbafd593b0.tar.gz
svn-download: Pass parameters through environment variables.
This ensures a single "svn-download" script is created in the store for all the origins that use 'svn-fetch'. * guix/svn-download.scm (svn-fetch)[build]: Check for environment variables instead of splicing REF fields. Pass #:script-name and #:env-vars to 'gexp->derivation'.
Diffstat (limited to 'guix/svn-download.scm')
-rw-r--r--guix/svn-download.scm41
1 files changed, 33 insertions, 8 deletions
diff --git a/guix/svn-download.scm b/guix/svn-download.scm
index 55ce0d7351..1c369e7f9a 100644
--- a/guix/svn-download.scm
+++ b/guix/svn-download.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014-2016, 2019, 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
;;; Copyright © 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
;;;
@@ -79,17 +79,42 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
(with-imported-modules '((guix build svn)
(guix build utils))
#~(begin
- (use-modules (guix build svn))
- (svn-fetch '#$(svn-reference-url ref)
- '#$(svn-reference-revision ref)
+ (use-modules (guix build svn)
+ (ice-9 match))
+
+ (svn-fetch (getenv "svn url")
+ (string->number (getenv "svn revision"))
#$output
- #:svn-command (string-append #+svn "/bin/svn")
- #:recursive? #$(svn-reference-recursive? ref)
- #:user-name #$(svn-reference-user-name ref)
- #:password #$(svn-reference-password ref)))))
+ #:svn-command #+(file-append svn "/bin/svn")
+ #:recursive? (match (getenv "svn recursive?")
+ ("yes" #t)
+ (_ #f))
+ #:user-name (getenv "svn user name")
+ #:password (getenv "svn password")))))
(mlet %store-monad ((guile (package->derivation guile system)))
(gexp->derivation (or name "svn-checkout") build
+
+ ;; Use environment variables and a fixed script name so
+ ;; there's only one script in store for all the
+ ;; downloads.
+ #:script-name "svn-download"
+ #:env-vars
+ `(("svn url" . ,(svn-reference-url ref))
+ ("svn revision"
+ . ,(number->string (svn-reference-revision ref)))
+ ,@(if (svn-reference-recursive? ref)
+ `(("svn recursive?" . "yes"))
+ '())
+ ,@(if (svn-reference-user-name ref)
+ `(("svn user name"
+ . ,(svn-reference-user-name ref)))
+ '())
+ ,@(if (svn-reference-password ref)
+ `(("svn password"
+ . ,(svn-reference-password ref)))
+ '()))
+
#:system system
#:hash-algo hash-algo
#:hash hash