diff options
author | Christopher Baines <mail@cbaines.net> | 2017-06-23 20:53:10 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2017-06-23 20:53:10 +0100 |
commit | eb859e7866e38b8fb19b1aa14ccd85c5375feff0 (patch) | |
tree | 18fa0d186883e31a8dab81cf75ba3b896dda9ed2 | |
parent | ab126c170a42c1a6727e16d7d4ed6be1d34a89f3 (diff) | |
download | guix-support-subdirectories-in-guix-package-path.tar guix-support-subdirectories-in-guix-package-path.tar.gz |
gnu: packages: Support subdirectories in GUIX_PACKAGE_PATHsupport-subdirectories-in-guix-package-path
* gnu/packages.scm (%package-module-path): Treat anything after ^ within each
element of the GUIX_PACKAGE_PATH as a subdirectory.
-rw-r--r-- | gnu/packages.scm | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm index 5629061788..25be89c879 100644 --- a/gnu/packages.scm +++ b/gnu/packages.scm @@ -117,18 +117,35 @@ for system '~a'") ;; Search path for package modules. Each item must be either a directory ;; name or a pair whose car is a directory and whose cdr is a sub-directory ;; to narrow the search. - (let* ((not-colon (char-set-complement (char-set #\:))) - (environment (string-tokenize (or (getenv "GUIX_PACKAGE_PATH") "") - not-colon))) + (let* ((not-colon (char-set-complement (char-set #\:))) + (not-caret (char-set-complement (char-set #\^))) + (path-elements-from-environment + (map + (lambda (path-element) + (match (string-tokenize path-element not-caret) + ((dir) dir) + ((dir sub) (cons dir sub)) + ((dir sub rest ...) + (leave + (G_ "%package-module-path: GUIX_PACKAGE_PATH element \"~A\" + does not match form \"directory[^sub-directory]\".") + path-element)))) + (string-tokenize (or (getenv "GUIX_PACKAGE_PATH") "") + not-colon)))) + ;; Automatically add items from $GUIX_PACKAGE_PATH to Guile's search path. (for-each (lambda (directory) (set! %load-path (cons directory %load-path)) (set! %load-compiled-path (cons directory %load-compiled-path))) - environment) + (map (match-lambda + (directory directory) + ((directory sub-directory) directory)) + path-elements-from-environment)) (make-parameter - (append environment `((,%distro-root-directory . "gnu/packages")))))) + `(,@path-elements-from-environment + (,%distro-root-directory . "gnu/packages"))))) (define %patch-path ;; Define it after '%package-module-path' so that '%load-path' contains user |