From 2860820475337da01986ef77fd2e9d88352a67debeed5b1bbf2fd635a8d4318b Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Sun, 29 May 2022 11:07:48 +0000 Subject: [PATCH] - Add deprecated-pytest-hook.patch to fix a test fail. revert to version 5.4.0, to allow fixing Factory. newer ansible version will need more time OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ansible-lint?expand=0&rev=11 --- ansible-lint-5.4.0.tar.gz | 3 ++ ansible-lint-6.0.2.tar.gz | 3 -- ansible-lint.changes | 62 ++---------------------------------- ansible-lint.spec | 20 ++++-------- deprecated-pytest-hook.patch | 54 +++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 76 deletions(-) create mode 100644 ansible-lint-5.4.0.tar.gz delete mode 100644 ansible-lint-6.0.2.tar.gz create mode 100644 deprecated-pytest-hook.patch diff --git a/ansible-lint-5.4.0.tar.gz b/ansible-lint-5.4.0.tar.gz new file mode 100644 index 0000000..d18c1ef --- /dev/null +++ b/ansible-lint-5.4.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:735c22e074b9be1c3a7e133de7db2af781c0ddae6c91cba035c0d89de964e462 +size 349353 diff --git a/ansible-lint-6.0.2.tar.gz b/ansible-lint-6.0.2.tar.gz deleted file mode 100644 index cf8b566..0000000 --- a/ansible-lint-6.0.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0fc68defe5137cb65976f9f18f5c17b81cbb3037a00be4f26e2849f0ff9384ed -size 195044 diff --git a/ansible-lint.changes b/ansible-lint.changes index b12bc67..decc29c 100644 --- a/ansible-lint.changes +++ b/ansible-lint.changes @@ -1,65 +1,7 @@ ------------------------------------------------------------------- -Fri Apr 1 19:12:02 UTC 2022 - Sebastian Wagner +Sun May 29 11:07:05 UTC 2022 - Sebastian Wagner -- Update to version 6.0.2: - - Recognize import_role and import_role when using fqcn (#2034) - - Adds more yamllint configuration paths (#2032) - - Allow normpath accept empty strings (#2028) - Fixes bug where calling ansible-lint with "" as an argument, it will - raise an exception. We can assume that empty string is the same as - ".", especially as we also allow no arguments which are almost always - treated as current directory too. - - Remove ref to archived toolbox image from docs (#2026) - - `--write`: Add `MatchError.yaml_path` for transforms (#2025) - - --write: Avoid line-wrapping YAML flow objects (#2022) - - --write: Introduce TransformMixin for Rules (#2023) - - Avoid processing files under templates (#2021) - - Add YAML path (to play/task) discovery utils for Transforms to use (#1970) - - Recognize import_tasks with file key (#2019) - - Allow import_playbook from collections (#2018) - - Use ansible-compat cache directory (#2016) - Ensures that we use the same cache_dir as ansible-compat. - -------------------------------------------------------------------- -Tue Mar 15 20:10:01 UTC 2022 - Sebastian Wagner - -- Update to version 6.0.0: - - Major Changes - - Remove support for ansible 2.9 (#1880) @ssbarnea - - Remove support for py36 and py37 (#1850) @ssbarnea - - Made fqcn-builtins rule implicit (#1908) @ssbarnea - - Removed --parseable-severity feature (#1898) @ssbarnea - - Clarify GPLv3 license of the distribution (#1882) @ssbarnea - - Made ansible-core a direct dependency (#1888) @ssbarnea - - Made yamllint a direct dependency (#1881) @ssbarnea - - Rename prerun submodule to _mockings (#1972) @ssbarnea - - Remove unused code from prerun submodule (#1971) @ssbarnea - - Change invalid config return code to 3 (#2005) @ssbarnea - - Minor Changes - - Add ability to load .config/ansible-lint.yml (#1822) @ssbarnea - - Add support for reformatting YAML files (#1943) @cognifloyd - - Add json alias for codeclimate formatter (#1942) @ssbarnea - - Use packit to produce rpms for fedora-35 (#1648) @ssbarnea - - Improve version handling (#1931) @ssbarnea - - Add --write option for upcoming reformat/transform features (#1926) @cognifloyd - - Enable Lintables to be modified (#1884) @cognifloyd - - Improve description of tags (#1896) @ssbarnea - - Remove html extension from documentation (#1981) @ssbarnea - - Minor documentation improvements (#1995) @ssbarnea - - Changed rules to use docstring as shortdesc (#1994) @ssbarnea - - Load rule classes from any modules (#1978) @ssbarnea - - Bugfixes - - Apply MissingFilePermissionsRule to get_url module (#1949) @nre-ableton - - Made empty-string-compare rule opt-in (#1953) @ssbarnea - - Prevent KeyError[0] exception with ansible.builtin.include_tasks (#1935) @ssbarnea - - Made no-same-owner recognize fully qualified modules (#1933) @ssbarnea - - Make FQCN import tasks include their relevant files for checking (#1854) @ryaner - - Fix test integration with IDEs (#1914) @ssbarnea - - Remove outdated ruamel-yaml version constraints (#1889) @ssbarnea - - Spellcheck fixes (#1883) @ssbarnea - - Start using ansible-compat (#1958) @ssbarnea - - Fix bug with detection of configured role paths (#2002) @ssbarnea - - Update var-naming to allow names containing jinja2 templates (#1988) @ssbarnea +- Add deprecated-pytest-hook.patch to fix a test fail. ------------------------------------------------------------------- Tue Feb 15 09:21:58 UTC 2022 - Sebastian Wagner diff --git a/ansible-lint.spec b/ansible-lint.spec index 6b97609..95fb136 100644 --- a/ansible-lint.spec +++ b/ansible-lint.spec @@ -20,12 +20,13 @@ %global lib_name ansiblelint %{?python_enable_dependency_generator} Name: ansible-lint -Version: 6.0.2 +Version: 5.4.0 Release: 1%{?dist} Summary: Best practices checker for Ansible License: MIT URL: https://github.com/ansible-community/ansible-lint Source0: https://github.com/ansible-community/ansible-lint/archive/v%{version}/ansible-lint-%{version}.tar.gz +Patch0: https://github.com/ansible/ansible-lint/commit/aa6c1c6577f8178643591ddc06996a5d5588cb9a.patch#/deprecated-pytest-hook.patch BuildArch: noarch BuildRequires: python-rpm-macros BuildRequires: python3-PyYAML @@ -37,23 +38,16 @@ BuildRequires: python3-pytest-xdist BuildRequires: python3-flaky BuildRequires: python3-packaging BuildRequires: python3-tenacity -BuildRequires: python3-yamllint >= 1.25.0 +BuildRequires: python3-yamllint #BuildRequires: git BuildRequires: python3-enrich >= 1.2.6 -BuildRequires: python3-ansible-compat >= 2.0.2 -BuildRequires: python3-black -BuildRequires: python3-flake8 -BuildRequires: python3-mypy -BuildRequires: python3-pylint -BuildRequires: python3-pytest-cov +BuildRequires: ansible BuildRequires: python3-rich >= 9.5.1 BuildRequires: python3-ruamel.yaml >= 0.15.37 BuildRequires: python3-wcmatch >= 7.0 # /SECTION -BuildRequires: ansible >= 2.12 BuildRequires: fdupes -Requires: ansible >= 2.12 -Requires: ansiblec-compat >= 2.0.2 +Requires: ansible Requires: python3-PyYAML Requires: python3-enrich >= 1.2.6 Requires: python3-packaging @@ -62,13 +56,13 @@ Requires: python3-ruamel.yaml >= 0.15.37 Requires: python3-six Requires: python3-tenacity Requires: python3-wcmatch >= 7.0 -Requires: python3-yamllint >= 1.25.0 %description Checks playbooks for practices and behavior that could potentially be improved. %prep %setup -n ansible-lint-%{version} +%patch0 -p1 sed -ri 's/(\[metadata\])/\1\nversion = %{version}/' setup.cfg sed -i '1{/\/usr\/bin\/env python/d;}' src/ansiblelint/__main__.py @@ -86,7 +80,7 @@ python3 -O -m compileall %{buildroot}/%{python3_sitelib} %check # exclude some tests depending on internet access (galaxy modules) # exclude test_cli_auto_detect which depends on a local git repository -# exclude test_co and test_call_from_outside_venv because of https://github.com/ansible-community/ansible-lint/issues/1885 +# exclude test_co and test_call_from_outside_venv because of https://github.com/ansible-community/ansible-lint/issues/1885 FIXED! PYTHONPATH=${PYTHONPATH:+$PYTHONPATH:}%{buildroot}/%{python3_sitelib} PATH=${PATH:+$PATH:}%{buildroot}/%{_bindir} PYTHONDONTWRITEBYTECODE=1 pytest -v -k 'not (test_prerun_reqs_v1 or test_prerun_reqs_v2 or test_install_collection or test_require_collection_wrong_version or test_cli_auto_detect or test_eco or test_call_from_outside_venv)' %files diff --git a/deprecated-pytest-hook.patch b/deprecated-pytest-hook.patch new file mode 100644 index 0000000..081729b --- /dev/null +++ b/deprecated-pytest-hook.patch @@ -0,0 +1,54 @@ +From aa6c1c6577f8178643591ddc06996a5d5588cb9a Mon Sep 17 00:00:00 2001 +From: Sorin Sbarnea +Date: Sun, 13 Feb 2022 13:21:49 +0000 +Subject: [PATCH] Remove deprecated pytest hook (#1891) + +--- + conftest.py | 22 ---------------------- + tox.ini | 1 + + 2 files changed, 1 insertion(+), 22 deletions(-) + +diff --git a/conftest.py b/conftest.py +index 303e87302..f93a957af 100644 +--- a/conftest.py ++++ b/conftest.py +@@ -1,27 +1,5 @@ + """PyTest Fixtures.""" + import os +-import re +-import sys +-from typing import List + + os.environ["NO_COLOR"] = "1" + pytest_plugins = ["ansiblelint.testing.fixtures"] +- +- +-def pytest_cmdline_preparse(args: List[str]) -> None: +- """Pytest hook.""" +- # disable xdist when called with -k args (filtering) +- # https://stackoverflow.com/questions/66407583/how-to-disable-pytest-xdist-only-when-pytest-is-called-with-filters +- if "xdist" in sys.modules and "-k" in args: +- for i, arg in enumerate(args): +- # remove -n # option +- if arg == "-n": +- del args[i] +- del args[i] +- break +- # remove -n# option +- if re.match(r"-n\d+", arg): +- del args[i] +- break +- +- args[:] = ["-n0"] + args +diff --git a/tox.ini b/tox.ini +index 4ffa9d99e..fb0525be6 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -28,6 +28,7 @@ commands = + {envpython} -m pytest \ + --junitxml "{toxworkdir}/junit.{envname}.xml" \ + {posargs:\ ++ -n0 \ + -m "not eco" \ + -p pytest_cov \ + --cov ansiblelint \