Add patch to use correct shell completion locations

This commit is contained in:
Carl George 2020-09-29 16:01:45 -05:00
parent 5634de1b69
commit a39bb08ec6
2 changed files with 91 additions and 14 deletions

View File

@ -0,0 +1,86 @@
From 1669e26ccb74aacbcdfd7100a8e24e3faa31dde4 Mon Sep 17 00:00:00 2001
From: Carl George <carl@george.computer>
Date: Tue, 29 Sep 2020 13:13:04 -0500
Subject: [PATCH] Install shell completion files to correct locations
Bash completion files should be installed to
/usr/share/bash-completion/completions, with a file name matching the
command name. Zsh completion files should be installed to
/usr/share/zsh/site-functions, with a file name matching the command
name prefixed with an underscore.
Resolves #271
https://github.com/scop/bash-completion/blob/master/README.md#faq
http://zsh.sourceforge.net/Doc/Release/Completion-System.html
---
Makefile.am | 6 +++---
ag.bashcomp.sh => completions/bash/ag | 0
_the_silver_searcher => completions/zsh/_ag | 0
the_silver_searcher.spec.in | 11 +++--------
4 files changed, 6 insertions(+), 11 deletions(-)
rename ag.bashcomp.sh => completions/bash/ag (100%)
rename _the_silver_searcher => completions/zsh/_ag (100%)
diff --git a/Makefile.am b/Makefile.am
index 3931c3a..280b169 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,10 +6,10 @@ ag_LDADD = ${PCRE_LIBS} ${LZMA_LIBS} ${ZLIB_LIBS} $(PTHREAD_LIBS)
dist_man_MANS = doc/ag.1
-bashcompdir = $(pkgdatadir)/completions
-dist_bashcomp_DATA = ag.bashcomp.sh
+bashcompdir = $(datadir)/bash-completion/completions
+dist_bashcomp_DATA = completions/bash/ag
zshcompdir = $(datadir)/zsh/site-functions
-dist_zshcomp_DATA = _the_silver_searcher
+dist_zshcomp_DATA = completions/zsh/_ag
EXTRA_DIST = Makefile.w32 LICENSE NOTICE the_silver_searcher.spec README.md
diff --git a/ag.bashcomp.sh b/completions/bash/ag
similarity index 100%
rename from ag.bashcomp.sh
rename to completions/bash/ag
diff --git a/_the_silver_searcher b/completions/zsh/_ag
similarity index 100%
rename from _the_silver_searcher
rename to completions/zsh/_ag
diff --git a/the_silver_searcher.spec.in b/the_silver_searcher.spec.in
index 445bdec..9239179 100644
--- a/the_silver_searcher.spec.in
+++ b/the_silver_searcher.spec.in
@@ -1,6 +1,3 @@
-%define _bashcompdir %_sysconfdir/bash_completion.d
-%define _zshcompdir %{_datadir}/zsh/site-functions
-
Name: the_silver_searcher
Version: @VERSION@
Release: 1%{?dist}
@@ -49,8 +46,6 @@ make %{?_smp_mflags}
%install
rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=${RPM_BUILD_ROOT}
-mkdir -p ${RPM_BUILD_ROOT}%{_bashcompdir}
-install -m 644 ag.bashcomp.sh ${RPM_BUILD_ROOT}%{_bashcompdir}
%clean
rm -rf ${RPM_BUILD_ROOT}
@@ -60,9 +55,9 @@ rm -rf ${RPM_BUILD_ROOT}
%defattr(-,root,root,-)
%{_bindir}/*
%{_mandir}/*
-%config %{_bashcompdir}/ag.bashcomp.sh
-%config %{_datadir}/%{name}/completions/ag.bashcomp.sh
-%config %{_datadir}/zsh/site-functions/_the_silver_searcher
+%{_datadir}/bash-completion/completions/ag
+%{_datadir}/zsh/site-functions/_ag
+
%changelog
* Thu Dec 5 2013 Emily Strickland <code@emily.st> - 0.18.1-1
--
2.26.2

View File

@ -3,11 +3,6 @@
%global date 2020704
%forgemeta
%global bashcompdir %(pkg-config --variable=completionsdir bash-completion)
%if "%{bashcompdir}" == ""
%define bashcompdir "/etc/bash_completion.d"
%endif
Name: the_silver_searcher
Version: 2.2.0
Release: 3%{?dist}
@ -15,14 +10,13 @@ Summary: Super-fast text searching tool (ag)
License: ASL 2.0 and BSD
URL: %{forgeurl}
Source0: %{forgesource}
# https://github.com/ggreer/the_silver_searcher/pull/1410
Patch0: 0001-Install-shell-completion-files-to-correct-locations.patch
BuildRequires: gcc
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: pcre-devel
%if ! 0%{?el6}
BuildRequires: pkgconfig(bash-completion)
%endif
BuildRequires: xz-devel
BuildRequires: zlib-devel
@ -46,9 +40,6 @@ automake --add-missing
%install
%make_install
mkdir -p $RPM_BUILD_ROOT%{bashcompdir}
install -pm 0644 ag.bashcomp.sh $RPM_BUILD_ROOT%{bashcompdir}/ag
rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}
%files
@ -56,14 +47,14 @@ rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}
%doc README.md
%{_bindir}/ag
%{_mandir}/man1/ag.1*
%(dirname %{bashcompdir})
# zsh completion
%{_datadir}/zsh/site-functions/_%{name}
%{_datadir}/bash-completion/completions/ag
%{_datadir}/zsh/site-functions/_ag
%changelog
* Tue Sep 29 2020 Carl George <carl@george.computer> - 2.2.0-3.2020704git5a1c8d8
- Update to latest upstream commit
- Add patch to use correct shell completion locations
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild