Accepting request 1039495 from home:ojkastl_buildservice:Branch_systemsmanagement_ansible

- rework spec file to define %ansible_python version, which is the
  python version, that ansible is built against, as well as
  %ansible_python_sitelib and %ansible_python_executable

OBS-URL: https://build.opensuse.org/request/show/1039495
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:ansible/ansible?expand=0&rev=7
This commit is contained in:
Johannes Kastl 2022-12-02 07:21:29 +00:00 committed by Git OBS Bridge
parent 55d9315382
commit d100b1f4de
2 changed files with 27 additions and 8 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Nov 25 07:03:33 UTC 2022 - Johannes Kastl <kastl@b1-systems.de>
- rework spec file to define %ansible_python version, which is the
python version, that ansible is built against, as well as
%ansible_python_sitelib and %ansible_python_executable
-------------------------------------------------------------------
Wed Nov 23 07:27:47 UTC 2022 - Johannes Kastl <kastl@b1-systems.de>

View File

@ -15,7 +15,19 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define pythons %primary_python
%if 0%{?suse_version} < 1550
# Leap15, SLES15
%define pythons python310
%define ansible_python python310
%define ansible_python_executable python3.10
%define ansible_python_sitelib %python310_sitelib
%else
# Tumbleweed
%define pythons python3
%define ansible_python python3
%define ansible_python_executable python3
%define ansible_python_sitelib %python3_sitelib
%endif
Name: ansible
Version: 7.0.0
@ -26,8 +38,8 @@ URL: https://ansible.com/
Source: https://files.pythonhosted.org/packages/source/a/ansible/ansible-%{version}.tar.gz
Source99: ansible-rpmlintrc
BuildRequires: python-rpm-macros
BuildRequires: %{python_module base >= 3.9}
BuildRequires: %{python_module setuptools}
BuildRequires: %{ansible_python}-base >= 3.9
BuildRequires: %{ansible_python}-setuptools
BuildRequires: fdupes
# required to fix the azure collection line endings
@ -37,7 +49,7 @@ BuildRequires: dos2unix
BuildRequires: ansible-core >= 2.14.0
# /SECTION
Requires: %{primary_python}-base >= 3.9
Requires: %{ansible_python}-base >= 3.9
Requires: ansible-core >= 2.14.0
BuildArch: noarch
@ -56,14 +68,14 @@ for file in .git_keep .travis.yml ; do
done
# fix for wrong shebang:
sed -i 's|/Users/kbreit/Documents/Programming/ansible_collections/cisco/meraki/venv/bin/python|%{_bindir}/python3|g' ansible_collections/cisco/meraki/scripts/sublime-build/build.py.generic
sed -i 's|/Users/kbreit/Documents/Programming/ansible_collections/cisco/meraki/venv/bin/python|%{_bindir}/%{ansible_python_executable}|g' ansible_collections/cisco/meraki/scripts/sublime-build/build.py.generic
# Replace all #!/usr/bin/env lines to use #!/usr/bin/$1 directly.
find ./ -type f -exec \
sed -i '1s|^#!%{_bindir}/env |#!%{_bindir}/|' {} \;
find ./ -type f -exec \
sed -i '1s|python$|python3|' {} \;
sed -i '1s|python$|%{ansible_python_executable}|' {} \;
# remove .keep and .gitignore files
find ./ansible_collections/ -iname .gitignore -delete
@ -81,12 +93,12 @@ rm -rf ./ansible_collections/lowlydba/sqlserver/
%install
%python_install
%fdupes %{buildroot}/%{python_sitelib}/ansible_collections/
%fdupes %{buildroot}/%{ansible_python_sitelib}/ansible_collections/
%files
%doc CHANGELOG-v7.rst README.rst
%license COPYING
%{_bindir}/ansible-community
%{python_sitelib}/*
%{ansible_python_sitelib}/
%changelog