guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/07: gnu: bash-completion: Search for completion modules in profiles.


From: Ludovic Courtès
Subject: 03/07: gnu: bash-completion: Search for completion modules in profiles.
Date: Thu, 12 Mar 2015 21:52:32 +0000

civodul pushed a commit to branch master
in repository guix.

commit 16629c8adf90db559a32b7a2c5ec8a94be7ef7ba
Author: Ludovic Courtès <address@hidden>
Date:   Thu Mar 12 22:08:04 2015 +0100

    gnu: bash-completion: Search for completion modules in profiles.
    
    * gnu/packages/patches/bash-completion-directories.patch: New file.
    * gnu-system.am (dist_patch_DATA): Add it.
    * gnu/packages/bash.scm (bash-completion)[source]: Use it.
---
 gnu-system.am                                      |    1 +
 gnu/packages/bash.scm                              |    5 ++-
 .../patches/bash-completion-directories.patch      |   33 ++++++++++++++++++++
 3 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/gnu-system.am b/gnu-system.am
index aa37726..bd3f434 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -364,6 +364,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/automake-skip-amhello-tests.patch       \
   gnu/packages/patches/avahi-localstatedir.patch               \
   gnu/packages/patches/avrdude-fix-libusb.patch                        \
+  gnu/packages/patches/bash-completion-directories.patch       \
   gnu/packages/patches/bowtie-fix-makefile.patch               \
   gnu/packages/patches/bigloo-gc-shebangs.patch                        \
   gnu/packages/patches/binutils-ld-new-dtags.patch             \
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index c669194..361eb47 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -19,6 +19,7 @@
 
 (define-module (gnu packages bash)
   #:use-module (guix licenses)
+  #:use-module (gnu packages)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages bison)
@@ -218,7 +219,9 @@ without modification.")
                     "bash-completion-" version ".tar.bz2"))
               (sha256
                (base32
-                "0kxf8s5bw7y50x0ksb77d3kv0dwadixhybl818w27y6mlw26hq1b"))))
+                "0kxf8s5bw7y50x0ksb77d3kv0dwadixhybl818w27y6mlw26hq1b"))
+              (patches
+               (list (search-patch "bash-completion-directories.patch")))))
     (build-system gnu-build-system)
     (synopsis "Bash completions for common commands")
     (description
diff --git a/gnu/packages/patches/bash-completion-directories.patch 
b/gnu/packages/patches/bash-completion-directories.patch
new file mode 100644
index 0000000..1a3e2f5
--- /dev/null
+++ b/gnu/packages/patches/bash-completion-directories.patch
@@ -0,0 +1,33 @@
+Bash-completion is written with FHS in mind where completion scripts
+all get added to /usr/share/bash-completion/completions and are picked
+up by the dynamic completion loader from there---whether they are
+part of bash-completion or installed by another package.
+
+On Guix systems, we want not only to search within bash-completion's own
+directory, but also in the user's profile and in the system profile.
+This is what this patch does.
+
+--- bash-completion-2.1/bash_completion        2015-03-11 09:45:45.056846446 
+0100
++++ bash-completion-2.1/bash_completion        2015-03-11 09:52:43.248159504 
+0100
+@@ -1928,9 +1928,20 @@ _completion_loader()
+     local compfile=./completions
+     [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions"
+     compfile+="/${1##*/}"
++    local base="${1##*/}"
+ 
++    # Look for completion files in the user and global profiles and
++    # lastly in 'bash-completion' itself.
++    for file in                                                               
  \
++        "$HOME/.guix-profile/share/bash-completion/completions/$base"         
  \
++        "$HOME/.guix-profile/etc/bash_completion.d/$base"                     
  \
++        "/run/current-system/profile/share/bash-completion/completions/$base" 
  \
++        "/run/current-system/profile/etc/bash_completion.d/$base"             
  \
++        "$compfile"
++    do
+     # Avoid trying to source dirs; https://bugzilla.redhat.com/903540
+-    [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124
++        [[ -f "$file" ]] && . "$file" &>/dev/null && return 124
++    done
+ 
+     # Need to define *something*, otherwise there will be no completion at 
all.
+     complete -F _minimal "$1" && return 124



reply via email to

[Prev in Thread] Current Thread [Next in Thread]