hooks/pre-pkg/03-rewrite-python-shebang.sh: use grep -r instead of find.

This saves us one sed execution per file in the destdir, resulting
in a major speedup.

Grep will only consider text files and only look at the first line.
This commit is contained in:
Leah Neukirchen 2021-01-28 00:42:31 +01:00
parent 26ec8902ec
commit 6ecbbf767a

View file

@ -16,7 +16,7 @@ hook() {
default_shebang="#!/usr/bin/python${pyver%.*}"
fi
find "${PKGDESTDIR}" -type f -print0 | \
grep -rlIZ -m1 '^#!.*python' "${PKGDESTDIR}" |
while IFS= read -r -d '' file; do
[ ! -s "$file" ] && continue