SHA256
1
0
forked from pool/ansible-lint

Accepting request 950365 from home:sebix:branches:systemsmanagement

- add fix-discover_lintables.patch to fix a test fail.
- refactor specfile, remove multipython, this is an application only.
- Update to version 5.3.2:
 - Too many changes to list here, see https://github.com/ansible-community/ansible-lint/releases

OBS-URL: https://build.opensuse.org/request/show/950365
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ansible-lint?expand=0&rev=6
This commit is contained in:
Boris Manojlovic 2022-02-01 20:07:40 +00:00 committed by Git OBS Bridge
parent 6ab394dc7a
commit ba070d5882
5 changed files with 98 additions and 44 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c6c42fc65b88c51b1eb35ab6688dfe6cf99abafdfeb300fd146955e6aac496d
size 40717

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d3a04e4aebec09223b06afe6a484756a24f33ed449679b454be0bc3bf069345f
size 342936

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Sat Jan 29 08:57:07 UTC 2022 - Sebastian Wagner <sebix+novell.com@sebix.at>
- add fix-discover_lintables.patch to fix a test fail.
- refactor specfile, remove multipython, this is an application only.
- Update to version 5.3.2:
- Too many changes to list here, see https://github.com/ansible-community/ansible-lint/releases
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Nov 23 13:58:39 UTC 2018 - Jon Brightwell <jon.brightwell@zpg.co.uk> Fri Nov 23 13:58:39 UTC 2018 - Jon Brightwell <jon.brightwell@zpg.co.uk>

View File

@ -18,70 +18,75 @@
%global lib_name ansiblelint %global lib_name ansiblelint
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?python_enable_dependency_generator}
%if 0%{?suse_version} >= 1500
%define skip_python2 1
%endif
Name: ansible-lint Name: ansible-lint
Version: 3.5.1 Version: 5.3.2
Release: 1%{?dist} Release: 1%{?dist}
Summary: Best practices checker for Ansible Summary: Best practices checker for Ansible
License: MIT License: MIT
Url: https://github.com/willthames/ansible-lint Url: https://github.com/willthames/ansible-lint
Source0: https://github.com/willthames/ansible-lint/archive/v%{version}/ansible-lint-%{version}.tar.gz Source0: https://github.com/willthames/ansible-lint/archive/v%{version}/ansible-lint-%{version}.tar.gz
Patch0: https://github.com/ansible-community/ansible-lint/pull/1837.patch#/fix-discover_lintables.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel} BuildRequires: python3-pip
BuildRequires: %{python_module setuptools} BuildRequires: python3-wheel
BuildRequires: %{python_module PyYAML} BuildRequires: python3-PyYAML
BuildRequires: %{python_module six} BuildRequires: python3-six
# SECTION tests
BuildRequires: python3-pytest-xdist
BuildRequires: python3-flaky
BuildRequires: python3-tenacity
BuildRequires: python3-packaging
BuildRequires: python3-yamllint
#BuildRequires: git
BuildRequires: python3-enrich >= 1.2.6
BuildRequires: python3-rich >= 9.5.1
BuildRequires: python3-wcmatch >= 7.0
BuildRequires: python3-ruamel.yaml >= 0.15.37
# /SECTION
BuildRequires: ansible BuildRequires: ansible
BuildRequires: fdupes BuildRequires: fdupes
Requires: ansible Requires: ansible
Requires: %{python_module PyYAML} Requires: python3-PyYAML
Requires: %{python_module six} Requires: python3-six
Requires(post): update-alternatives Requires: python3-tenacity
Requires(postun): update-alternatives Requires: python3-packaging
%python_subpackages Requires: python3-enrich >= 1.2.6
Requires: python3-rich >= 9.5.1
Requires: python3-wcmatch >= 7.0
Requires: python3-ruamel.yaml >= 0.15.37
%description %description
Checks playbooks for practices and behavior that could potentially be improved Checks playbooks for practices and behavior that could potentially be improved.
%prep %prep
%autosetup -n ansible-lint-%{version} %setup -n ansible-lint-%{version}
rm -rf *.egg-info %patch0 -p1
sed -ri 's/(\[metadata\])/\1\nversion = %{version}/' setup.cfg
sed -i '1{/\/usr\/bin\/env python/d;}' src/ansiblelint/__main__.py
%build %build
%python_build python3 -mpip wheel --no-deps --disable-pip-version-check --use-pep517 --no-build-isolation --progress-bar off --verbose . -w build/
%install %install
%python_install python3 -mpip install --root %{buildroot} --disable-pip-version-check --no-compile --no-deps --progress-bar off build/ansible_lint-*.whl
%python_clone -a %{buildroot}%{_bindir}/ansible-lint find %{buildroot}/%{python3_sitelib} -name '*.pyc' -delete
%python_expand %fdupes -s %{buildroot}/%{$python_sitelib} python3 -m compileall %{buildroot}/%{python3_sitelib}
python3 -O -m compileall %{buildroot}/%{python3_sitelib}
%post %fdupes -s %{buildroot}/%{python3_sitelib}
%python_install_alternative ansible-lint
%postun
%python_uninstall_alternative ansible-lint
%check %check
%python2_only PYTHONPATH=%{buildroot}%{python_sitelib} %__python2 setup.py test # exclude some tests depending on internet access (galaxy modules)
# exclude test_cli_auto_detect which depends on a local git repository
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)'
%files %python_files %files
%defattr(-,root,root) %doc README.rst
%doc README.md
%if 0%{?suse_version} >= 1500
%license LICENSE %license LICENSE
%else %{_bindir}/ansible-lint
%doc LICENSE %{python3_sitelib}/%{lib_name}/
%endif %{python3_sitelib}/ansible_lint-%{version}.dist-info/
%python_alternative %{_bindir}/ansible-lint
%{python_sitelib}/*
%changelog %changelog

View File

@ -0,0 +1,41 @@
From fadda4ad7851fdf64dd94b5a9305fa8364d0fed7 Mon Sep 17 00:00:00 2001
From: Sebastian Wagner <sebix@sebix.at>
Date: Fri, 28 Jan 2022 19:23:44 +0100
Subject: [PATCH] fix discover_lintables: strip ./ from WcMatch return value
calling WcMatch('.', ...) causes the resulting file names to be prefixed
with `./`.
If the tests are run in a git-repository, this is not an issue, as git
is preferred of WcMatch in the code.
Therefore remove the `./` prefix from the WcMatch return value to get
the identical expected output.
fixes ansible-community/ansible-lint#1836
---
src/ansiblelint/file_utils.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/ansiblelint/file_utils.py b/src/ansiblelint/file_utils.py
index dad094b8d..b3cb1940c 100644
--- a/src/ansiblelint/file_utils.py
+++ b/src/ansiblelint/file_utils.py
@@ -261,11 +261,13 @@ def discover_lintables(options: Namespace) -> Dict[str, Any]:
if out is None:
exclude_pattern = "|".join(str(x) for x in options.exclude_paths)
_logger.info("Looking up for files, excluding %s ...", exclude_pattern)
- out = set(
- WcMatch(
- '.', exclude_pattern=exclude_pattern, flags=RECURSIVE, limit=256
- ).match()
- )
+ # remove './' prefix from output of WcMatch
+ out = set(map(lambda fname: fname[2:],
+ WcMatch(
+ '.', exclude_pattern=exclude_pattern, flags=RECURSIVE, limit=256
+ ).match()
+ )
+ )
return OrderedDict.fromkeys(sorted(out))