[pacman-dev] pacman shell scripts and bash3.2 compat - Was: [PATCH 04/11] makepkg: less code duplication in create_package
On Sun, Jun 20, 2010 at 6:09 AM, Allan McRae <allan@archlinux.org> wrote:
That is a bash4 command so will break cygwin compatibility (which currently has bash-3.2). Resubmit with something like "tr [:lower:] [:upper:]" usage.
(I know the ${i^^} is used elsewhere, but that slipped passed my notice and will be being reverted.
bash_completion also has bash 4 only items... Please write a style guide for all shell scripts.... Andres P
On 21/06/10 03:21, Andres P wrote:
On Sun, Jun 20, 2010 at 6:09 AM, Allan McRae<allan@archlinux.org> wrote:
That is a bash4 command so will break cygwin compatibility (which currently has bash-3.2). Resubmit with something like "tr [:lower:] [:upper:]" usage.
(I know the ${i^^} is used elsewhere, but that slipped passed my notice and will be being reverted.
bash_completion also has bash 4 only items...
Can you point them out?
Please write a style guide for all shell scripts....
Yes, _someone_ should... I have put it low down on my ever growing TODO list. Allan
To avoid errors with bash 3.2, compopt will be skipped if it's not a shell builtin. compopt is needed to not append slashes to package names that coincide with directories in PWD. This is currently not possible to fix in bash versions that do not support compopt, so these users will have to bear that regression. Signed-off-by: Andres P <aepd87@gmail.com> --- contrib/bash_completion | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/contrib/bash_completion b/contrib/bash_completion index 2713ba4..1ec2cd5 100644 --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -52,10 +52,6 @@ _pacman_pkg() { )" } -_pacman_file() { - compopt -o filenames; _filedir 'pkg.tar.*' -} - _pacman() { local common core cur database prev query remove sync upgrade o COMPREPLY=() @@ -102,7 +98,18 @@ _pacman() { true } +if [[ $(type -t compopt) = "builtin" ]]; then + _pacman_file() { + compopt -o filenames; _filedir 'pkg.tar.*' + } + complete -F _pacman -o default pacman +else + _pacman_file() { + _filedir 'pkg.tar.*' + } + complete -F _pacman -o filenames -o default pacman +fi + complete -F _makepkg -o default makepkg -complete -F _pacman -o default pacman # ex:et ts=2 sw=2 ft=sh -- If you are testing this, do it with a clean enviro please: $ env -i HOME="$HOME" TERM="$TERM" bash3 --rcfile "/etc/bash_completion" -i 1.7.1
On 22/06/10 12:30, Andres P wrote:
To avoid errors with bash 3.2, compopt will be skipped if it's not a shell builtin.
compopt is needed to not append slashes to package names that coincide with directories in PWD.
This is currently not possible to fix in bash versions that do not support compopt, so these users will have to bear that regression.
Signed-off-by: Andres P<aepd87@gmail.com>
Signed-off-by: Allan On my working-maint branch.
participants (2)
-
Allan McRae
-
Andres P