From 86cadce1c512801ab6b6cfbbed509d1a8dfc12f5 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Thu, 23 Jun 2022 14:57:41 -0500 Subject: [PATCH 1/5] Update to 2.12.7. Backport packaging fixes from rawhide --- .gitignore | 1 + ansible-core.spec | 199 +++++++++++++++++----------- fix-tests-failing-on-pytest-7.patch | 6 +- sources | 2 +- 4 files changed, 125 insertions(+), 83 deletions(-) diff --git a/.gitignore b/.gitignore index eb7ee76..f25b40b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /ansible-core-2.12.4.tar.gz /ansible-core-2.12.5.tar.gz /ansible-core-2.12.6.tar.gz +/ansible-core-2.12.7.tar.gz diff --git a/ansible-core.spec b/ansible-core.spec index e9f3f30..73943a9 100644 --- a/ansible-core.spec +++ b/ansible-core.spec @@ -9,35 +9,59 @@ # %bcond_without tests -Name: ansible-core -Summary: A radically simple IT automation system -Version: 2.12.6 -Release: 1%{?dist} +Name: ansible-core +Summary: A radically simple IT automation system +Version: 2.12.7 +Release: 1%{?dist} -License: GPLv3+ -Source0: %{pypi_source} -Patch0: https://github.com/ansible/ansible/pull/76670.patch#/fix-tests-failing-on-pytest-7.patch +# The main license is GPLv3+. Many of the files in lib/ansible/module_utils +# are BSD licensed. There are various files scattered throughout the codebase +# containing code under different licenses. +# SPDX-License-Identifier: GPL-3.0-or-later AND BSD-2-Clause AND PSF-2.0 AND MIT AND Apache-2.0 +License: GPLv3+ and BSD and Python and MIT and ASL 2.0 +Source: %{pypi_source} -Url: https://ansible.com -BuildArch: noarch +Patch: https://github.com/ansible/ansible/pull/76670.patch#/fix-tests-failing-on-pytest-7.patch +# 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 +# These patch removes the requirement on python3-mock which is deprecated in Fedora. +# This is based off of work upstream. +Patch: replace-mock.patch -# Require packaging macros if rpm-build exists -# This makes the transition seamless for other packages -Requires: (ansible-packaging if rpm-build) +Url: https://ansible.com +BuildArch: noarch -#Provides: ansible = %%{version}-%%{release} -#Obsoletes: ansible <= 2.9.99 -# For now conflict with the ansible 'classic' package. -Conflicts: ansible <= 2.9.99 +# Virtual provides for bundled libraries +# Search for `_BUNDLED_METADATA` to find them + +# lib/ansible/module_utils/urls.py +# SPDX-License-Identifier: BSD-2-Clause AND PSF-2.0 +# Fedora-License-Identifier: BSD and Python +Provides: bundled(python3dist(backports-ssl-match-hostname)) = 3.7.0.1 + +# lib/ansible/module_utils/distro/* +# SPDX-License-Identifier: Apache-2.0 +# Fedora-License-Identifier: ASL 2.0 +Provides: bundled(python3dist(distro)) = 1.6.0 + +# lib/ansible/module_utils/six/* +# SPDX-License-Identifier: MIT +# Fedora-License-Identifier: MIT +Provides: bundled(python3dist(six)) = 1.16.0 + +# lib/ansible/module_utils/compat/selectors.py +# SPDX-License-Identifier: GPL-3.0-or-later +# Fedora-License-Identifier: GPLv3+ +Provides: bundled(python3dist(selectors2)) = 1.1.1 + +Conflicts: ansible <= 2.9.99 # # obsoletes/provides for ansible-base # -Provides: ansible-base = 2.10.7 -Obsoletes: ansible-base < 2.10.6-1%{?dist} +Provides: ansible-base = %{version}-%{release} +Obsoletes: ansible-base < 2.10.6-1 -# 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. -Patch1: 2.10.3-test-patch.patch %if %{with tests} # @@ -45,68 +69,59 @@ Patch1: 2.10.3-test-patch.patch # # These two exist on both fedora and rhel8 # -BuildRequires: make -BuildRequires: git-core -BuildRequires: python3-packaging -BuildRequires: python3-pexpect -BuildRequires: openssl -BuildRequires: python3-systemd -BuildRequires: python3-pytz -BuildRequires: glibc-all-langpacks -BuildRequires: python3-resolvelib +BuildRequires: make +BuildRequires: git-core +BuildRequires: python3-packaging +BuildRequires: python3-pexpect +BuildRequires: python3-systemd +BuildRequires: python3-pytz +BuildRequires: glibc-all-langpacks +BuildRequires: python3-resolvelib # # These only exist on Fedora. RHEL8 will just skip tests that need them. # %if 0%{?fedora} -BuildRequires: python3-paramiko -BuildRequires: python3-winrm +BuildRequires: python3-paramiko +BuildRequires: python3-winrm -BuildRequires: python3-crypto -BuildRequires: python3-pbkdf2 -BuildRequires: python3-httmock -BuildRequires: python3-gitlab -BuildRequires: python3-boto3 -BuildRequires: python3-botocore -BuildRequires: python3-coverage -BuildRequires: python3-passlib +BuildRequires: python3-coverage +BuildRequires: python3-passlib %endif %endif %if %{with docs} -BuildRequires: make -BuildRequires: python3-sphinx -BuildRequires: python3-sphinx-theme-alabaster -BuildRequires: python3-sphinx-notfound-page -BuildRequires: asciidoc -BuildRequires: python3-straight-plugin -BuildRequires: python3-rstcheck -BuildRequires: python3-pygments -BuildRequires: antsibull +BuildRequires: make +BuildRequires: python3-sphinx +BuildRequires: python3-sphinx-theme-alabaster +BuildRequires: python3-sphinx-notfound-page +BuildRequires: asciidoc +BuildRequires: python3-straight-plugin +BuildRequires: python3-rstcheck +BuildRequires: python3-pygments +BuildRequires: antsibull %endif # # main buildrequires to build # -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-six -BuildRequires: python3-pytest -BuildRequires: python3-pytest-xdist -BuildRequires: python3-pytest-mock -BuildRequires: python3-requests -BuildRequires: python3-mock -BuildRequires: python3-jinja2 -BuildRequires: python3-pyyaml -BuildRequires: python3-cryptography -BuildRequires: python3-pyvmomi +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pytest +BuildRequires: python3-pytest-xdist +BuildRequires: python3-pytest-mock +BuildRequires: python3-jinja2 +BuildRequires: python3-pyyaml +BuildRequires: python3-cryptography +BuildRequires: python3-pyvmomi +BuildRequires: python%{python3_pkgversion}-argcomplete # RHEL8 doesn't have python3-paramiko or python3-winrm (yet), but Fedora does -Recommends: python3-paramiko -Recommends: python3-winrm +Recommends: python3-paramiko +Recommends: python3-winrm -# needed for json_query filter -Requires: python3-jmespath -# needed for galaxy -Requires: python3-resolvelib +Requires: python%{python3_pkgversion}-argcomplete +# Require packaging macros if rpm-build exists +# This makes the transition seamless for other packages +Requires: (ansible-packaging if rpm-build) %description Ansible is a radically simple model-driven configuration management, @@ -135,8 +150,10 @@ This package installs extensive documentation for ansible-core %prep %autosetup -p1 -%build +# Remove shebangs. They are unnecessary and conflict with the Fedora Packaging Guidelines +find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' \; +%build sed -i -s 's|/usr/bin/env python|/usr/bin/python3|' test/lib/ansible_test/_util/target/cli/ansible_test_cli_stub.py # disable the python -s shbang flag as we want to be able to find non system modules @@ -150,9 +167,34 @@ sed -i -s 's|/usr/bin/env python|/usr/bin/python3|' test/lib/ansible_test/_util/ # make PYTHON=/usr/bin/python3 -Cdocs/docsite config cli keywords modules plugins testing %endif +( + cd bin + for shell in bash fish; do + mkdir -p "../${shell}_completions" + for bin in *; do + if grep -q PYTHON_ARGCOMPLETE_OK "${bin}"; then + case "${shell}" in + bash) + format="${bin}" + ;; + fish) + format="${bin}.${shell}" + ;; + esac + register-python-argcomplete --shell "${shell}" "${bin}" > "../${shell}_completions/${format}" + else + echo "Skipped generating completions for ${bin}" + fi + done + done +) + %install %py3_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 @@ -186,7 +228,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/ @@ -203,15 +245,6 @@ find %{buildroot}/%{python3_sitelib} -name .travis.yml -exec rm -f {} \; %check %if %{with tests} ln -s /usr/bin/pytest-3 bin/pytest -# This test needs a module not packaged in Fedora so disable it. -#rm -f test/units/modules/cloud/cloudstack/test_cs_traffic_type.py -# These tests are failing with pytest 6 -rm -f test/units/galaxy/test_collection_install.py -rm -f test/units/module_utils/urls/test_prepare_multipart.py -# requires perms to read/manipulate iptables rules -rm -f test/units/modules/test_iptables.py -# This seems sunos specific -rm -f test/units/modules/test_service.py make PYTHON=/usr/bin/python3 tests-py3 %endif @@ -220,9 +253,13 @@ make PYTHON=/usr/bin/python3 tests-py3 %doc README.rst PKG-INFO changelogs/CHANGELOG-v2.12.rst %dir %{_sysconfdir}/ansible/ %config(noreplace) %{_sysconfdir}/ansible/* -%{_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 +%{_mandir}/man1/ansible* %{python3_sitelib}/ansible %{python3_sitelib}/ansible_test %{python3_sitelib}/*egg-info @@ -234,6 +271,10 @@ make PYTHON=/usr/bin/python3 tests-py3 %endif %changelog +* Thu Jun 23 2022 Maxwell G - 2.12.7-1 +- Update to 2.12.7. +- Backport packaging fixes from rawhide + * Tue May 24 2022 Maxwell G - 2.12.6-1 - Update to 2.12.6. diff --git a/fix-tests-failing-on-pytest-7.patch b/fix-tests-failing-on-pytest-7.patch index aed355d..bf4d8c7 100644 --- a/fix-tests-failing-on-pytest-7.patch +++ b/fix-tests-failing-on-pytest-7.patch @@ -11,14 +11,14 @@ Subject: [PATCH 1/2] Fix pytest 7 failures with leaky fixture diff --git a/changelogs/fragments/ansible-test-pytest7.yml b/changelogs/fragments/ansible-test-pytest7.yml new file mode 100644 -index 0000000000000..305dddb181b4e +index 00000000000000..305dddb181b4e7 --- /dev/null +++ b/changelogs/fragments/ansible-test-pytest7.yml @@ -0,0 +1,2 @@ +bugfixes: +- ansible-test - Fix tests that were broken with ``pytest 7`` - https://github.com/ansible/ansible/issues/76577 diff --git a/test/units/galaxy/test_role_install.py b/test/units/galaxy/test_role_install.py -index cf990b55a6d90..687fcac1e53fb 100644 +index cf990b55a6d902..687fcac1e53fb9 100644 --- a/test/units/galaxy/test_role_install.py +++ b/test/units/galaxy/test_role_install.py @@ -8,6 +8,7 @@ @@ -100,7 +100,7 @@ Subject: [PATCH 2/2] zap changelog diff --git a/changelogs/fragments/ansible-test-pytest7.yml b/changelogs/fragments/ansible-test-pytest7.yml deleted file mode 100644 -index 305dddb181b4e..0000000000000 +index 305dddb181b4e7..00000000000000 --- a/changelogs/fragments/ansible-test-pytest7.yml +++ /dev/null @@ -1,2 +0,0 @@ diff --git a/sources b/sources index c42d8d1..7205d8d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ansible-core-2.12.6.tar.gz) = 55138701f3733b1ea2049783d9d0246beb7cc778090785eada756c9ef540b248bc345e07a261d5542648fc22088bc25e3ab57f7b904bba615264d5556baae456 +SHA512 (ansible-core-2.12.7.tar.gz) = 15b29bc52cbcd690d442e4923bad23c2b4db34b1d9af9a7e3a73fbad6b4d775795a44df80c739ad409206767f6bc9efc3d5abdab593fb2abd6ba991ca8cbee67 From ee9859f1e62b11c61e08c4dc535dee24e1ddf69b Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Thu, 23 Jun 2022 20:05:37 -0500 Subject: [PATCH 2/5] Commit patchfile --- replace-mock.patch | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 replace-mock.patch diff --git a/replace-mock.patch b/replace-mock.patch new file mode 100644 index 0000000..8d97275 --- /dev/null +++ b/replace-mock.patch @@ -0,0 +1,36 @@ +diff -Naur a/test/units/executor/test_task_executor.py b/test/units/executor/test_task_executor.py +--- a/test/units/executor/test_task_executor.py 2022-06-20 08:45:43.256268500 -0500 ++++ b/test/units/executor/test_task_executor.py 2022-06-23 15:15:00.923335000 -0500 +@@ -19,7 +19,7 @@ + from __future__ import (absolute_import, division, print_function) + __metaclass__ = type + +-import mock ++from unittest import mock + + from units.compat import unittest + from units.compat.mock import patch, MagicMock +diff -Naur a/test/units/module_utils/urls/test_fetch_url.py b/test/units/module_utils/urls/test_fetch_url.py +--- a/test/units/module_utils/urls/test_fetch_url.py 2022-06-20 08:45:43.277268600 -0500 ++++ b/test/units/module_utils/urls/test_fetch_url.py 2022-06-23 15:15:37.487225940 -0500 +@@ -13,7 +13,7 @@ + from ansible.module_utils.urls import fetch_url, urllib_error, ConnectionError, NoSSLError, httplib + + import pytest +-from mock import MagicMock ++from unittest.mock import MagicMock + + + class AnsibleModuleExit(Exception): +diff -Naur a/test/units/module_utils/urls/test_Request.py b/test/units/module_utils/urls/test_Request.py +--- a/test/units/module_utils/urls/test_Request.py 2022-06-20 08:45:43.277268600 -0500 ++++ b/test/units/module_utils/urls/test_Request.py 2022-06-23 15:15:37.487225940 -0500 +@@ -13,7 +13,7 @@ + from ansible.module_utils.urls import SSLValidationHandler, HTTPSClientAuthHandler, RedirectHandlerFactory + + import pytest +-from mock import call ++from unittest.mock import call + + + if HAS_SSLCONTEXT: From d1dc5916d7d49ef04c4b18bf9e228fed5b403e30 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Tue, 16 Aug 2022 19:13:50 -0500 Subject: [PATCH 3/5] Update to 2.12.8. --- .gitignore | 1 + ansible-core.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f25b40b..23d1455 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ /ansible-core-2.12.5.tar.gz /ansible-core-2.12.6.tar.gz /ansible-core-2.12.7.tar.gz +/ansible-core-2.12.8.tar.gz diff --git a/ansible-core.spec b/ansible-core.spec index 73943a9..0c22273 100644 --- a/ansible-core.spec +++ b/ansible-core.spec @@ -11,7 +11,7 @@ Name: ansible-core Summary: A radically simple IT automation system -Version: 2.12.7 +Version: 2.12.8 Release: 1%{?dist} # The main license is GPLv3+. Many of the files in lib/ansible/module_utils @@ -271,6 +271,9 @@ make PYTHON=/usr/bin/python3 tests-py3 %endif %changelog +* Wed Aug 17 2022 Maxwell G - 2.12.8-1 +- Update to 2.12.8. + * Thu Jun 23 2022 Maxwell G - 2.12.7-1 - Update to 2.12.7. - Backport packaging fixes from rawhide diff --git a/sources b/sources index 7205d8d..57ac411 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ansible-core-2.12.7.tar.gz) = 15b29bc52cbcd690d442e4923bad23c2b4db34b1d9af9a7e3a73fbad6b4d775795a44df80c739ad409206767f6bc9efc3d5abdab593fb2abd6ba991ca8cbee67 +SHA512 (ansible-core-2.12.8.tar.gz) = 1bb30dba44f11b0655000350b54cae30b85258dccc130d5cd2b1a5c70e0ebe93abd8fe41d5830da34b6fe622276f69f18a0f47bf9d0b0269338a7efbd5820e44 From 894aee8b6de81b7b9a086a85892b6d03804890d0 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Mon, 12 Sep 2022 20:28:13 -0500 Subject: [PATCH 4/5] Update to 2.12.9. --- .gitignore | 1 + ansible-core.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 23d1455..f9cfcfc 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /ansible-core-2.12.6.tar.gz /ansible-core-2.12.7.tar.gz /ansible-core-2.12.8.tar.gz +/ansible-core-2.12.9.tar.gz diff --git a/ansible-core.spec b/ansible-core.spec index 0c22273..3fac71a 100644 --- a/ansible-core.spec +++ b/ansible-core.spec @@ -11,7 +11,7 @@ Name: ansible-core Summary: A radically simple IT automation system -Version: 2.12.8 +Version: 2.12.9 Release: 1%{?dist} # The main license is GPLv3+. Many of the files in lib/ansible/module_utils @@ -271,6 +271,9 @@ make PYTHON=/usr/bin/python3 tests-py3 %endif %changelog +* Tue Sep 13 2022 Maxwell G - 2.12.9-1 +- Update to 2.12.9. + * Wed Aug 17 2022 Maxwell G - 2.12.8-1 - Update to 2.12.8. diff --git a/sources b/sources index 57ac411..c55175b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ansible-core-2.12.8.tar.gz) = 1bb30dba44f11b0655000350b54cae30b85258dccc130d5cd2b1a5c70e0ebe93abd8fe41d5830da34b6fe622276f69f18a0f47bf9d0b0269338a7efbd5820e44 +SHA512 (ansible-core-2.12.9.tar.gz) = da88489c81293e8361067a17891f9330582b3d21c88584e3268f84511811364ce93c4e1b88b3796faea11274c76c64aa8af74608fce9a074fcc8fc3760d2b90b From eccc9b7634de89d1d3d7c673b7823249fe0327b2 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Wed, 19 Oct 2022 23:58:10 -0500 Subject: [PATCH 5/5] Update to 2.12.10. --- .gitignore | 1 + ansible-core.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f9cfcfc..88c1b18 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ /ansible-core-2.12.7.tar.gz /ansible-core-2.12.8.tar.gz /ansible-core-2.12.9.tar.gz +/ansible-core-2.12.10.tar.gz diff --git a/ansible-core.spec b/ansible-core.spec index 3fac71a..34f0e4b 100644 --- a/ansible-core.spec +++ b/ansible-core.spec @@ -11,7 +11,7 @@ Name: ansible-core Summary: A radically simple IT automation system -Version: 2.12.9 +Version: 2.12.10 Release: 1%{?dist} # The main license is GPLv3+. Many of the files in lib/ansible/module_utils @@ -271,6 +271,9 @@ make PYTHON=/usr/bin/python3 tests-py3 %endif %changelog +* Thu Oct 20 2022 Maxwell G - 2.12.10-1 +- Update to 2.12.10. + * Tue Sep 13 2022 Maxwell G - 2.12.9-1 - Update to 2.12.9. diff --git a/sources b/sources index c55175b..07543d3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ansible-core-2.12.9.tar.gz) = da88489c81293e8361067a17891f9330582b3d21c88584e3268f84511811364ce93c4e1b88b3796faea11274c76c64aa8af74608fce9a074fcc8fc3760d2b90b +SHA512 (ansible-core-2.12.10.tar.gz) = 8b4eb0e923f976680e81ffbe942c4ddc7ddaaaffe83d14c20f78f7c6ab4f548f21920cdfa57b48de2bc24683028e744a92ac4ca45fecc459ea2b042de8c40737