Split shell-completions into a separate subpackage

and define %_description variable to make specfile DRYer.

Fedora normally doesn't split out shell completions, but this avoids
pulling in an extra dependency on python3-argcomplete.
This commit is contained in:
Maxwell G 2022-10-26 22:41:30 -05:00
parent c6c4a5a0c5
commit 6363610e58
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8

View File

@ -68,6 +68,7 @@ BuildRequires: python%{python3_pkgversion}-devel
# Needed to build manpages from source. # Needed to build manpages from source.
BuildRequires: python%{python3_pkgversion}-straight-plugin BuildRequires: python%{python3_pkgversion}-straight-plugin
BuildRequires: python%{python3_pkgversion}-docutils BuildRequires: python%{python3_pkgversion}-docutils
# Shell completions
BuildRequires: python%{python3_pkgversion}-argcomplete BuildRequires: python%{python3_pkgversion}-argcomplete
%if %{with tests} %if %{with tests}
@ -76,18 +77,20 @@ BuildRequires: glibc-all-langpacks
BuildRequires: python%{python3_pkgversion}-systemd BuildRequires: python%{python3_pkgversion}-systemd
%endif %endif
Requires: python%{python3_pkgversion}-argcomplete
# Require packaging macros if rpm-build exists # Require packaging macros if rpm-build exists
# This makes the transition seamless for other packages # This makes the transition seamless for other packages
Requires: (ansible-packaging if rpm-build) Requires: (ansible-packaging if rpm-build)
Recommends: ansible-core-shell-completions
%description %global _description %{expand:
Ansible is a radically simple model-driven configuration management, Ansible is a radically simple model-driven configuration management,
multi-node deployment, and remote task execution system. Ansible works multi-node deployment, and remote task execution system. Ansible works
over SSH and does not require any software or daemons to be installed over SSH and does not require any software or daemons to be installed
on remote nodes. Extension modules can be written in any language and on remote nodes. Extension modules can be written in any language and
are transferred to managed machines automatically. are transferred to managed machines automatically.}
%description %_description
This is the base part of ansible (the engine). This is the base part of ansible (the engine).
@ -106,6 +109,16 @@ are transferred to managed machines automatically.
This package installs extensive documentation for ansible-core This package installs extensive documentation for ansible-core
%package shell-completions
Summary: Shell completions for ansible-core
Requires: python%{python3_pkgversion}-argcomplete
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description shell-completions %_description
This package includes shell completions files for ansible-core.
%prep %prep
%autosetup -p1 -n ansible-%{version} %autosetup -p1 -n ansible-%{version}
find \( -name '.git_keep' -o -name '.rstcheck.cfg' \) -delete find \( -name '.git_keep' -o -name '.rstcheck.cfg' \) -delete
@ -159,8 +172,8 @@ make PYTHON=%{python3} docs
%install %install
%pyproject_install %pyproject_install
install -Dpm 0644 bash_completions/* -t %{buildroot}%{_datadir}/bash-completion/completions install -Dpm 0644 bash_completions/* -t %{buildroot}%{bash_completions_dir}
install -Dpm 0644 fish_completions/* -t %{buildroot}%{_datadir}/fish/vendor_completions.d install -Dpm 0644 fish_completions/* -t %{buildroot}%{fish_completions_dir}
# Create system directories that Ansible defines as default locations in # Create system directories that Ansible defines as default locations in
# ansible/config/base.yml # ansible/config/base.yml
@ -220,16 +233,12 @@ make PYTHON=%{python3} tests-py3
%doc README.rst changelogs/CHANGELOG-v2.13.rst %doc README.rst changelogs/CHANGELOG-v2.13.rst
%dir %{_sysconfdir}/ansible/ %dir %{_sysconfdir}/ansible/
%config(noreplace) %{_sysconfdir}/ansible/* %config(noreplace) %{_sysconfdir}/ansible/*
%{_mandir}/man1/ansible*
%{_bindir}/ansible* %{_bindir}/ansible*
%{_datadir}/ansible/ %{_datadir}/ansible/
%{_datadir}/bash-completion/completions/ansible*
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/ansible*.fish
%{python3_sitelib}/ansible %{python3_sitelib}/ansible
%{python3_sitelib}/ansible_test %{python3_sitelib}/ansible_test
%{python3_sitelib}/*dist-info %{python3_sitelib}/*dist-info
%{_mandir}/man1/ansible*
%files -n ansible-core-doc %files -n ansible-core-doc
%doc docs/docsite/rst %doc docs/docsite/rst
@ -237,6 +246,11 @@ make PYTHON=%{python3} tests-py3
%doc docs/docsite/_build/html %doc docs/docsite/_build/html
%endif %endif
%files shell-completions
%{bash_completions_dir}/ansible*
%{fish_completions_dir}/ansible*.fish
%changelog %changelog
* Wed Oct 12 2022 Maxwell G <gotmax@e.email> - 2.13.5-1 * Wed Oct 12 2022 Maxwell G <gotmax@e.email> - 2.13.5-1
- Update to 2.13.5. - Update to 2.13.5.