summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-10-27 15:18:31 +0100
committerLudovic Courtès <ludo@gnu.org>2019-10-27 23:04:59 +0100
commitcf7648f882380dd7a4e82760ecc10cc6078498eb (patch)
tree017120939861ab6bb082f7ecba9a2d309ab9549c
parent6d18427fa5388e19f37ddeda13754fa10e8f7c55 (diff)
downloadguix-cf7648f882380dd7a4e82760ecc10cc6078498eb.tar.gz
derivations: Introduce 'imported+compiled-modules'.
* guix/derivations.scm (imported+compiled-modules): New procedure.
(build-expression->derivation): Use it instead of separate calls to
'%imported-modules' and '%compiled-modules'.
-rw-r--r--guix/derivations.scm23
1 files changed, 15 insertions, 8 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index e1073ea39b..8309f845d9 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1207,6 +1207,14 @@ they can refer to each other."
                                   #:guile-for-build guile
                                   #:local-build? #t)))
 
+(define* (imported+compiled-modules store modules #:key
+                                    (system (%current-system))
+                                    (guile (%guile-for-build)))
+  "Return a pair containing the derivation to import MODULES and that where
+MODULES are compiled."
+  (cons (%imported-modules store modules #:system system #:guile guile)
+        (%compiled-modules store modules #:system system #:guile guile)))
+
 (define* (build-expression->derivation store name exp ;deprecated
                                        #:key
                                        (system (%current-system))
@@ -1330,16 +1338,15 @@ and PROPERTIES."
                                       ;; fixed-output.
                                       (filter-map source-path inputs)))
 
-         (mod-drv  (and (pair? modules)
-                        (%imported-modules store modules
-                                           #:guile guile-drv
-                                           #:system system)))
+         (mod+go-drv  (if (pair? modules)
+                          (imported+compiled-modules store modules
+                                                     #:guile guile-drv
+                                                     #:system system)
+                          '(#f . #f)))
+         (mod-drv  (car mod+go-drv))
+         (go-drv   (cdr mod+go-drv))
          (mod-dir  (and mod-drv
                         (derivation->output-path mod-drv)))
-         (go-drv   (and (pair? modules)
-                        (%compiled-modules store modules
-                                           #:guile guile-drv
-                                           #:system system)))
          (go-dir   (and go-drv
                         (derivation->output-path go-drv))))
     (derivation store name guile