On Mon, Jan 09, 2012 at 03:57:42AM -0600, Jonathan Nieder wrote:
> David Paleino wrote:
> > Bash maintainers: the new bash-completion location is
> > at /usr/share/bash-completion/bash_completion . Please update the files of 
> > your
> > package (bash.bashrc, but there may be others) to reflect the new location. 
> > TIA!
> 
> How about this patch (untested)?
> 
>  debian/README.bash_completion |    6 ++++--
>  debian/changelog              |    9 +++++++++
>  debian/control                |    2 +-
>  debian/etc.bash.bashrc        |    4 ++--
>  debian/skel.bashrc            |    4 ++--
>  5 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/debian/README.bash_completion b/debian/README.bash_completion
> index e0a8e758..4580ebfb 100644
> --- a/debian/README.bash_completion
> +++ b/debian/README.bash_completion
> @@ -12,6 +12,8 @@
>  ]
>  
>  To enable programmable completion for bash on Debian, uncomment the
> -bash_completion lines in /etc/bash.bashrc to source /etc/bash_completion.
> -/etc/bash_completion sources ~/.bash_completion, if it exists.
> +bash_completion lines in /etc/bash.bashrc to source
> +/usr/share/bash-completion/bash_completion.
> +/usr/share/bash-completion/bash_completion sources ~/.bash_completion, if
> +it exists.

Not necessary anymore, as far as I can tell.  bash-completion ships an
/etc/profile.d/bash_completion.sh which enables programmable completion.
Also, that same file sources $XDG_CONFIG_HOME/bash_completion, typically
~/.config/bash_completion.

> --- a/debian/control
> +++ b/debian/control
> @@ -16,7 +16,7 @@ Architecture: any
>  Pre-Depends: dash (>= 0.5.5.1-2.2), ${shlibs:Pre-Depends}, ${misc:Depends}
>  Depends: base-files (>= 2.1.12), debianutils (>= 2.15)
>  Recommends: bash-completion (>= 20060301-0)
> -Conflicts: bash-completion (<< 20060301-0)
> +Breaks: bash-completion (<< 1:1.3-2)

Rather than the Breaks, how about checking both locations?

If you decide not to go that route, then you should also update the
version in the Recommends.

> --- a/debian/skel.bashrc
> +++ b/debian/skel.bashrc
> @@ -94,6 +94,6 @@ fi
>  # enable programmable completion features (you don't need to enable
>  # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
>  # sources /etc/bash.bashrc).
> -if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
> -    . /etc/bash_completion
> +if [ -f /usr/share/bash-completion/bash_completion ] && ! shopt -oq posix; 
> then
> +    . /usr/share/bash-completion/bash_completion
>  fi

For the benefit of users who might copy their .bashrc to other systems,
check it into git, or otherwise do crazy things with it, consider
changing this to handle both locations.  Mine looks like this, though I
don't include the test for posix:

if [ -z "$BASH_COMPLETION_COMPAT_DIR" ] && [ -z "$BASH_COMPLETION" ]; then
    if [ -f /usr/share/bash-completion/bash_completion ]; then
        . /usr/share/bash-completion/bash_completion
    elif [ -f /etc/bash_completion ]; then
        . /etc/bash_completion
    fi
fi

You could add the test for posix at the beginning of the top-level if
needed.

- Josh Triplett



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to