From 28390405d084050bbded7decf56b8930bc5e4509 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Jul 15 2022 18:19:50 +0000 Subject: Replace rm -rf with rm -r This will cause the command to fail if the files being removed don't actually exist. This prevents us from leaving in useless commands. --- diff --git a/ansible.spec b/ansible.spec index 333c89e..ea29a59 100644 --- a/ansible.spec +++ b/ansible.spec @@ -65,11 +65,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 '{}' \; -# 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. -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 '{}' \; @@ -81,10 +76,7 @@ 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|placeholder)$" -find ansible_collections -depth -regextype posix-egrep -regex "${hidden_pattern}" -print -exec rm -rf {} \; - -# https://github.com/ansible-collections/kubernetes.core/pull/298 -rm -rf ansible_collections/kubernetes/core/molecule +find ansible_collections -depth -regextype posix-egrep -regex "${hidden_pattern}" -print -exec rm -r {} \; # Not needed for runtime and has # /Users/kbreit/Documents/Programming/ansible_collections/cisco/meraki/venv/bin/python shebang @@ -104,6 +96,11 @@ rm -f ansible_collections/community/docker/meta/ee-bindep.txt echo "[END] Delete unnecessary files and directories" +# 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. +find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' \; + # This ensures that %%ansible_core_requires is set properly, when %%pyproject_buildrequires is defined. # It also ensures that dependencies remain consistent. %if %{undefined el8}