From bc672694876ef9b237d82a62911cd207620ea838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 23 Aug 2014 20:52:25 +0200 Subject: [PATCH] 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'. --- guix/svn-download.scm | 58 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/guix/svn-download.scm b/guix/svn-download.scm index 9b2b24d92d..cb4d9dcc11 100644 --- a/guix/svn-download.scm +++ b/guix/svn-download.scm @@ -19,7 +19,8 @@ (define-module (guix svn-download) #:use-module (guix records) - #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix monads) #:use-module (guix packages) #:use-module (ice-9 match) #:export (svn-reference @@ -42,9 +43,15 @@ (url svn-reference-url) ; string (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 #: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 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 @@ -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))) (package-derivation store guile system))))) - (define svn-for-build - (match svn - ((? package?) - (package-derivation store svn system)) - (#f ; the default - (let* ((distro (resolve-interface '(gnu packages version-control))) - (svn (module-ref distro 'subversion))) - (package-derivation store svn system))))) + (define build + #~(begin + (use-modules (guix build svn)) + (svn-fetch '#$(svn-reference-url ref) + '#$(svn-reference-revision ref) + #$output + #:svn-command (string-append #$svn "/bin/svn")))) - (let* ((command (string-append (derivation->output-path svn-for-build) - "/bin/svn")) - (builder `(begin - (use-modules (guix build svn)) - (svn-fetch ',(svn-reference-url ref) - ',(svn-reference-revision ref) - %output - #:svn-command ',command)))) - (build-expression->derivation store (or name "svn-checkout") builder - #:system system - #:local-build? #t - #:inputs `(("svn" ,svn-for-build)) - #:hash-algo hash-algo - #:hash hash - #:recursive? #t - #:modules '((guix build svn) - (guix build utils)) - #:guile-for-build guile-for-build - #:local-build? #t))) + (run-with-store store + (gexp->derivation (or name "svn-checkout") build + #:system system + #:local-build? #t + #:hash-algo hash-algo + #:hash hash + #:recursive? #t + #:modules '((guix build svn) + (guix build utils)) + #:guile-for-build guile-for-build + #:local-build? #t) + #:guile-for-build guile-for-build + #:system system)) ;;; svn-download.scm ends here