use %bash_completions_dir

A %bash_completions_dir macros was added to redhat-rpm-config recently¹.
It is available for all supported Fedora releases.  Define it if
missing, to support EL <= 9.

This is likely to become part of the packaging guideline soon².

¹ https://src.fedoraproject.org/rpms/redhat-rpm-config/c/483a3b (Add
  macros.shell-completions, 2022-06-25)
² https://pagure.io/packaging-committee/issue/1202
This commit is contained in:
Todd Zullinger 2022-11-12 13:14:22 -05:00
parent ef75bcdbad
commit d0191b8ca5
2 changed files with 14 additions and 10 deletions

View File

@ -5,6 +5,9 @@ addFilter("git-subtree.* spelling-error %description .* (subdirectory|subproject
# git-core-doc requires git-core, which provides the symlink target
addFilter("git(-core-doc)?\..*: W: dangling-relative-symlink /usr/share/doc/git/contrib/hooks ../../../git-core/contrib/hooks")
# gitk requires git, which provides the symlink target
addFilter("gitk\.noarch: W: dangling-relative-symlink /usr/share/bash-completion/completions/gitk git")
# git-gui requires git, which provides the git binary
addFilter("git-gui.noarch: W: desktopfile-without-binary /usr/share/applications/git-gui.desktop git")

View File

@ -39,12 +39,6 @@
%global use_perl_interpreter 0
%endif
# Settings for Fedora and EL >= 7
%if 0%{?fedora} || 0%{?rhel} >= 7
%global bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null)
%global bashcomproot %(dirname %{bashcompdir} 2>/dev/null)
%endif
# Allow cvs subpackage to be toggled via --with/--without
# Disable cvs subpackage by default on EL >= 8
%if 0%{?rhel} >= 8
@ -69,6 +63,9 @@
%global _hardened_build 1
%endif
# Define %%bash_completions_dir for EL <= 9
%{?!bash_completions_dir:%global bash_completions_dir %{_datadir}/bash-completion/completions}
# Define for release candidates
#global rcrev .rc0
@ -77,7 +74,7 @@
Name: git
Version: 2.38.1
Release: 2%{?rcrev}%{?dist}
Release: 3%{?rcrev}%{?dist}
Summary: Fast Version Control System
License: BSD-3-Clause AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT
URL: https://git-scm.com/
@ -700,8 +697,8 @@ perl -p \
%{SOURCE15} > %{buildroot}%{_unitdir}/git@.service
# Setup bash completion
install -Dpm 644 contrib/completion/git-completion.bash %{buildroot}%{bashcompdir}/git
ln -s git %{buildroot}%{bashcompdir}/gitk
install -Dpm 644 contrib/completion/git-completion.bash %{buildroot}%{bash_completions_dir}/git
ln -s git %{buildroot}%{bash_completions_dir}/gitk
# Install tcsh completion
mkdir -p %{buildroot}%{_datadir}/git-core/contrib/completion
@ -905,7 +902,7 @@ rmdir --ignore-fail-on-non-empty "$testdir"
%exclude %{_datadir}/git-core/templates/hooks/fsmonitor-watchman.sample
%exclude %{_datadir}/git-core/templates/hooks/pre-rebase.sample
%exclude %{_datadir}/git-core/templates/hooks/prepare-commit-msg.sample
%{bashcomproot}
%{bash_completions_dir}/git
%{_datadir}/git-core/
%files core-doc -f man-doc-files-core
@ -951,6 +948,7 @@ rmdir --ignore-fail-on-non-empty "$testdir"
%{_pkgdocdir}/*gitk*.txt
%{_bindir}/*gitk*
%{_datadir}/gitk
%{bash_completions_dir}/gitk
%{?with_docs:%{_mandir}/man1/*gitk*.1*}
%{?with_docs:%{_pkgdocdir}/*gitk*.html}
@ -1010,6 +1008,9 @@ rmdir --ignore-fail-on-non-empty "$testdir"
%{?with_docs:%{_pkgdocdir}/git-svn.html}
%changelog
* Sat Nov 12 2022 Todd Zullinger <tmz@pobox.com> - 2.38.1-3
- use %%bash_completions_dir
* Mon Nov 07 2022 Todd Zullinger <tmz@pobox.com> - 2.38.1-2
- don't ship contrib/persistent-https as documentation
- update license data and convert to SPDX format