From a82347dade129ba0b94c6a76b9a85029d1351490 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 28 Jan 2021 00:42:31 +0100 Subject: [PATCH] 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. --- common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh index 22f506155a0..60e7f61975b 100644 --- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh +++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh @@ -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