From debbugs-submit-bounces@debbugs.gnu.org Fri May 31 17:20:09 2019 Received: (at 35942) by debbugs.gnu.org; 31 May 2019 21:20:09 +0000 Received: from localhost ([127.0.0.1]:36453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWowa-00087w-Sm for submit@debbugs.gnu.org; Fri, 31 May 2019 17:20:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWowY-00087E-CF for 35942@debbugs.gnu.org; Fri, 31 May 2019 17:20:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWowQ-0004qA-Kq; Fri, 31 May 2019 17:19:58 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53382 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hWowP-00029L-VE; Fri, 31 May 2019 17:19:58 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Ricardo Wurmus Subject: Re: bug#35942: guix install: environment variable message is very confusing References: <871s0ipyr1.fsf@nckx> <87sgsyvc0e.fsf@gnu.org> <871s0gl8st.fsf@elephly.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 12 Prairial an 227 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 31 May 2019 23:19:55 +0200 In-Reply-To: <871s0gl8st.fsf@elephly.net> (Ricardo Wurmus's message of "Thu, 30 May 2019 09:07:30 +0200") Message-ID: <87k1e6nwxw.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 35942 Cc: Tobias Geerinckx-Rice , 35942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= 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))))) ;;; --=-=-=--