diff --git a/ansible.rpmlintrc b/ansible.rpmlintrc index bdf23ba..cb59ce4 100644 --- a/ansible.rpmlintrc +++ b/ansible.rpmlintrc @@ -2,3 +2,5 @@ addFilter("W: files-duplicate") addFilter("E: files-duplicated-waste") addFilter("W: name-repeated-in-summary") addFilter("W: cross-directory-hard-link") +# Roles' files and templates should not be mangled +addFilter(r"E: env-script-interpreter.*ansible_collections/[^/]+/[^/]+/roles/[^/]+/(files|templates)/") diff --git a/ansible.spec b/ansible.spec index fe29819..4edd990 100644 --- a/ansible.spec +++ b/ansible.spec @@ -12,6 +12,12 @@ %global ansible_core_next_version 2.15 %global ansible_core_requires (%{py3_dist ansible-core} >= %{ansible_core_version} with %{py3_dist ansible-core} < %{ansible_core_next_version}) +# Roles' files and templates should not be mangled. +# These files are installed on remote systems which may or may not have the +# same file system layout as Fedora. +%global __brp_mangle_shebangs_exclude_from ^%{python3_sitelib}/ansible_collections/[^/]+/[^/]+/roles/[^/]+/(files|templates)/.*$ +%global __requires_exclude_from %{?__requires_exclude_from:%__requires_exclude_from|}%{__brp_mangle_shebangs_exclude_from} + %if 0%{?rhel} == 8 # RHEL 8's ansible-core package is built using Python 3.8, which is not the default version. %define python3_pkgversion 39 @@ -80,11 +86,6 @@ to ansible-core. # Fix wrong-script-end-of-line-encoding in azure.azcollection find ansible_collections/azure/azcollection -type f -print -exec dos2unix -k '{}' \; -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" @@ -115,9 +116,23 @@ find ansible_collections/cyberark/conjur -type f -name "*.pem" -print -delete find -type f -name "*requirements.txt" -size 0 -print -delete rm -v ansible_collections/community/zabbix/roles/zabbix_agent/files/win_sample/doSomething.ps1 rm -v ansible_collections/community/docker/meta/ee-bindep.txt +rm -vr ansible_collections/ibm/spectrum_virtualize/roles/place_holder echo "[END] Delete unnecessary files and directories" +### +# Fix various shebang related issues to appease brp-managle-shebangs +### +find ansible_collections/community/mongodb/roles/*/{files,templates} -type f '!' -executable -name '*.sh*' \ + -print -exec chmod a+x '{}' \; + +# ansible_collections/lowlydba/sqlserver thought it was a good idea to make +# *every* single file, in its repository executable, including .md, .yml, and +# .rst. :facepalm: +# +# TODO: File issue upstream +find ansible_collections/lowlydba/sqlserver/ -executable -type f -print -exec chmod a-x '{}' \; + # Remove shebangs instead of hardocding to %%__python3 to avoid unexpected issues # from https://github.com/ansible/ansible/commit/9142be2f6cabbe6597c9254c5bb9186d17036d55. # Upstream, ansible-core has also removed shebangs from its modules.