svn-download: Rewrite using gexps.
* guix/svn-download.scm (subversion-package): New procedure. (svn-fetch): Use it. Remove 'svn-for-build'. Use a gexp and 'gexp->derivation'.master
parent
6119ebf194
commit
bc67269487
|
@ -19,7 +19,8 @@
|
||||||
|
|
||||||
(define-module (guix svn-download)
|
(define-module (guix svn-download)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (guix derivations)
|
#:use-module (guix gexp)
|
||||||
|
#:use-module (guix monads)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:export (svn-reference
|
#:export (svn-reference
|
||||||
|
@ -42,9 +43,15 @@
|
||||||
(url svn-reference-url) ; string
|
(url svn-reference-url) ; string
|
||||||
(revision svn-reference-revision)) ; number
|
(revision svn-reference-revision)) ; number
|
||||||
|
|
||||||
|
(define (subversion-package)
|
||||||
|
"Return the default Subversion package."
|
||||||
|
(let ((distro (resolve-interface '(gnu packages version-control))))
|
||||||
|
(module-ref distro 'subversion)))
|
||||||
|
|
||||||
(define* (svn-fetch store ref hash-algo hash
|
(define* (svn-fetch store ref hash-algo hash
|
||||||
#:optional name
|
#:optional name
|
||||||
#:key (system (%current-system)) guile svn)
|
#:key (system (%current-system)) guile
|
||||||
|
(svn (subversion-package)))
|
||||||
"Return a fixed-output derivation in STORE that fetches REF, a
|
"Return a fixed-output derivation in STORE that fetches REF, a
|
||||||
<svn-reference> object. The output is expected to have recursive hash HASH of
|
<svn-reference> object. The output is expected to have recursive hash HASH of
|
||||||
type HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if
|
type HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if
|
||||||
|
@ -58,33 +65,26 @@ type HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if
|
||||||
(guile (module-ref distro 'guile-final)))
|
(guile (module-ref distro 'guile-final)))
|
||||||
(package-derivation store guile system)))))
|
(package-derivation store guile system)))))
|
||||||
|
|
||||||
(define svn-for-build
|
(define build
|
||||||
(match svn
|
#~(begin
|
||||||
((? package?)
|
(use-modules (guix build svn))
|
||||||
(package-derivation store svn system))
|
(svn-fetch '#$(svn-reference-url ref)
|
||||||
(#f ; the default
|
'#$(svn-reference-revision ref)
|
||||||
(let* ((distro (resolve-interface '(gnu packages version-control)))
|
#$output
|
||||||
(svn (module-ref distro 'subversion)))
|
#:svn-command (string-append #$svn "/bin/svn"))))
|
||||||
(package-derivation store svn system)))))
|
|
||||||
|
|
||||||
(let* ((command (string-append (derivation->output-path svn-for-build)
|
(run-with-store store
|
||||||
"/bin/svn"))
|
(gexp->derivation (or name "svn-checkout") build
|
||||||
(builder `(begin
|
#:system system
|
||||||
(use-modules (guix build svn))
|
#:local-build? #t
|
||||||
(svn-fetch ',(svn-reference-url ref)
|
#:hash-algo hash-algo
|
||||||
',(svn-reference-revision ref)
|
#:hash hash
|
||||||
%output
|
#:recursive? #t
|
||||||
#:svn-command ',command))))
|
#:modules '((guix build svn)
|
||||||
(build-expression->derivation store (or name "svn-checkout") builder
|
(guix build utils))
|
||||||
#:system system
|
#:guile-for-build guile-for-build
|
||||||
#:local-build? #t
|
#:local-build? #t)
|
||||||
#:inputs `(("svn" ,svn-for-build))
|
#:guile-for-build guile-for-build
|
||||||
#:hash-algo hash-algo
|
#:system system))
|
||||||
#:hash hash
|
|
||||||
#:recursive? #t
|
|
||||||
#:modules '((guix build svn)
|
|
||||||
(guix build utils))
|
|
||||||
#:guile-for-build guile-for-build
|
|
||||||
#:local-build? #t)))
|
|
||||||
|
|
||||||
;;; svn-download.scm ends here
|
;;; svn-download.scm ends here
|
||||||
|
|
Reference in New Issue