Commit d156aad9 authored by Xuetian Weng's avatar Xuetian Weng
Browse files

update to compatible with bash 4.3

parent 13885702
# Maintainer: abveritas@chakra-project.org>
pkgname=bash-completion
pkgver=2.0
pkgver=2.1
pkgrel=2
pkgdesc="Programmable completion for the bash shell"
arch=('any')
url="http://bash-completion.alioth.debian.org/"
license=('GPL')
depends=('bash')
source=("http://bash-completion.alioth.debian.org/files/${pkgname}-${pkgver}.tar.bz2")
md5sums=('0d903f398be8c8f24bc5ffa6f86127f8')
sha1sums=('3011add35574b4042c04b95fc0fd0f14006adc69')
options=('!emptydirs' '!makeflags')
#http://bash-completion.alioth.debian.org/files/${pkgname}-${pkgver}.tar.bz2
source=('http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=snapshot;h=867282a7341ccfff9a0e8a8ef6bba6e781b66afb;sf=tgz'
bash-4.3.patch bash-completion-lz4.patch words_bad_array_subscript.patch)
sha1sums=('153a8d056d0f5cdc22477ebfa13c1a461ff95556'
'd2a01350990c1221bd53d55edf31210c74d02bca'
'a8cdbadacdce845ec69575e1046c197d54e64074'
'ae1d9a334e4908464b339f929dd5874c2af11bd2')
prepare() {
rm -rf ${pkgname}-${pkgver}
mv ${pkgname}-867282a ${pkgname}-${pkgver}
cd ${pkgname}-${pkgver}
patch -p1 -i ../bash-4.3.patch
patch -p0 -i ../bash-completion-lz4.patch
patch -p1 -i ../words_bad_array_subscript.patch
autoreconf --install
}
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
cd ${pkgname}-${pkgver}
# this should be removed once /lib is a symlink to usr/lib
sed -i '/lib\/modules/ s,/lib/modules,/usr&,' bash_completion
......@@ -23,14 +38,12 @@ build() {
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
cd ${pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
# bash-completion is sourced in /etc/bash.bashrc so that non-bash shell don't source it
rm -r "${pkgdir}/etc/profile.d"
# remove Slackware's makepkg completion
# bash-completion is sourced in /etc/bash.bashrc so that non-bash shell don't source it
rm "${pkgdir}/etc/profile.d/bash_completion.sh"
# remove Slackware's makepkg completion
rm "${pkgdir}/usr/share/bash-completion/completions/makepkg"
# part of systemd
rm "${pkgdir}/usr/share/bash-completion/completions/udevadm"
}
--- a/bash_completion 2014-03-09 17:38:14 +0000
+++ b/bash_completion 2014-03-13 23:26:44 +0000
@@ -536,13 +536,23 @@
# @param $2 Name of variable to return result to
_quote_readline_by_ref()
{
- if [[ $1 == \'* ]]; then
+ if [ -z "$1" ]; then
+ # avoid quoting if empty
+ printf -v $2 %s "$1"
+ elif [[ $1 == \'* ]]; then
# Leave out first character
printf -v $2 %s "${1:1}"
+ elif [[ $1 == ~* ]]; then
+ # avoid escaping first ~
+ printf -v $2 ~%q "${1:1}"
else
printf -v $2 %q "$1"
fi
+ # Replace double escaping ( \\ ) by single ( \ )
+ # This happens always when argument is already escaped at cmdline,
+ # and passed to this function as e.g.: file\ with\ spaces
+ [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"
# If result becomes quoted like this: $'string', re-evaluate in order to
# drop the additional quoting. See also: http://www.mail-archive.com/
# bash-completion-devel@lists.alioth.debian.org/msg01942.html
--- completions/Makefile.am.orig 2014-03-20 19:31:07.341541256 -0400
+++ completions/Makefile.am 2014-03-20 19:31:33.357950340 -0400
@@ -195,6 +195,7 @@
luseradd \
luserdel \
lvm \
+ lz4 \
lzip \
lzma \
lzop \
diff --git a/bash_completion b/bash_completion
index 66d36b1..ce469d0 100644
--- a/bash_completion
+++ b/bash_completion
@@ -707,7 +707,7 @@ _init_completion()
fi
done
- [[ $cword -eq 0 ]] && return 1
+ [[ $cword -le 0 ]] && return 1
prev=${words[cword-1]}
[[ ${split-} ]] && _split_longopt && split=true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment