summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-04-19 22:46:10 +0200
committerLudovic Courtès <ludo@gnu.org>2015-04-19 23:34:53 +0200
commitb16b77905cd8c5a33dd5240d2e5c7ae0c4b2cdf6 (patch)
tree828b5b0cd8ae443fa57af3101faae715e7c11385
parentee8591990fd38ee2860f0ab659b05052b10f14c6 (diff)
downloadguix-b16b77905cd8c5a33dd5240d2e5c7ae0c4b2cdf6.tar.gz
gnu: bash-completion: Remove completions redundant with those of util-linux.
* gnu/packages/bash.scm (bash-completion)[arguments]: New field.
-rw-r--r--gnu/packages/bash.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 02cb45c955..45676f568b 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -23,6 +23,7 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages bison)
+  #:use-module (gnu packages linux)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -247,6 +248,29 @@ without modification.")
               (patches
                (list (search-patch "bash-completion-directories.patch")))))
     (build-system gnu-build-system)
+    (native-inputs `(("util-linux" ,util-linux)))
+    (arguments
+     `(#:phases (alist-cons-after
+                 'install 'remove-redundant-completions
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   ;; Util-linux comes with a bunch of completion files for
+                   ;; its own commands which are more sophisticated and
+                   ;; up-to-date than those of bash-completion.  Remove those
+                   ;; from bash-completion.
+                   (let* ((out         (assoc-ref outputs "out"))
+                          (util-linux  (assoc-ref inputs "util-linux"))
+                          (completions (string-append out
+                                                      "/share/bash-completion"
+                                                      "/completions"))
+                          (already     (find-files (string-append util-linux
+                                                                  "/etc/bash_completion.d"))))
+                     (with-directory-excursion completions
+                       (for-each (lambda (file)
+                                   (when (file-exists? file)
+                                     (delete-file file)))
+                                 (map basename already)))
+                     #t))
+                 %standard-phases)))
     (synopsis "Bash completions for common commands")
     (description
      "This package provides extensions that allow Bash to provide adapted