[PATCH] RPM spec: include bash completion support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---

On 25 Mar 2010, at 7:19 PM, Ben Walton wrote:
> 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@xxxxxxxxxxxx>
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@xxxxxxxxxxxx>
+- Ship bash completion support from contrib/ in the core package.
+
 * Sun Jan 31 2010 Junio C Hamano <gitster@xxxxxxxxx>
 - Do not use %define inside %{!?...} construct.
 
-- 
1.7.0.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]