summaryrefslogtreecommitdiff
path: root/guix/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-10-27 18:55:44 +0100
committerLudovic Courtès <ludo@gnu.org>2019-10-27 23:05:00 +0100
commitf58b45350b0ebfc36a707d9e986f5fe904af3605 (patch)
tree82c0772b4f1262aede6bc5dba42bfe489c3e283c /guix/gexp.scm
parentf726f6f8021e78b6a50ca0dbdb4acc91ed2161c4 (diff)
downloadpatches-f58b45350b0ebfc36a707d9e986f5fe904af3605.tar
patches-f58b45350b0ebfc36a707d9e986f5fe904af3605.tar.gz
gexp: Add 'imported+compiled-modules'.
* guix/gexp.scm (imported+compiled-modules): New procedure. (lower-gexp): Use it instead of separate calls to 'imported-modules' and 'compiled-modules'.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r--guix/gexp.scm45
1 files changed, 31 insertions, 14 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 7323277511..fa74e80cd6 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -654,6 +654,28 @@ names and file names suitable for the #:allowed-references argument to
(load-path lowered-gexp-load-path) ;list of store items
(load-compiled-path lowered-gexp-load-compiled-path)) ;list of store items
+(define* (imported+compiled-modules modules system
+ #:key (extensions '())
+ deprecation-warnings guile
+ (module-path %load-path))
+ "Return a pair where the first element is the imported MODULES and the
+second element is the derivation to compile them."
+ (mlet %store-monad ((modules (if (pair? modules)
+ (imported-modules modules
+ #:system system
+ #:module-path module-path)
+ (return #f)))
+ (compiled (if (pair? modules)
+ (compiled-modules modules
+ #:system system
+ #:module-path module-path
+ #:extensions extensions
+ #:guile guile
+ #:deprecation-warnings
+ deprecation-warnings)
+ (return #f))))
+ (return (cons modules compiled))))
+
(define* (lower-gexp exp
#:key
(module-path %load-path)
@@ -719,20 +741,15 @@ derivations--e.g., code evaluated for its side effects."
(lambda (obj)
(lower-object obj system))
extensions))
- (modules (if (pair? %modules)
- (imported-modules %modules
- #:system system
- #:module-path module-path)
- (return #f)))
- (compiled (if (pair? %modules)
- (compiled-modules %modules
- #:system system
- #:module-path module-path
- #:extensions extensions
- #:guile guile
- #:deprecation-warnings
- deprecation-warnings)
- (return #f))))
+ (modules+compiled (imported+compiled-modules
+ %modules system
+ #:extensions extensions
+ #:deprecation-warnings
+ deprecation-warnings
+ #:guile guile
+ #:module-path module-path))
+ (modules -> (car modules+compiled))
+ (compiled -> (cdr modules+compiled)))
(define load-path
(search-path modules exts
(string-append "/share/guile/site/" effective-version)))