Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] hooks/pre-pkg/03-rewrite-python-shebang.sh: use grep -r instead of find.
@ 2021-01-27 23:46 leahneukirchen
  2021-01-30 14:20 ` [PR PATCH] [Merged]: " leahneukirchen
  0 siblings, 1 reply; 2+ messages in thread
From: leahneukirchen @ 2021-01-27 23:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

There is a new pull request by leahneukirchen against master on the void-packages repository

https://github.com/leahneukirchen/void-packages faster-python-shebang
https://github.com/void-linux/void-packages/pull/28276

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.


A patch file from https://github.com/void-linux/void-packages/pull/28276.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-faster-python-shebang-28276.patch --]
[-- Type: text/x-diff, Size: 1018 bytes --]

From a82347dade129ba0b94c6a76b9a85029d1351490 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
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
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR PATCH] [Merged]: hooks/pre-pkg/03-rewrite-python-shebang.sh: use grep -r instead of find.
  2021-01-27 23:46 [PR PATCH] hooks/pre-pkg/03-rewrite-python-shebang.sh: use grep -r instead of find leahneukirchen
@ 2021-01-30 14:20 ` leahneukirchen
  0 siblings, 0 replies; 2+ messages in thread
From: leahneukirchen @ 2021-01-30 14:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

There's a merged pull request on the void-packages repository

hooks/pre-pkg/03-rewrite-python-shebang.sh: use grep -r instead of find.
https://github.com/void-linux/void-packages/pull/28276

Description:
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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-30 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 23:46 [PR PATCH] hooks/pre-pkg/03-rewrite-python-shebang.sh: use grep -r instead of find leahneukirchen
2021-01-30 14:20 ` [PR PATCH] [Merged]: " leahneukirchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).