guix-devel
[Top][All Lists]
Advanced

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

[PATCH] gnu: bash-completion: Update to 2.3.


From: Tomáš Čech
Subject: [PATCH] gnu: bash-completion: Update to 2.3.
Date: Wed, 3 Aug 2016 10:53:11 +0200

* gnu/packages/bash.scm(bash-completion): Update to 2.3, add autoreconf
  phase, change origin to Github.
* gnu/packages/patches/bash-completion-directories.patch: Rework - same
  purpose, different code.
---
 gnu/packages/bash.scm                              | 62 ++++++++++++----------
 .../patches/bash-completion-directories.patch      | 39 ++++++--------
 2 files changed, 50 insertions(+), 51 deletions(-)

diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index ff3acfc..6f3fe17 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2014, 2015 Mark H Weaver <address@hidden>
 ;;; Copyright © 2015 Leo Famulari <address@hidden>
+;;; Copyright © 2016 Tomáš Čech <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,7 @@
 (define-module (gnu packages bash)
   #:use-module (guix licenses)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages bison)
@@ -275,43 +277,47 @@ without modification.")
 (define-public bash-completion
   (package
     (name "bash-completion")
-    (version "2.1")
+    (version "2.3")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "http://bash-completion.alioth.debian.org/files/";
-                    "bash-completion-" version ".tar.bz2"))
+                    "https://github.com/scop/"; name "/archive/" version
+                    ".tar.gz"))
               (sha256
                (base32
-                "0kxf8s5bw7y50x0ksb77d3kv0dwadixhybl818w27y6mlw26hq1b"))
+                "0aij7fmn6f7q3z6pbqn61h0b81ydl5iv19zhhj5cdfz3yvswwbyr"))
               (patches
                (search-patches "bash-completion-directories.patch"))))
     (build-system gnu-build-system)
-    (native-inputs `(("util-linux" ,util-linux)))
+    (native-inputs `(("util-linux" ,util-linux)
+                     ("autoconf" ,autoconf)
+                     ("automake" ,automake)))
     (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)))
+     `(#:phases (modify-phases %standard-phases
+                  (add-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)))
+                  (add-before 'configure 'autoconf
+                    (lambda _
+                      (zero? (system* "autoreconf" "-vfi")))))))
     (synopsis "Bash completions for common commands")
     (description
      "This package provides extensions that allow Bash to provide adapted
diff --git a/gnu/packages/patches/bash-completion-directories.patch 
b/gnu/packages/patches/bash-completion-directories.patch
index 1a3e2f5..9a40f11 100644
--- a/gnu/packages/patches/bash-completion-directories.patch
+++ b/gnu/packages/patches/bash-completion-directories.patch
@@ -7,27 +7,20 @@ 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##*/}"
+--- a/bash_completiong 2016-08-03 10:23:02.356782287 +0200
++++ b/bash_completion  2016-08-03 10:27:50.120140403 +0200
+@@ -1960,7 +1960,13 @@
  
-+    # 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
+ __load_completion()
+ {
+-    local -a dirs=( 
${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
 )
++    local -a dirs=(
++        "$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"
++        
${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
 )
++
+     local OIFS=$IFS IFS=: dir cmd="$1" compfile
+     for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do
+         dirs+=( $dir/bash-completion/completions )
-- 
2.9.2




reply via email to

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