Use find and xargs instead of 'find -exec'
This takes up a fraction of the time, as it avoids spawning a bunch of sed processes
This commit is contained in:
parent
1bf2be2a3d
commit
a4066fae5c
1 changed files with 6 additions and 1 deletions
|
|
@ -137,7 +137,12 @@ find ansible_collections/lowlydba/sqlserver/ -executable -type f -print -exec ch
|
|||
# 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}' '{}' \;
|
||||
#
|
||||
# XXX: Print out the files before they're replaced
|
||||
find -type f ! -executable -name '*.py' | tee non_exec
|
||||
# xargs is noticably faster than find -exec, because it spawns one sed process
|
||||
# instead of ~13 thousand!
|
||||
xargs -a non_exec -d'\n' 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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue