From f220a8384890b2a50f30c62fba56e507333f1a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 14 Jan 2015 14:42:10 +0100 Subject: packages: Convert source derivations to monadic style. * guix/packages.scm (origin->derivation): Take body from 'package-source-derivation', and change it to monadic style. Expect METHOD to a monadic procedure. (package-source-derivation): Define in terms of 'origin->derivation'. * guix/download.scm (url-fetch): Remove 'store' argument. Remove 'guile-for-build' variable. Turn into a monadic procedure. * guix/git-download.scm (git-fetch): Likewise. * guix/svn-download.scm (svn-fetch): Likewise. * tests/builders.scm (url-fetch*): New procedure. Change tests to call 'url-fetch*' instead of 'url-fetch'. * tests/packages.scm ("package-source-derivation, snippet"): Remove 'store' parameter of 'fetch' and change it to use 'interned-file' instead of 'add-to-store'. * gnu/packages/bootstrap.scm (bootstrap-origin)[boot]: Remove 'store' parameter. --- guix/git-download.scm | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'guix/git-download.scm') diff --git a/guix/git-download.scm b/guix/git-download.scm index 490d8c319a..94a1245480 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -53,23 +53,13 @@ (let ((distro (resolve-interface '(gnu packages version-control)))) (module-ref distro 'git))) -(define* (git-fetch store ref hash-algo hash +(define* (git-fetch ref hash-algo hash #:optional name - #:key (system (%current-system)) guile + #:key (system (%current-system)) (guile (default-guile)) (git (git-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 -#f." - (define guile-for-build - (match guile - ((? package?) - (package-derivation store guile system)) - (#f ; the default - (let* ((distro (resolve-interface '(gnu packages commencement))) - (guile (module-ref distro 'guile-final))) - (package-derivation store guile system))))) - + "Return a fixed-output derivation 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 #f." (define inputs ;; When doing 'git clone --recursive', we need sed, grep, etc. to be ;; available so that 'git submodule' works. @@ -96,7 +86,7 @@ type HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #:recursive? '#$(git-reference-recursive? ref) #:git-command (string-append #$git "/bin/git")))) - (run-with-store store + (mlet %store-monad ((guile (package->derivation guile system))) (gexp->derivation (or name "git-checkout") build #:system system ;; FIXME: See . @@ -106,9 +96,7 @@ type HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #:recursive? #t #:modules '((guix build git) (guix build utils)) - #:guile-for-build guile-for-build - #:local-build? #t) - #:guile-for-build guile-for-build - #:system system)) + #:guile-for-build guile + #:local-build? #t))) ;;; git-download.scm ends here -- cgit v1.2.3