guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: profiles: Hooks always return a monadic value.


From: Ludovic Courtès
Subject: 02/02: profiles: Hooks always return a monadic value.
Date: Tue, 26 May 2015 21:46:11 +0000

civodul pushed a commit to branch master
in repository guix.

commit 07eaecfae1add0b1b0d78047c0ac7b1229592dcb
Author: Ludovic Courtès <address@hidden>
Date:   Tue May 26 23:38:27 2015 +0200

    profiles: Hooks always return a monadic value.
    
    Suggested by 宋文武 <address@hidden>.
    
    * guix/profiles.scm (ghc-package-cache-file): Return a monadic #f, not just
      #f, when MANIFEST contains no GHC package.
      (profile-derivation): Do not filter based on the return value of HOOK;
      instead filter based on the value of items in EXTRAS.
---
 guix/profiles.scm |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index 9cb226e..9011449 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -516,12 +516,14 @@ entries of MANIFEST, or #f if MANIFEST does not have any 
GHC packages."
           (for-each delete-file (find-files db-dir "\\.conf$"))
           success)))
 
-  ;; Don't depend on GHC when there's nothing to do.
-  (and (any (cut string-prefix? "ghc" <>)
-            (map manifest-entry-name (manifest-entries manifest)))
-       (gexp->derivation "ghc-package-cache" build
-                         #:modules '((guix build utils))
-                         #:local-build? #t)))
+  (with-monad %store-monad
+    ;; Don't depend on GHC when there's nothing to do.
+    (if (any (cut string-prefix? "ghc" <>)
+             (map manifest-entry-name (manifest-entries manifest)))
+        (gexp->derivation "ghc-package-cache" build
+                          #:modules '((guix build utils))
+                          #:local-build? #t)
+        (return #f))))
 
 (define (ca-certificate-bundle manifest)
   "Return a derivation that builds a single-file bundle containing the CA
@@ -602,11 +604,14 @@ the monadic procedures listed in HOOKS--such as an Info 
'dir' file, etc."
   (mlet %store-monad ((extras (if (null? (manifest-entries manifest))
                                   (return '())
                                   (sequence %store-monad
-                                            (filter-map (lambda (hook)
-                                                          (hook manifest))
-                                                        hooks)))))
+                                            (map (lambda (hook)
+                                                   (hook manifest))
+                                                 hooks)))))
     (define inputs
-      (append (map gexp-input extras)
+      (append (filter-map (lambda (gexp)
+                            (and (gexp? gexp)
+                                 (gexp-input gexp)))
+                          extras)
               (manifest-inputs manifest)))
 
     (define builder



reply via email to

[Prev in Thread] Current Thread [Next in Thread]