summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-03-03 22:38:21 +0100
committerLudovic Courtès <ludo@gnu.org>2015-03-03 22:58:45 +0100
commit23c0e74375b3ee274068f850208feaaa3d28b9d6 (patch)
treea1c10048a77b64b6b8ebb690882e0993455fb698
parent776463ba9fa73e7d3e147b74614ca25d7c9d8785 (diff)
downloadguix-23c0e74375b3ee274068f850208feaaa3d28b9d6.tar.gz
gnu: git: Install the Bash completion script.
* gnu/packages/version-control.scm (git)[arguments]: Add
  'install-shell-completion' phase.
-rw-r--r--gnu/packages/version-control.scm124
1 files changed, 67 insertions, 57 deletions
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 9fc310d55d..01d9720a2e 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -147,63 +147,73 @@ as well as the classic centralized workflow.")
             (("/usr/bin/perl") (which "perl"))
             (("/usr/bin/python") (which "python"))))
         (alist-cons-after
-         'install 'split
-         (lambda* (#:key inputs outputs #:allow-other-keys)
-           ;; Split the binaries to the various outputs.
-           (let* ((out      (assoc-ref outputs "out"))
-                  (svn      (assoc-ref outputs "svn"))
-                  (gui      (assoc-ref outputs "gui"))
-                  (gitk     (string-append out "/bin/gitk"))
-                  (gitk*    (string-append gui "/bin/gitk"))
-                  (git-gui  (string-append out "/libexec/git-core/git-gui"))
-                  (git-gui* (string-append gui "/libexec/git-core/git-gui"))
-                  (git-cit  (string-append out "/libexec/git-core/git-citool"))
-                  (git-cit* (string-append gui "/libexec/git-core/git-citool"))
-                  (git-svn  (string-append out "/libexec/git-core/git-svn"))
-                  (git-svn* (string-append svn "/libexec/git-core/git-svn"))
-                  (git-sm   (string-append out
-                                           "/libexec/git-core/git-submodule")))
-             (mkdir-p (string-append gui "/bin"))
-             (mkdir-p (string-append gui "/libexec/git-core"))
-             (mkdir-p (string-append svn "/libexec/git-core"))
-
-             (for-each (lambda (old new)
-                         (copy-file old new)
-                         (delete-file old)
-                         (chmod new #o555))
-                       (list gitk git-gui git-cit git-svn)
-                       (list gitk* git-gui* git-cit* git-svn*))
-
-             ;; Tell 'git-svn' where Subversion is.
-             (wrap-program git-svn*
-                           `("PATH" ":" prefix
-                             (,(string-append (assoc-ref inputs "subversion")
-                                              "/bin")))
-                           `("PERL5LIB" ":" prefix
-                             (,(string-append (assoc-ref inputs "subversion")
-                                              "/lib/perl5/site_perl")))
-
-                           ;; XXX: The .so for SVN/Core.pm lacks a RUNPATH, so
-                           ;; help it find 'libsvn_client-1.so'.
-                           `("LD_LIBRARY_PATH" ":" prefix
-                             (,(string-append (assoc-ref inputs "subversion")
-                                              "/lib"))))
-
-             ;; Tell 'git-submodule' where Perl is.
-             (wrap-program git-sm
-                           `("PATH" ":" prefix
-                             (,(string-append (assoc-ref inputs "perl")
-                                              "/bin"))))
-
-             ;; Tell 'git' to look for core programs in the user's profile.
-             ;; This allows user to install other outputs of this package and
-             ;; have them transparently taken into account.  There's a
-             ;; 'GIT_EXEC_PATH' environment variable, but it's supposed to
-             ;; specify a single directory, not a search path.
-             (wrap-program (string-append out "/bin/git")
-                           `("PATH" ":" prefix
-                             ("$HOME/.guix-profile/libexec/git-core")))))
-         %standard-phases))))
+         'install 'install-shell-completion
+         (lambda* (#:key outputs #:allow-other-keys)
+           (let* ((out         (assoc-ref outputs "out"))
+                  (completions (string-append out "/etc/bash_completion.d")))
+             ;; TODO: Install the tcsh and zsh completions in the right place.
+             (mkdir-p completions)
+             (copy-file "contrib/completion/git-completion.bash"
+                        (string-append completions "/git.sh"))
+             #t))
+         (alist-cons-after
+          'install 'split
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            ;; Split the binaries to the various outputs.
+            (let* ((out      (assoc-ref outputs "out"))
+                   (svn      (assoc-ref outputs "svn"))
+                   (gui      (assoc-ref outputs "gui"))
+                   (gitk     (string-append out "/bin/gitk"))
+                   (gitk*    (string-append gui "/bin/gitk"))
+                   (git-gui  (string-append out "/libexec/git-core/git-gui"))
+                   (git-gui* (string-append gui "/libexec/git-core/git-gui"))
+                   (git-cit  (string-append out "/libexec/git-core/git-citool"))
+                   (git-cit* (string-append gui "/libexec/git-core/git-citool"))
+                   (git-svn  (string-append out "/libexec/git-core/git-svn"))
+                   (git-svn* (string-append svn "/libexec/git-core/git-svn"))
+                   (git-sm   (string-append out
+                                            "/libexec/git-core/git-submodule")))
+              (mkdir-p (string-append gui "/bin"))
+              (mkdir-p (string-append gui "/libexec/git-core"))
+              (mkdir-p (string-append svn "/libexec/git-core"))
+
+              (for-each (lambda (old new)
+                          (copy-file old new)
+                          (delete-file old)
+                          (chmod new #o555))
+                        (list gitk git-gui git-cit git-svn)
+                        (list gitk* git-gui* git-cit* git-svn*))
+
+              ;; Tell 'git-svn' where Subversion is.
+              (wrap-program git-svn*
+                `("PATH" ":" prefix
+                  (,(string-append (assoc-ref inputs "subversion")
+                                   "/bin")))
+                `("PERL5LIB" ":" prefix
+                  (,(string-append (assoc-ref inputs "subversion")
+                                   "/lib/perl5/site_perl")))
+
+                ;; XXX: The .so for SVN/Core.pm lacks a RUNPATH, so
+                ;; help it find 'libsvn_client-1.so'.
+                `("LD_LIBRARY_PATH" ":" prefix
+                  (,(string-append (assoc-ref inputs "subversion")
+                                   "/lib"))))
+
+              ;; Tell 'git-submodule' where Perl is.
+              (wrap-program git-sm
+                `("PATH" ":" prefix
+                  (,(string-append (assoc-ref inputs "perl")
+                                   "/bin"))))
+
+              ;; Tell 'git' to look for core programs in the user's profile.
+              ;; This allows user to install other outputs of this package and
+              ;; have them transparently taken into account.  There's a
+              ;; 'GIT_EXEC_PATH' environment variable, but it's supposed to
+              ;; specify a single directory, not a search path.
+              (wrap-program (string-append out "/bin/git")
+                `("PATH" ":" prefix
+                  ("$HOME/.guix-profile/libexec/git-core")))))
+          %standard-phases)))))
    (synopsis "Distributed version control system")
    (description
     "Git is a free distributed version control system designed to handle