From b7afe61c94b7f011bdfbcf7bf5f9d1964af3c959 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Mon, 16 May 2022 21:07:46 -0500 Subject: [PATCH] Update to 2.13.0. Re-enable tests that work with newer pytest Patch out python3-mock Manually build manpages to workaround upstream issue. Remove unneeded BRs Make ansible-base* Obsoletes/Provides compliant with Packaging Guidelines Remove python3-jmespath dependency. json_query is part of community.general. --- .gitignore | 1 + ansible-core.spec | 81 ++++++++--------- avoid-deprecated-method-unit-tests.patch | 4 +- fix-tests-failing-on-pytest-7.patch | 108 ----------------------- sources | 2 +- 5 files changed, 42 insertions(+), 154 deletions(-) delete mode 100644 fix-tests-failing-on-pytest-7.patch diff --git a/.gitignore b/.gitignore index eb7ee76..96aaf23 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.13.0.tar.gz diff --git a/ansible-core.spec b/ansible-core.spec index a7fb9ef..c3a0ff3 100644 --- a/ansible-core.spec +++ b/ansible-core.spec @@ -11,17 +11,16 @@ Name: ansible-core Summary: A radically simple IT automation system -Version: 2.12.6 +Version: 2.13.0 Release: 1%{?dist} License: GPLv3+ -Source: %{pypi_source} -Patch: https://github.com/ansible/ansible/pull/76670.patch#/fix-tests-failing-on-pytest-7.patch +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 # Stop using a deprecated cryptography method that is no longer available in F37. -Patch: https://github.com/ansible/ansible/pull/77835.patch#/avoid-deprecated-method-unit-tests.patch +Patch: https://github.com/ansible/ansible/pull/77834.patch#/avoid-deprecated-method-unit-tests.patch Url: https://ansible.com BuildArch: noarch @@ -37,8 +36,8 @@ 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 %if %{with tests} # @@ -50,8 +49,6 @@ 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 @@ -62,12 +59,6 @@ BuildRequires: python3-resolvelib 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 %endif @@ -89,26 +80,20 @@ BuildRequires: antsibull # 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 +# Needed to build manpages from source. +BuildRequires: python3-straight-plugin +BuildRequires: python3-docutils # RHEL8 doesn't have python3-paramiko or python3-winrm (yet), but Fedora does Recommends: python3-paramiko Recommends: python3-winrm -# needed for json_query filter -Requires: python3-jmespath -# needed for galaxy -Requires: python3-resolvelib - %description Ansible is a radically simple model-driven configuration management, multi-node deployment, and remote task execution system. Ansible works @@ -119,9 +104,9 @@ are transferred to managed machines automatically. This is the base part of ansible (the engine). %package -n ansible-core-doc -Summary: Documentation for Ansible Base -Provides: ansible-base-doc = 2.10.7 -Obsoletes: ansible-base-doc < 2.10.6-1%{?dist} +Summary: Documentation for Ansible Core +Provides: ansible-base-doc = %{version}-%{release} +Obsoletes: ansible-base-doc < 2.10.6-1 %description -n ansible-core-doc @@ -136,19 +121,29 @@ This package installs extensive documentation for ansible-core %prep %autosetup -p1 -%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 %global py3_shbang_opts %(echo %{py3_shbang_opts} | sed 's/-s//') +%py3_shebang_fix . + +# Patch out python3-mock, as per https://fedoraproject.org/wiki/Changes/DeprecatePythonMock. +grep -lEr '^(\s*)import mock' | xargs sed -i 's|^\(\s*\)import mock|\1from unittest import mock|' +grep -lEr '^(\s*)from mock import ' | xargs sed -i 's|^\(\s*\)from mock import |\1from unittest.mock import |' +sed -i '/^mock_use_standalone_module = true$/d' test/lib/ansible_test/_data/pytest.ini + +%build + +sed -i -s 's|/usr/bin/env python|%{__python3}|' test/lib/ansible_test/_util/target/cli/ansible_test_cli_stub.py bin/* + +# Build manpages +make PYTHON=%{__python3} docs + %py3_build %if %{with docs} - make PYTHON=/usr/bin/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=/usr/bin/python3 -Cdocs/docsite config cli keywords modules plugins testing + # make PYTHON=%{__python3} -Cdocs/docsite config cli keywords modules plugins testing %endif %install @@ -204,21 +199,12 @@ 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 +make PYTHON=%{__python3} tests-py3 %endif %files %license COPYING -%doc README.rst PKG-INFO changelogs/CHANGELOG-v2.12.rst +%doc README.rst PKG-INFO changelogs/CHANGELOG-v2.13.rst %dir %{_sysconfdir}/ansible/ %config(noreplace) %{_sysconfdir}/ansible/* %{_mandir}/man1/ansible* @@ -235,6 +221,15 @@ make PYTHON=/usr/bin/python3 tests-py3 %endif %changelog +* Fri May 27 2022 Maxwell G - 2.13.0-1 +- Update to 2.13.0. +- Re-enable tests that work with newer pytest +- Patch out python3-mock +- Manually build manpages to workaround upstream issue. +- Remove unneeded BRs +- Make ansible-base* Obsoletes/Provides compliant with Packaging Guidelines +- Remove python3-jmespath dependency. json_query is part of community.general. + * Tue May 24 2022 Maxwell G - 2.12.6-1 - Update to 2.12.6. diff --git a/avoid-deprecated-method-unit-tests.patch b/avoid-deprecated-method-unit-tests.patch index 00f9367..7467ec7 100644 --- a/avoid-deprecated-method-unit-tests.patch +++ b/avoid-deprecated-method-unit-tests.patch @@ -1,7 +1,7 @@ -From 74d67f5eacf75bf16dedf1090f08fac5059b31f7 Mon Sep 17 00:00:00 2001 +From a555134e06d56396c9effa73d7d201ef3de945d4 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 17 May 2022 22:54:53 -0700 -Subject: [PATCH] [stable-2.12] Avoid deprecated method in unit tests. (cherry +Subject: [PATCH] [stable-2.13] Avoid deprecated method in unit tests. (cherry picked from commit 5f74350fd5fab5599127eaa43c615d2159e145c6) Co-authored-by: Matt Clay diff --git a/fix-tests-failing-on-pytest-7.patch b/fix-tests-failing-on-pytest-7.patch deleted file mode 100644 index aed355d..0000000 --- a/fix-tests-failing-on-pytest-7.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 52a56f3c0594cf76b3061260711536c23385ee75 Mon Sep 17 00:00:00 2001 -From: Jordan Borean -Date: Fri, 7 Jan 2022 09:53:18 +1000 -Subject: [PATCH 1/2] Fix pytest 7 failures with leaky fixture - ---- - changelogs/fragments/ansible-test-pytest7.yml | 2 ++ - test/units/galaxy/test_role_install.py | 17 +++++++++-------- - 2 files changed, 11 insertions(+), 8 deletions(-) - create mode 100644 changelogs/fragments/ansible-test-pytest7.yml - -diff --git a/changelogs/fragments/ansible-test-pytest7.yml b/changelogs/fragments/ansible-test-pytest7.yml -new file mode 100644 -index 0000000000000..305dddb181b4e ---- /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 ---- a/test/units/galaxy/test_role_install.py -+++ b/test/units/galaxy/test_role_install.py -@@ -8,6 +8,7 @@ - - - import os -+import functools - import pytest - import tempfile - -@@ -59,9 +60,9 @@ def mock_NamedTemporaryFile(mocker, **args): - return mock_ntf - - --@pytest.fixture(autouse=True) --def init_test(monkeypatch): -- monkeypatch.setattr(tempfile, 'NamedTemporaryFile', mock_NamedTemporaryFile) -+@pytest.fixture -+def init_mock_temp_file(mocker, monkeypatch): -+ monkeypatch.setattr(tempfile, 'NamedTemporaryFile', functools.partial(mock_NamedTemporaryFile, mocker)) - - - @pytest.fixture(autouse=True) -@@ -74,7 +75,7 @@ def mock_role_download_api(mocker, monkeypatch): - return mock_role_api - - --def test_role_download_github(mocker, galaxy_server, mock_role_download_api, monkeypatch): -+def test_role_download_github(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch): - mock_api = mocker.MagicMock() - mock_api.side_effect = [ - StringIO(u'{"available_versions":{"v1":"v1/"}}'), -@@ -89,7 +90,7 @@ def test_role_download_github(mocker, galaxy_server, mock_role_download_api, mon - assert mock_role_download_api.mock_calls[0][1][0] == 'https://github.com/test_owner/test_role/archive/0.0.1.tar.gz' - - --def test_role_download_github_default_version(mocker, galaxy_server, mock_role_download_api, monkeypatch): -+def test_role_download_github_default_version(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch): - mock_api = mocker.MagicMock() - mock_api.side_effect = [ - StringIO(u'{"available_versions":{"v1":"v1/"}}'), -@@ -104,7 +105,7 @@ def test_role_download_github_default_version(mocker, galaxy_server, mock_role_d - assert mock_role_download_api.mock_calls[0][1][0] == 'https://github.com/test_owner/test_role/archive/0.0.2.tar.gz' - - --def test_role_download_github_no_download_url_for_version(mocker, galaxy_server, mock_role_download_api, monkeypatch): -+def test_role_download_github_no_download_url_for_version(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch): - mock_api = mocker.MagicMock() - mock_api.side_effect = [ - StringIO(u'{"available_versions":{"v1":"v1/"}}'), -@@ -119,7 +120,7 @@ def test_role_download_github_no_download_url_for_version(mocker, galaxy_server, - assert mock_role_download_api.mock_calls[0][1][0] == 'https://github.com/test_owner/test_role/archive/0.0.1.tar.gz' - - --def test_role_download_url(mocker, galaxy_server, mock_role_download_api, monkeypatch): -+def test_role_download_url(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch): - mock_api = mocker.MagicMock() - mock_api.side_effect = [ - StringIO(u'{"available_versions":{"v1":"v1/"}}'), -@@ -135,7 +136,7 @@ def test_role_download_url(mocker, galaxy_server, mock_role_download_api, monkey - assert mock_role_download_api.mock_calls[0][1][0] == 'http://localhost:8080/test_owner/test_role/0.0.1.tar.gz' - - --def test_role_download_url_default_version(mocker, galaxy_server, mock_role_download_api, monkeypatch): -+def test_role_download_url_default_version(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch): - mock_api = mocker.MagicMock() - mock_api.side_effect = [ - StringIO(u'{"available_versions":{"v1":"v1/"}}'), - -From 47c1f8f5bf3e27103a9320d42b8b1c602b5c27f0 Mon Sep 17 00:00:00 2001 -From: Matt Davis -Date: Fri, 7 Jan 2022 15:35:54 -0800 -Subject: [PATCH 2/2] zap changelog - ---- - changelogs/fragments/ansible-test-pytest7.yml | 2 -- - 1 file changed, 2 deletions(-) - delete mode 100644 changelogs/fragments/ansible-test-pytest7.yml - -diff --git a/changelogs/fragments/ansible-test-pytest7.yml b/changelogs/fragments/ansible-test-pytest7.yml -deleted file mode 100644 -index 305dddb181b4e..0000000000000 ---- a/changelogs/fragments/ansible-test-pytest7.yml -+++ /dev/null -@@ -1,2 +0,0 @@ --bugfixes: --- ansible-test - Fix tests that were broken with ``pytest 7`` - https://github.com/ansible/ansible/issues/76577 diff --git a/sources b/sources index c42d8d1..b41ec14 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ansible-core-2.12.6.tar.gz) = 55138701f3733b1ea2049783d9d0246beb7cc778090785eada756c9ef540b248bc345e07a261d5542648fc22088bc25e3ab57f7b904bba615264d5556baae456 +SHA512 (ansible-core-2.13.0.tar.gz) = 37e17d73477ba88c62af94a6912f9b4b91ebf2ac967c2845875e293fe2ed09307e414644899714e604883973e241eed571d61b7a093a6c212446a1f5b702af6f