From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#35942: guix install: environment variable message is very confusing Date: Fri, 31 May 2019 23:19:55 +0200 Message-ID: <87k1e6nwxw.fsf@gnu.org> References: <871s0ipyr1.fsf@nckx> <87sgsyvc0e.fsf@gnu.org> <871s0gl8st.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:33541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWoxT-0001uf-Kk for bug-guix@gnu.org; Fri, 31 May 2019 17:21:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hWoxS-0005Ta-BE for bug-guix@gnu.org; Fri, 31 May 2019 17:21:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51142) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hWoxS-0005TU-81 for bug-guix@gnu.org; Fri, 31 May 2019 17:21:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hWoxS-0008AD-37 for bug-guix@gnu.org; Fri, 31 May 2019 17:21:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <871s0gl8st.fsf@elephly.net> (Ricardo Wurmus's message of "Thu, 30 May 2019 09:07:30 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ricardo Wurmus Cc: 35942@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi! Ricardo Wurmus skribis: > Ludovic Court=C3=A8s writes: [...] >>> >> >> I don=E2=80=99t think we reached a conclusion back then. I=E2=80=99m fi= ne with Robert=E2=80=99s >> suggestion, but do people think it will really help? >> >> Others were in favor of dropping this message altogether, which I think >> wouldn=E2=80=99t be a good idea: how would people discover about search = path >> handling? > > I was in favour of *replacing* the message with the suggestion to run > > export GUIX_PROFILE=3D/this/profile > source $GUIX_PROFILE/etc/profile > > because it usually does the right thing. > > It looks less overwhelming than the individual list of environment > variables. I=E2=80=99ve seen a lot of people who added all of these vari= ables > to their bashrc (or bash_profile if they talked to me before), which is > not what we want to encourage. > > We can also hint at =E2=80=9Cguix package --search-paths=E2=80=9D to see = a full list of > environment variables for people who want to set them manually right > here and now. Sounds good to me. How about the following patch? It does produce a slightly verbose message, but I don=E2=80=99t think we ca= n do much better (we could save one line by not mentioning =E2=80=98--search-pat= hs=E2=80=99.) Thanks for getting the ball rolling. :-) Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 06e4cf5b9c..5751123525 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -57,7 +57,6 @@ #:export (build-and-use-profile delete-generations delete-matching-generations - display-search-paths guix-package (%options . %package-options) @@ -169,8 +168,7 @@ hooks\" run when building the profile." "~a packages in profile~%" count) count) - (display-search-paths entries (list profile) - #:kind 'prefix))) + (display-search-path-hint entries profile))) (warn-about-disk-space profile)))))) @@ -289,17 +287,23 @@ symlinks like 'canonicalize-path' would do." file (string-append (getcwd) "/" file))) -(define* (display-search-paths entries profiles - #:key (kind 'exact)) - "Display the search path environment variables that may need to be set for -ENTRIES, a list of manifest entries, in the context of PROFILE." - (let* ((profiles (map (compose user-friendly-profile absolutize) - profiles)) - (settings (search-path-environment-variables entries profiles - #:kind kind))) +(define (display-search-path-hint entries profile) + "Display a hint on how to set environment variables to use ENTRIES, a list +of manifest entries, in the context of PROFILE." + (let* ((profile (user-friendly-profile (absolutize profile))) + (settings (search-path-environment-variables entries (list profile) + #:kind 'prefix))) (unless (null? settings) - (format #t (G_ "The following environment variable definitions may be needed:~%")) - (format #t "~{ ~a~%~}" settings)))) + (display-hint (format #f (G_ "Consider setting the necessary environment +variables by running: + +@example +GUIX_PROFILE=\"~a\" +. \"$GUIX_PROFILE/etc/profile\" +@end example + +Alternately, see @command{guix package --search-paths -p ~s}.") + profile profile))))) ;;; --=-=-=--