guix package: Do not list environment variables that need to be set.

Fixes <https://bugs.gnu.org/35942>.

* guix/scripts/package.scm (display-search-paths): Rename to...
(display-search-path-hint): ... this.  Adjust callers.
Remove #:kind parameter.  Replace the list of environment variables with
an invitation to source $GUIX_PROFILE/etc/profile or run 'guix package
--search-paths'.
This commit is contained in:
Ludovic Courtès 2019-06-05 17:33:37 +02:00
parent c0f6eebb6d
commit bcb7c900cc
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 17 additions and 13 deletions

View File

@ -57,7 +57,6 @@
#:export (build-and-use-profile #:export (build-and-use-profile
delete-generations delete-generations
delete-matching-generations delete-matching-generations
display-search-paths
guix-package guix-package
(%options . %package-options) (%options . %package-options)
@ -169,8 +168,7 @@ hooks\" run when building the profile."
"~a packages in profile~%" "~a packages in profile~%"
count) count)
count) count)
(display-search-paths entries (list profile) (display-search-path-hint entries profile)))
#:kind 'prefix)))
(warn-about-disk-space profile)))))) (warn-about-disk-space profile))))))
@ -289,17 +287,23 @@ symlinks like 'canonicalize-path' would do."
file file
(string-append (getcwd) "/" file))) (string-append (getcwd) "/" file)))
(define* (display-search-paths entries profiles (define (display-search-path-hint entries profile)
#:key (kind 'exact)) "Display a hint on how to set environment variables to use ENTRIES, a list
"Display the search path environment variables that may need to be set for of manifest entries, in the context of PROFILE."
ENTRIES, a list of manifest entries, in the context of PROFILE." (let* ((profile (user-friendly-profile (absolutize profile)))
(let* ((profiles (map (compose user-friendly-profile absolutize) (settings (search-path-environment-variables entries (list profile)
profiles)) #:kind 'prefix)))
(settings (search-path-environment-variables entries profiles
#:kind kind)))
(unless (null? settings) (unless (null? settings)
(format #t (G_ "The following environment variable definitions may be needed:~%")) (display-hint (format #f (G_ "Consider setting the necessary environment
(format #t "~{ ~a~%~}" settings)))) variables by running:
@example
GUIX_PROFILE=\"~a\"
. \"$GUIX_PROFILE/etc/profile\"
@end example
Alternately, see @command{guix package --search-paths -p ~s}.")
profile profile)))))
;;; ;;;