diff mbox

gnu: bash-completion: Update to 2.3.

Message ID 20160803085311.24325-1-sleep_walker@gnu.org
State New
Headers show

Commit Message

Tomáš Čech Aug. 3, 2016, 8:53 a.m. UTC
* 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(-)

Comments

Andreas Enge Aug. 5, 2016, 6:53 p.m. UTC | #1
Hello,

On Wed, Aug 03, 2016 at 10:53:11AM +0200, Tomáš Čech wrote:
> * 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.

just the quick standard comment: Please do the switch from alist-...
to modify-phases in a separate first commit; it makes it easier to see
the real diff of your real commit.

The autoreconf phase is strange. Why is it suddenly needed? If there is no
way around it, you should at least add a comment.

Andreas
Leo Famulari Aug. 7, 2016, 3:06 a.m. UTC | #2
On Fri, Aug 05, 2016 at 08:53:46PM +0200, Andreas Enge wrote:
> The autoreconf phase is strange. Why is it suddenly needed? If there is no
> way around it, you should at least add a comment.

I notice that when projects move to GitHub, they sometimes forget to cut
a new release. GitHub automatically generates a tarball of the source
tree for each tag, and those are not bootstrapped. That's probably what
happened here, and it's worth an upstream bug report, IMO.
Tomáš Čech Aug. 7, 2016, 8:06 a.m. UTC | #3
On Sat, Aug 06, 2016 at 11:06:05PM -0400, Leo Famulari wrote:
>On Fri, Aug 05, 2016 at 08:53:46PM +0200, Andreas Enge wrote:
>> The autoreconf phase is strange. Why is it suddenly needed? If there is no
>> way around it, you should at least add a comment.
>
>I notice that when projects move to GitHub, they sometimes forget to cut
>a new release. GitHub automatically generates a tarball of the source
>tree for each tag, and those are not bootstrapped. That's probably what
>happened here, and it's worth an upstream bug report, IMO.
>

Reported here:

  https://github.com/scop/bash-completion/issues/64

Thanks for review.

S_W
diff mbox

Patch

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 )