guix: Support authentication when fetching from SVN.
* guix/svn-download.scm (<svn-reference>): Add fields for optional credentials. (svn-fetch): Pass credentials to build-side "svn-fetch". * guix/build/svn.scm (svn-fetch): Pass optional credentials to svn command.master
parent
1095bd1db0
commit
140dd8f82c
|
@ -29,15 +29,22 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(define* (svn-fetch url revision directory
|
(define* (svn-fetch url revision directory
|
||||||
#:key (svn-command "svn"))
|
#:key (svn-command "svn")
|
||||||
|
(user-name #f)
|
||||||
|
(password #f))
|
||||||
"Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a
|
"Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a
|
||||||
valid Subversion revision. Return #t on success, #f otherwise."
|
valid Subversion revision. Return #t on success, #f otherwise."
|
||||||
(and (zero? (system* svn-command "checkout" "--non-interactive"
|
(and (zero? (apply system* svn-command
|
||||||
;; Trust the server certificate. This is OK as we
|
"checkout" "--non-interactive"
|
||||||
;; verify the checksum later. This can be removed when
|
;; Trust the server certificate. This is OK as we
|
||||||
;; ca-certificates package is added.
|
;; verify the checksum later. This can be removed when
|
||||||
"--trust-server-cert" "-r" (number->string revision)
|
;; ca-certificates package is added.
|
||||||
url directory))
|
"--trust-server-cert" "-r" (number->string revision)
|
||||||
|
`(,@(if (and user-name password)
|
||||||
|
(list (string-append "--username=" user-name)
|
||||||
|
(string-append "--password=" password))
|
||||||
|
'())
|
||||||
|
,url ,directory)))
|
||||||
(with-directory-excursion directory
|
(with-directory-excursion directory
|
||||||
(begin
|
(begin
|
||||||
;; The contents of '.svn' vary as a function of the current status
|
;; The contents of '.svn' vary as a function of the current status
|
||||||
|
|
|
@ -41,8 +41,10 @@
|
||||||
(define-record-type* <svn-reference>
|
(define-record-type* <svn-reference>
|
||||||
svn-reference make-svn-reference
|
svn-reference make-svn-reference
|
||||||
svn-reference?
|
svn-reference?
|
||||||
(url svn-reference-url) ; string
|
(url svn-reference-url) ; string
|
||||||
(revision svn-reference-revision)) ; number
|
(revision svn-reference-revision) ; number
|
||||||
|
(user-name svn-reference-user-name (default #f))
|
||||||
|
(password svn-reference-password (default #f)))
|
||||||
|
|
||||||
(define (subversion-package)
|
(define (subversion-package)
|
||||||
"Return the default Subversion package."
|
"Return the default Subversion package."
|
||||||
|
@ -62,7 +64,9 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
|
||||||
(svn-fetch '#$(svn-reference-url ref)
|
(svn-fetch '#$(svn-reference-url ref)
|
||||||
'#$(svn-reference-revision ref)
|
'#$(svn-reference-revision ref)
|
||||||
#$output
|
#$output
|
||||||
#:svn-command (string-append #+svn "/bin/svn"))))
|
#:svn-command (string-append #+svn "/bin/svn")
|
||||||
|
#:user-name #$(svn-reference-user-name ref)
|
||||||
|
#:password #$(svn-reference-password ref))))
|
||||||
|
|
||||||
(mlet %store-monad ((guile (package->derivation guile system)))
|
(mlet %store-monad ((guile (package->derivation guile system)))
|
||||||
(gexp->derivation (or name "svn-checkout") build
|
(gexp->derivation (or name "svn-checkout") build
|
||||||
|
|
Reference in New Issue