From 16ccdb704b8604e56f0809e6ae5f8790f8a3acdc Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Wed, 15 Sep 2021 14:54:40 +0200
Subject: [PATCH] Make brp-strip-comment-note multi process

Run at least the file classification in parallel

Resolves: #1230
---
 scripts/brp-strip-comment-note | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/brp-strip-comment-note b/scripts/brp-strip-comment-note
index a90be71090..baf8537f3d 100755
--- a/scripts/brp-strip-comment-note
+++ b/scripts/brp-strip-comment-note
@@ -6,7 +6,6 @@ fi
 
 STRIP=${1:-strip}
 OBJDUMP=${2:-objdump}
-NCPUS=${RPM_BUILD_NCPUS:-1}
 
 case `uname -a` in
 Darwin*) exit 0 ;;
@@ -15,7 +14,9 @@ esac
 
 # Strip .comment and .note sections (the latter only if it is not allocated)
 # for already stripped elf files in the build root
-for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -print0 | xargs -0 -r -P$NCPUS -n32 sh -c "file \"\\$@\" | grep -v \"^${RPM_BUILD_ROOT}/\?usr/lib/debug\" | sed -n -e 's/^\(.*\):[ 	]*ELF.*, stripped.*/\1/p'" ARG0`; do
+for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
+        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
+	sed -n -e 's/^\(.*\):[ 	]*ELF.*, stripped.*/\1/p'`; do
 	note="-R .note"
 	if $OBJDUMP -h $f | grep '^[ 	]*[0-9]*[ 	]*.note[ 	]' -A 1 | \
 		grep ALLOC >/dev/null; then