gnu: git: Install the Bash completion script.

* gnu/packages/version-control.scm (git)[arguments]: Add
  'install-shell-completion' phase.
This commit is contained in:
Ludovic Courtès 2015-03-03 22:38:21 +01:00
parent 776463ba9f
commit 23c0e74375

View file

@ -147,63 +147,73 @@ (define-public git
(("/usr/bin/perl") (which "perl")) (("/usr/bin/perl") (which "perl"))
(("/usr/bin/python") (which "python")))) (("/usr/bin/python") (which "python"))))
(alist-cons-after (alist-cons-after
'install 'split 'install 'install-shell-completion
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
;; Split the binaries to the various outputs. (let* ((out (assoc-ref outputs "out"))
(let* ((out (assoc-ref outputs "out")) (completions (string-append out "/etc/bash_completion.d")))
(svn (assoc-ref outputs "svn")) ;; TODO: Install the tcsh and zsh completions in the right place.
(gui (assoc-ref outputs "gui")) (mkdir-p completions)
(gitk (string-append out "/bin/gitk")) (copy-file "contrib/completion/git-completion.bash"
(gitk* (string-append gui "/bin/gitk")) (string-append completions "/git.sh"))
(git-gui (string-append out "/libexec/git-core/git-gui")) #t))
(git-gui* (string-append gui "/libexec/git-core/git-gui")) (alist-cons-after
(git-cit (string-append out "/libexec/git-core/git-citool")) 'install 'split
(git-cit* (string-append gui "/libexec/git-core/git-citool")) (lambda* (#:key inputs outputs #:allow-other-keys)
(git-svn (string-append out "/libexec/git-core/git-svn")) ;; Split the binaries to the various outputs.
(git-svn* (string-append svn "/libexec/git-core/git-svn")) (let* ((out (assoc-ref outputs "out"))
(git-sm (string-append out (svn (assoc-ref outputs "svn"))
"/libexec/git-core/git-submodule"))) (gui (assoc-ref outputs "gui"))
(mkdir-p (string-append gui "/bin")) (gitk (string-append out "/bin/gitk"))
(mkdir-p (string-append gui "/libexec/git-core")) (gitk* (string-append gui "/bin/gitk"))
(mkdir-p (string-append svn "/libexec/git-core")) (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) (for-each (lambda (old new)
(copy-file old new) (copy-file old new)
(delete-file old) (delete-file old)
(chmod new #o555)) (chmod new #o555))
(list gitk git-gui git-cit git-svn) (list gitk git-gui git-cit git-svn)
(list gitk* git-gui* git-cit* git-svn*)) (list gitk* git-gui* git-cit* git-svn*))
;; Tell 'git-svn' where Subversion is. ;; Tell 'git-svn' where Subversion is.
(wrap-program git-svn* (wrap-program git-svn*
`("PATH" ":" prefix `("PATH" ":" prefix
(,(string-append (assoc-ref inputs "subversion") (,(string-append (assoc-ref inputs "subversion")
"/bin"))) "/bin")))
`("PERL5LIB" ":" prefix `("PERL5LIB" ":" prefix
(,(string-append (assoc-ref inputs "subversion") (,(string-append (assoc-ref inputs "subversion")
"/lib/perl5/site_perl"))) "/lib/perl5/site_perl")))
;; XXX: The .so for SVN/Core.pm lacks a RUNPATH, so ;; XXX: The .so for SVN/Core.pm lacks a RUNPATH, so
;; help it find 'libsvn_client-1.so'. ;; help it find 'libsvn_client-1.so'.
`("LD_LIBRARY_PATH" ":" prefix `("LD_LIBRARY_PATH" ":" prefix
(,(string-append (assoc-ref inputs "subversion") (,(string-append (assoc-ref inputs "subversion")
"/lib")))) "/lib"))))
;; Tell 'git-submodule' where Perl is. ;; Tell 'git-submodule' where Perl is.
(wrap-program git-sm (wrap-program git-sm
`("PATH" ":" prefix `("PATH" ":" prefix
(,(string-append (assoc-ref inputs "perl") (,(string-append (assoc-ref inputs "perl")
"/bin")))) "/bin"))))
;; Tell 'git' to look for core programs in the user's profile. ;; Tell 'git' to look for core programs in the user's profile.
;; This allows user to install other outputs of this package and ;; This allows user to install other outputs of this package and
;; have them transparently taken into account. There's a ;; have them transparently taken into account. There's a
;; 'GIT_EXEC_PATH' environment variable, but it's supposed to ;; 'GIT_EXEC_PATH' environment variable, but it's supposed to
;; specify a single directory, not a search path. ;; specify a single directory, not a search path.
(wrap-program (string-append out "/bin/git") (wrap-program (string-append out "/bin/git")
`("PATH" ":" prefix `("PATH" ":" prefix
("$HOME/.guix-profile/libexec/git-core"))))) ("$HOME/.guix-profile/libexec/git-core")))))
%standard-phases)))) %standard-phases)))))
(synopsis "Distributed version control system") (synopsis "Distributed version control system")
(description (description
"Git is a free distributed version control system designed to handle "Git is a free distributed version control system designed to handle