summaryrefslogtreecommitdiff
path: root/guix/gexp.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-10-06 22:02:20 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-10-06 22:02:20 +0200
commite08902d3cbb307e1523485becbbdaf9aed56ac4a (patch)
treeca79454c4146f37c0e0f4d354d434816928812ed /guix/gexp.scm
parent1714edc3d4e8d6da1b0cdef300ae882d0885f182 (diff)
parentf58702465d0b2daab1775d29439b73b4486a108a (diff)
downloadpatches-e08902d3cbb307e1523485becbbdaf9aed56ac4a.tar
patches-e08902d3cbb307e1523485becbbdaf9aed56ac4a.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r--guix/gexp.scm49
1 files changed, 31 insertions, 18 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 44db75b7c2..600750e846 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -1504,24 +1504,37 @@ are searched for in PATH. Return #f when MODULES and EXTENSIONS are empty."
#:module-path path
#:system system
#:target target)))
- (return (gexp (eval-when (expand load eval)
- (set! %load-path
- (cons (ungexp modules)
- (append (map (lambda (extension)
- (string-append extension
- "/share/guile/site/"
- (effective-version)))
- '((ungexp-native-splicing extensions)))
- %load-path)))
- (set! %load-compiled-path
- (cons (ungexp compiled)
- (append (map (lambda (extension)
- (string-append extension
- "/lib/guile/"
- (effective-version)
- "/site-ccache"))
- '((ungexp-native-splicing extensions)))
- %load-compiled-path)))))))))
+ (return
+ (gexp (eval-when (expand load eval)
+ ;; Augment the load paths and delete duplicates. Do that
+ ;; without loading (srfi srfi-1) or anything.
+ (let ((extensions '((ungexp-native-splicing extensions)))
+ (prepend (lambda (items lst)
+ ;; This is O(N²) but N is typically small.
+ (let loop ((items items)
+ (lst lst))
+ (if (null? items)
+ lst
+ (loop (cdr items)
+ (cons (car items)
+ (delete (car items) lst))))))))
+ (set! %load-path
+ (prepend (cons (ungexp modules)
+ (map (lambda (extension)
+ (string-append extension
+ "/share/guile/site/"
+ (effective-version)))
+ extensions))
+ %load-path))
+ (set! %load-compiled-path
+ (prepend (cons (ungexp compiled)
+ (map (lambda (extension)
+ (string-append extension
+ "/lib/guile/"
+ (effective-version)
+ "/site-ccache"))
+ extensions))
+ %load-compiled-path)))))))))
(define* (gexp->script name exp
#:key (guile (default-guile))