packages: Add the channel .go files to the search path.

Until now %LOAD-COMPILED-PATH would wrongfully contain:

  CHANNEL/share/guile/site/X.Y

for each channel, thereby ignoring all the .go files of channels.  This
fixes it so that %LOAD-COMPILED-PATH instead contains:

  CHANNEL/lib/guile/X.Y/site-ccache

* guix/describe.scm (current-channel-entries): New procedure.
(package-path-entries): Change to return the %LOAD-COMPILED-PATH entries
as a second value.
* gnu/packages.scm (%package-module-path): Expect two values from
'package-path-entries' and augment %LOAD-COMPILED-PATH accordingly.
master
Ludovic Courtès 2019-03-11 22:14:30 +01:00
parent 082c648d28
commit bfc9c33930
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 30 additions and 18 deletions

View File

@ -155,23 +155,26 @@ flags."
;; Search path for package modules. Each item must be either a directory ;; 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 ;; name or a pair whose car is a directory and whose cdr is a sub-directory
;; to narrow the search. ;; to narrow the search.
(let* ((not-colon (char-set-complement (char-set #\:))) (let*-values (((not-colon)
(environment (string-tokenize (or (getenv "GUIX_PACKAGE_PATH") "") (char-set-complement (char-set #\:)))
not-colon)) ((environment)
(channels (package-path-entries))) (string-tokenize (or (getenv "GUIX_PACKAGE_PATH") "")
not-colon))
((channels-scm channels-go)
(package-path-entries)))
;; Automatically add channels and items from $GUIX_PACKAGE_PATH to Guile's ;; Automatically add channels and items from $GUIX_PACKAGE_PATH to Guile's
;; search path. For historical reasons, $GUIX_PACKAGE_PATH goes to the ;; search path. For historical reasons, $GUIX_PACKAGE_PATH goes to the
;; front; channels go to the back so that they don't override Guix' own ;; front; channels go to the back so that they don't override Guix' own
;; modules. ;; modules.
(set! %load-path (set! %load-path
(append environment %load-path channels)) (append environment %load-path channels-scm))
(set! %load-compiled-path (set! %load-compiled-path
(append environment %load-compiled-path channels)) (append environment %load-compiled-path channels-go))
(make-parameter (make-parameter
(append environment (append environment
%default-package-module-path %default-package-module-path
channels)))) channels-scm))))
(define %patch-path (define %patch-path
;; Define it after '%package-module-path' so that '%load-path' contains user ;; Define it after '%package-module-path' so that '%load-path' contains user

View File

@ -65,19 +65,28 @@ lives in, or #f if this is not applicable."
(let ((manifest (profile-manifest profile))) (let ((manifest (profile-manifest profile)))
(manifest-entries manifest)))))) (manifest-entries manifest))))))
(define package-path-entries (define current-channel-entries
(mlambda () (mlambda ()
"Return a list of package path entries to be added to the package search "Return manifest entries corresponding to extra channels--i.e., not the
path. These entries are taken from the 'guix pull' profile the calling 'guix' channel."
process lives in, when applicable." (remove (lambda (entry)
;; Filter out Guix itself. (string=? (manifest-entry-name entry) "guix"))
(filter-map (lambda (entry) (current-profile-entries))))
(and (not (string=? (manifest-entry-name entry)
"guix")) (define (package-path-entries)
(string-append (manifest-entry-item entry) "Return two values: the list of package path entries to be added to the
package search path, and the list to be added to %LOAD-COMPILED-PATH. These
entries are taken from the 'guix pull' profile the calling process lives in,
when applicable."
;; Filter out Guix itself.
(unzip2 (map (lambda (entry)
(list (string-append (manifest-entry-item entry)
"/share/guile/site/" "/share/guile/site/"
(effective-version)))) (effective-version))
(current-profile-entries)))) (string-append (manifest-entry-item entry)
"/lib/guile/" (effective-version)
"/site-ccache")))
(current-profile-entries))))
(define (package-provenance package) (define (package-provenance package)
"Return the provenance of PACKAGE as an sexp for use as the 'provenance' "Return the provenance of PACKAGE as an sexp for use as the 'provenance'