git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] RPM spec: include bash completion support

From
Ian Ward Comfort <icomfort@stanford.edu>
Date
Mar 26, 2010, 08:39 UTC
Message-ID
<1269592797-18487-1-git-send-email-icomfort@stanford.edu>
In-Reply-To
<1269569690-sup-4884@pinkfloyd.chass.utoronto.ca>

Include the bash completion routines from the contrib/ directory in our core RPM, in the de facto standard location.

Signed-off-by: Ian Ward Comfort <icomfort@stanford.edu>
---
On 25 Mar 2010, at 7:19 PM, Ben Walton wrote:
Show 13 quoted lines
> Excerpts from Junio C Hamano's message of Wed Mar 24 20:41:16 -0400 2010:
> 
> > * bw/git-completion-rpmspec (2010-03-20) 1 commit
> > - Add a git-completion rpm subpackage to the spec
> > 
> > Shipping bash-completion as part of RPM package; since Todd Zullinger who
> > packages git for Fedora joined the thread, I am hoping that I can defer
> > the direction of the final version to the discussion between Todd and Ben.
> 
> I think Todd made a good case for making this part of the core git rpm.
> Ian's patch would be more suited for inclusion in this case. The remaining
> question is whether to stick it in /etc/bash_completion.d or in
> /usr/share/bash_completion.d (the triggers vs direct bit).
/usr/share/bash-completion was the alternative, I believe.
> The closer the core spec file is to the one that distro's use, the better.
> This is a reciprocal benefit, I think.

I agree. After more diligent research (following Todd's tip about the new upstream), I gather that bash completion works as follows on all of Fedora, EPEL, Mandriva and Gentoo. The bash-completion package itself:

* Installs a (mostly-)empty /etc/bash_completion.d directory.
* Installs numerous completion modules into /usr/share/bash-completion.
* Defines %triggers for other packages, to symlink its own completion modules
  for their binaries from /usr/share/bash-completion to /etc/bash_completion.d
  when those packages are installed.
* Induces interactive shells (via one mechanism or another) to source the
  contents of /etc/bash_completion.d.

Debian (FWIW) currently installs all completion modules directly into /etc/bash_completion.d. A promising thread from January 2009 on the upstream mailing list seemed poised to unify all these distros' treatment, but stalled after a dozen messages [1].

Unfortunately, nothing in the above clarifies how other packages are expected to ship their own completion support. Currently, however, the Git packages (and what other packages I've found with completions) in all these distros -- with the possible exception of Gentoo, which I haven't been able to verify -- install completions directly into /etc/bash_completion.d. This seems natural, given that the symlink mechanism's current function is to have completions for all and only installed packages in /etc/bash_completion.d.

I also think Todd's argument is sound, and propose that we ship bash completions in the core package in /etc/bash_completion.d/git. I don't see any reason to provide a "--without completion" option, since downstream packagers will continue to either patch or replace our spec if it doesn't meet their needs.

[1] http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-January/000670.html
-- 
Ian Ward Comfort <icomfort@stanford.edu>
Systems Team Lead, Academic Computing Services, Stanford University

 git.spec.in |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/git.spec.in b/git.spec.in
index ee74a5e..9533147 100644
--- a/git.spec.in
+++ b/git.spec.in
@@ -127,6 +127,9 @@ find $RPM_BUILD_ROOT -type f -name perllocal.pod -exec rm -f {} ';'
 rm -rf $RPM_BUILD_ROOT%{_mandir}
 %endif
 
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
+install -m 644 -T contrib/completion/git-completion.bash $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/git
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -136,6 +139,7 @@ rm -rf $RPM_BUILD_ROOT
 %doc README COPYING Documentation/*.txt
 %{!?_without_docs: %doc Documentation/*.html Documentation/howto}
 %{!?_without_docs: %doc Documentation/technical}
+%{_sysconfdir}/bash_completion.d
 
 %files svn
 %defattr(-,root,root)
@@ -192,6 +196,9 @@ rm -rf $RPM_BUILD_ROOT
 # No files for you!
 
 %changelog
+* Fri Mar 26 2010 Ian Ward Comfort <icomfort@stanford.edu>
+- Ship bash completion support from contrib/ in the core package.
+
 * Sun Jan 31 2010 Junio C Hamano <gitster@pobox.com>
 - Do not use %define inside %{!?...} construct.
 
-- 
1.7.0.2
Previous: Ben WaltonNext: Ben Walton
Message 10 of 13 in “What's cooking in git.git (Mar 2010, #06; Wed, 24)”
  1. Junio C HamanoMar 25, 2010
  2. Nguyen Thai Ngoc DuyMar 25, 2010
  3. Brandon CaseyMar 25, 2010
  4. Alex RiesenMar 25, 2010
  5. 1/2 Allow passing of configuration parameters in the command lineAlex Riesen, Mar 26, 2010
  6. 2/2 Use strbufs instead of open-coded string manipulationAlex Riesen, Mar 26, 2010
  7. Nguyen Thai Ngoc DuyMar 26, 2010
  8. Nguyen Thai Ngoc DuyMar 25, 2010
  9. Ben WaltonMar 26, 2010
  10. RPM spec: include bash completion supportIan Ward Comfort, Mar 26, 2010
  11. Ben WaltonMar 26, 2010
  12. Junio C HamanoMar 29, 2010
  13. Julian PhillipsMar 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.