summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-01-18 14:59:59 +0100
committerLudovic Courtès <ludo@gnu.org>2019-01-18 17:51:34 +0100
commit3bbd6919bd84b76686d1aa626ba861faf3fc8ceb (patch)
tree8afc7073e7fbf07b7db8fbabfb9191fc91a3950c
parent9fe3f11398e858f1d06120bd046cab506efc86dc (diff)
downloadguix-3bbd6919bd84b76686d1aa626ba861faf3fc8ceb.tar.gz
pull: Suggest running 'hash guix' if needed.
Fixes <https://bugs.gnu.org/33647>.
Suggested by Diego Nicola Barbato <dnbarbato@posteo.de>.

* guix/scripts/pull.scm (build-and-install): Before returning, display a
hint if (which "guix") is not in PROFILE.
-rw-r--r--guix/scripts/pull.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 513434c5f1..d3a4401a01 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -34,11 +34,12 @@
   #:use-module (guix channels)
   #:autoload   (guix inferior) (open-inferior)
   #:use-module (guix scripts build)
+  #:autoload   (guix build utils) (which)
   #:use-module (guix git)
   #:use-module (git)
   #:use-module (gnu packages)
   #:use-module ((guix scripts package) #:select (build-and-use-profile))
-  #:use-module (gnu packages base)
+  #:use-module ((gnu packages base) #:select (canonical-package))
   #:use-module (gnu packages guile)
   #:use-module ((gnu packages bootstrap)
                 #:select (%bootstrap-guile))
@@ -191,7 +192,16 @@ true, display what would be built without actually building it."
                       #:hooks %channel-profile-hooks
                       #:dry-run? dry-run?)
       (munless dry-run?
-        (return (display-profile-news profile))))))
+        (return (display-profile-news profile))
+        (match (which "guix")
+          (#f (return #f))
+          (str
+           (let ((command (string-append profile "/bin/guix")))
+             (unless (string=? command str)
+               (display-hint (format #f (G_ "After setting @code{PATH}, run
+@command{hash guix} to make sure your shell refers to @file{~a}.")
+                                     command)))
+             (return #f))))))))
 
 (define (honor-lets-encrypt-certificates! store)
   "Tell Guile-Git to use the Let's Encrypt certificates."