Generate shell completions and other misc. improvements
This commit is contained in:
parent
940fba3cc1
commit
ebf8e71a77
@ -22,7 +22,7 @@ License: GPLv3+ and BSD and Python and MIT and ASL 2.0
|
||||
Source: https://github.com/ansible/ansible/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
# A 2.10.3 async test uses /usr/bin/python, which we do not have by default.
|
||||
# Patch the test to use /usr/bin/python3 as we have for our build.
|
||||
Patch: 2.10.3-test-patch.patch
|
||||
Patch: 2.10.3-test-patch.patch
|
||||
# Stop using a deprecated cryptography method that is no longer available in F37.
|
||||
Patch: https://github.com/ansible/ansible/pull/77834.patch#/avoid-deprecated-method-unit-tests.patch
|
||||
# These patches remove the requirement on python3-mock which is deprecated in Fedora.
|
||||
@ -71,16 +71,17 @@ Conflicts: ansible <= 2.9.99
|
||||
Provides: ansible-base = %{version}-%{release}
|
||||
Obsoletes: ansible-base < 2.10.6-1
|
||||
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
BuildRequires: make
|
||||
# Needed to build manpages from source.
|
||||
BuildRequires: python3-straight-plugin
|
||||
BuildRequires: python3-docutils
|
||||
BuildRequires: python%{python3_pkgversion}-straight-plugin
|
||||
BuildRequires: python%{python3_pkgversion}-docutils
|
||||
BuildRequires: python%{python3_pkgversion}-argcomplete
|
||||
|
||||
%if %{with tests}
|
||||
BuildRequires: git-core
|
||||
BuildRequires: glibc-all-langpacks
|
||||
BuildRequires: python3-systemd
|
||||
BuildRequires: python%{python3_pkgversion}-systemd
|
||||
%endif
|
||||
|
||||
# Require packaging macros if rpm-build exists
|
||||
@ -88,8 +89,8 @@ BuildRequires: python3-systemd
|
||||
Requires: (ansible-packaging if rpm-build)
|
||||
|
||||
# RHEL8 doesn't have python3-paramiko or python3-winrm (yet), but Fedora does
|
||||
Recommends: python3-paramiko
|
||||
Recommends: python3-winrm
|
||||
Recommends: python%{python3_pkgversion}-paramiko
|
||||
Recommends: python%{python3_pkgversion}-winrm
|
||||
|
||||
%description
|
||||
Ansible is a radically simple model-driven configuration management,
|
||||
@ -117,7 +118,8 @@ This package installs extensive documentation for ansible-core
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
sed -i -s 's|/usr/bin/env python|%{__python3}|' test/lib/ansible_test/_util/target/cli/ansible_test_cli_stub.py bin/*
|
||||
find -name '.git_keep' -delete
|
||||
sed -i -s 's|/usr/bin/env python|%{python3}|' test/lib/ansible_test/_util/target/cli/ansible_test_cli_stub.py bin/* lib/ansible/cli/*.py
|
||||
|
||||
%generate_buildrequires
|
||||
temp=$(mktemp)
|
||||
@ -125,21 +127,44 @@ sed '/^mock$/d' test/lib/ansible_test/_data/requirements/units.txt > ${temp}
|
||||
%pyproject_buildrequires %{?with_tests:${temp} test/units/requirements.txt} %{?with_docs:docs/docsite/requirements.txt}
|
||||
|
||||
%build
|
||||
# disable the python -s shbang flag as we want to be able to find non system modules
|
||||
%global py3_shbang_opts %(echo %{py3_shbang_opts} | sed 's/-s//')
|
||||
%py3_shebang_fix .
|
||||
|
||||
# Build manpages
|
||||
make PYTHON=%{__python3} docs
|
||||
make PYTHON=%{python3} docs
|
||||
|
||||
%pyproject_wheel
|
||||
|
||||
%if %{with docs}
|
||||
make PYTHON=%{__python3} SPHINXBUILD=sphinx-build-3 webdocs
|
||||
make PYTHON=%{python3} SPHINXBUILD=sphinx-build-3 webdocs
|
||||
%else
|
||||
# we still need things to build these minimal docs too.
|
||||
# make PYTHON=%{__python3} -Cdocs/docsite config cli keywords modules plugins testing
|
||||
# make PYTHON=%{python3} -Cdocs/docsite config cli keywords modules plugins testing
|
||||
%endif
|
||||
|
||||
for shell in bash fish; do
|
||||
mkdir -p "${shell}_completions"
|
||||
for bin in bin/*; do
|
||||
bin="$(basename ${bin})"
|
||||
case "${shell}" in
|
||||
bash)
|
||||
format="${bin}"
|
||||
;;
|
||||
fish)
|
||||
format="${bin}.${shell}"
|
||||
;;
|
||||
esac
|
||||
register-python-argcomplete --shell "${shell}" "${bin}" > "${shell}_completions/${format}"
|
||||
done
|
||||
done
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
|
||||
install -Dpm 0644 bash_completions/* -t %{buildroot}%{_datadir}/bash_completion/completions
|
||||
install -Dpm 0644 fish_completions/* -t %{buildroot}%{_datadir}/fish/vendor_completions.d
|
||||
|
||||
# Create system directories that Ansible defines as default locations in
|
||||
# ansible/config/base.yml
|
||||
DATADIR_LOCATIONS='%{_datadir}/ansible/collections
|
||||
@ -173,7 +198,7 @@ fi
|
||||
|
||||
mkdir -p %{buildroot}%{_datadir}/ansible/plugins/
|
||||
for location in $DATADIR_LOCATIONS ; do
|
||||
mkdir %{buildroot}"$location"
|
||||
mkdir %{buildroot}"$location"
|
||||
done
|
||||
mkdir -p %{buildroot}/etc/ansible/
|
||||
mkdir -p %{buildroot}/etc/ansible/roles/
|
||||
@ -190,7 +215,7 @@ find %{buildroot}/%{python3_sitelib} -name .travis.yml -exec rm -f {} \;
|
||||
%check
|
||||
%if %{with tests}
|
||||
ln -s /usr/bin/pytest-3 bin/pytest
|
||||
make PYTHON=%{__python3} tests-py3
|
||||
make PYTHON=%{python3} tests-py3
|
||||
%endif
|
||||
|
||||
%files
|
||||
@ -201,6 +226,10 @@ make PYTHON=%{__python3} tests-py3
|
||||
%{_mandir}/man1/ansible*
|
||||
%{_bindir}/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_test
|
||||
%{python3_sitelib}/*dist-info
|
||||
@ -220,8 +249,8 @@ make PYTHON=%{__python3} tests-py3
|
||||
- Remove unneeded BRs and switch to pyproject-rpm-macros.
|
||||
- Make ansible-base* Obsoletes/Provides compliant with Packaging Guidelines
|
||||
- Remove python3-jmespath dependency. json_query is part of community.general.
|
||||
- Remove py3_shbang_opts now that all shebangs were removed from modules.
|
||||
- Correct licensing
|
||||
- Generate shell completions
|
||||
|
||||
* Tue May 24 2022 Maxwell G <gotmax@e.email> - 2.12.6-1
|
||||
- Update to 2.12.6.
|
||||
|
Loading…
Reference in New Issue
Block a user