unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: bash-completion: Update to 2.3.
@ 2016-08-03  8:53 Tomáš Čech
  2016-08-05 18:53 ` Andreas Enge
  0 siblings, 1 reply; 9+ messages in thread
From: Tomáš Čech @ 2016-08-03  8:53 UTC (permalink / raw)
  To: guix-devel

* 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 <ludo@gnu.org>
 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016 Tomáš Čech <sleep_walker@gnu.org>
 ;;;
 ;;; 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-09  9:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03  8:53 [PATCH] gnu: bash-completion: Update to 2.3 Tomáš Čech
2016-08-05 18:53 ` Andreas Enge
2016-08-07  3:06   ` Leo Famulari
2016-08-07  8:06     ` Tomáš Čech
2016-08-07 10:07       ` [PATCHv2 1/2] gnu: bash-completion: Modify to modify-phases Tomáš Čech
2016-08-07 10:07         ` [PATCHv2 2/2] gnu: bash-completion: Update to 2.3. Update the patch Tomáš Čech
2016-08-08 21:14           ` Leo Famulari
2016-08-09  9:05             ` Tomáš Čech
2016-08-08 21:10         ` [PATCHv2 1/2] gnu: bash-completion: Modify to modify-phases Leo Famulari

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).