diff --git a/ansible.rpmlintrc b/ansible.rpmlintrc index d92d470..910527e 100644 --- a/ansible.rpmlintrc +++ b/ansible.rpmlintrc @@ -1,5 +1,6 @@ addFilter("W: files-duplicate") addFilter("E: files-duplicated-waste") addFilter("W: name-repeated-in-summary") +addFilter("W: cross-directory-hard-link") # This is not egrep, it's "find -regextype posix-egrep" addFilter("W: deprecated-grep") diff --git a/ansible.spec b/ansible.spec index 552c98f..b2223d8 100644 --- a/ansible.spec +++ b/ansible.spec @@ -36,6 +36,7 @@ BuildArch: noarch BuildRequires: dos2unix BuildRequires: findutils +BuildRequires: /usr/bin/hardlink BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: %{ansible_core_requires} @@ -69,12 +70,17 @@ find ansible_collections/azure/azcollection -type f -print -exec dos2unix -k '{} # Upstream, ansible-core has also removed shebangs from its modules. find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' \; +find ansible_collections/community/mongodb/roles/*/{files,templates} -type f ! -executable -name '*.sh*' \ + -print -exec chmod a+x '{}' \; + +sed -i -e '1{\@^#!.*@d}' ansible_collections/cyberark/conjur/Jenkinsfile + # Remove unnecessary files and directories included in the Ansible collection release tarballs # Tracked upstream in part by: https://github.com/ansible-community/community-topics/issues/29 echo "[START] Delete unnecessary files and directories" # Collection tarballs contain a lot of hidden files and directories -hidden_pattern=".*\.(DS_Store|all-contributorsrc|ansible-lint|azure-pipelines|circleci|codeclimate.yml|flake8|galaxy_install_info|gitattributes|github|gitignore|gitkeep|gitlab-ci.yml|idea|keep|mypy_cache|nojekyll|orig|plugin-cache.yaml|pre-commit-config.yaml|project|pydevproject|pytest_cache|pytest_cache|readthedocs.yml|settings|swp|travis.yml|vscode|yamllint|yamllint.yaml|zuul.d|zuul.yaml|rstcheck.cfg)$" +hidden_pattern=".*\.(DS_Store|all-contributorsrc|ansible-lint|azure-pipelines|circleci|codeclimate.yml|flake8|galaxy_install_info|gitattributes|github|gitignore|gitkeep|gitlab-ci.yml|idea|keep|mypy_cache|nojekyll|orig|plugin-cache.yaml|pre-commit-config.yaml|project|pydevproject|pytest_cache|pytest_cache|readthedocs.yml|settings|swp|travis.yml|vscode|yamllint|yamllint.yaml|zuul.d|zuul.yaml|rstcheck.cfg|placeholder)$" find ansible_collections -depth -regextype posix-egrep -regex "${hidden_pattern}" -print -exec rm -rf {} \; # https://github.com/ansible-collections/kubernetes.core/pull/298 @@ -114,7 +120,7 @@ echo "[END] Delete unnecessary files and directories" # `%%{ansible_licensedir}/collection_namespace/collection_name`, and then adds # `%%license /path/to/license` to the %%files list. # `-printf '%%P\n'` removes the trailing `./`. - for f in $(find . -mindepth 3 -type f \( -name 'LICENSE.*' -o -name 'COPYING.*' \) -printf '%%P\n'); do + for f in $(find . -mindepth 3 -type f \( -name 'LICENSE*' -o -name 'COPYING*' \) -printf '%%P\n'); do dirname="$(dirname %{buildroot}%{ansible_licensedir}/${f})" mkdir -p "${dirname}" mv "${f}" "${dirname}" @@ -124,7 +130,7 @@ EOF done # This does the same thing, but for READMEs. - for f in $(find . -mindepth 3 -type f -name 'README.*' -printf '%%P\n'); do + for f in $(find . -mindepth 3 -type f -name 'README*' -printf '%%P\n'); do dirname="$(dirname %{buildroot}%{ansible_docdir}/${f})" mkdir -p "${dirname}" mv "${f}" "${dirname}" @@ -133,6 +139,8 @@ EOF EOF done ) +hardlink -v %{buildroot}%{python3_sitelib}/ansible_collections +hardlink -v %{buildroot}%{ansible_licensedir} %check %if 0%{?with_tests} @@ -156,6 +164,7 @@ EOF - Update to 6.0.0~rc1. - Stop duplicating docs and licenses. - Don't remove tests in %%prep that are now handled by setup.py. +- Hardlink duplicated files and fix rpmlint errors * Thu Jun 16 2022 Python Maint - 5.9.0-2 - Rebuilt for Python 3.11