Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 469858 - bash-completion-r1.eclass - add function to retrieve bashcompletion dir
Summary: bash-completion-r1.eclass - add function to retrieve bashcompletion dir
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL: http://thread.gmane.org/gmane.linux.g...
Whiteboard:
Keywords:
Depends on:
Blocks: 469892
  Show dependency tree
 
Reported: 2013-05-14 16:45 UTC by Alexander Tsoy
Modified: 2013-06-13 16:24 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Tsoy 2013-05-14 16:45:08 UTC
How about adding a function to retrieve bashcompletion dir?

The default completion dir for >=bash-completion-2 is "/usr/share/bash-completion/completions" (version bump request in bug 395091), which is used by default by many apps now. Several ebuilds currently change this path to hardcoded "/usr/share/bash-completion", and many ebuilds simply do something like this:

rm -rf "${ED}"/usr/share/bash-completion
dobashcomp path/to/bashcomp


Some examples:

1. http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/systemd/systemd-201.ebuild?r1=1.16&r2=1.17

2. gnome-base/gnome-control-center:
 	sed -i 's|^completiondir =.*|completiondir = $(datadir)/bash-completion|' \
 	shell/Makefile.am || die "sed completiondir failed"
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-05-14 20:00:23 UTC
AFAIU ulm is against introducing such a function.
Comment 2 Ulrich Müller gentoo-dev 2013-05-14 20:28:12 UTC
Well, I simply don't understand the rationale for it. Why would we need a function for something that's unlikely to ever change?
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-05-14 20:39:35 UTC
(In reply to comment #2)
> Well, I simply don't understand the rationale for it. Why would we need a
> function for something that's unlikely to ever change?

Well, one reason is that the 'ever' we're talking about is coming up in big steps. Not that I think it's the best solution but possibly one allowing us to switch while controlling it.
Comment 4 Alexander Tsoy 2013-05-14 20:48:30 UTC
Yes. How an upgrade to bash-completion-2* will be handled?
Comment 5 Alexander Tsoy 2013-05-14 22:43:11 UTC
(In reply to comment #0)
> The default completion dir for >=bash-completion-2 is
> "/usr/share/bash-completion/completions"

Hmm.. It seems this dir is also default for bash-completion-1*, but ebuilds completely ignoring build system and install everything using doins().
Comment 6 Alexander Tsoy 2013-05-15 10:28:14 UTC
Please ignore my previous comment. Just checked RHEL5, RHEL6 and Debian 6.

RHEL 5/6: completions installed in /usr/share/bash-completion, bash-completion version 1.3
Debian 6: completions installed in /etc/bash_completion.d/, bash-completion version 1.2

But all modern distros now uses bash-completion-2 and installs completions in /usr/share/bash-completion/completions (Fedora, Debian 7, etc).
Comment 7 Ulrich Müller gentoo-dev 2013-05-15 11:03:43 UTC
I still don't understand how this is related to bash-completion version 1 or 2, but maybe someone can explain to me what I am missing here?

Currently, bash-completion looks for completion scripts in /etc/bash_completion.d (system) and ${HOME}/.bash_completion.d (user). The only tool that looks for the scripts in /usr/share/bash-completion is the bashcomp eselect module, which creates symlinks in the bash_completion.d dir for the ones that the user enables.
Comment 8 Alexander Tsoy 2013-05-15 14:15:14 UTC
AFAIK bash-completion-2 loads all comletion modules dynamically from files /usr/share/bash-completion/completions/${command_name} and bashcomp eselect module is not needed.
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-06-13 16:24:20 UTC
I've committed the initial get_bashcompdir() as discussed on the ml.