richardphibel / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
f6faf3
From 1fd84fa0cfa6e493d1c15edfb7d9f0bb05e4f920 Mon Sep 17 00:00:00 2001
f6faf3
From: Florian Festi <ffesti@redhat.com>
f6faf3
Date: Thu, 2 May 2019 17:17:56 +0200
f6faf3
Subject: [PATCH] Fix brp-strip-static-archive parallelism
f6faf3
f6faf3
The change made in fc2c986 can break for large values of %_smp_build_ncpus as
f6faf3
this many processes are able to overflow the following pipe.
f6faf3
f6faf3
Thanks to Denys Vlasenko for testing this.
f6faf3
f6faf3
This change solves this problem by running a whole processing pileline for each
f6faf3
parallel (file) process. This has also the benefit of running at least some
f6faf3
stip commands in parallel.
f6faf3
f6faf3
The -n param fro xargs was increased to 32 to further reduce the over head of
f6faf3
spawing the helpers as they are now needed for each run of the file command.
f6faf3
---
f6faf3
 scripts/brp-strip-static-archive | 10 +++-------
f6faf3
 1 file changed, 3 insertions(+), 7 deletions(-)
f6faf3
f6faf3
diff --git a/scripts/brp-strip-static-archive b/scripts/brp-strip-static-archive
f6faf3
index 4dc449061..13d9a098b 100755
f6faf3
--- a/scripts/brp-strip-static-archive
f6faf3
+++ b/scripts/brp-strip-static-archive
f6faf3
@@ -13,10 +13,6 @@ Darwin*) exit 0 ;;
f6faf3
 esac
f6faf3
 
f6faf3
 # Strip static libraries.
f6faf3
-for f in `find "$RPM_BUILD_ROOT" -type f | \
f6faf3
-	grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
f6faf3
-	xargs -r -P$NCPUS -n16 file | sed 's/:  */: /' | \
f6faf3
-	grep 'current ar archive' | \
f6faf3
-	sed -n -e 's/^\(.*\):[  ]*current ar archive/\1/p'`; do
f6faf3
-	$STRIP -g "$f"
f6faf3
-done
f6faf3
+find "$RPM_BUILD_ROOT" -type f | \
f6faf3
+    grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
f6faf3
+    xargs -r -P$NCPUS -n32 sh -c "file \"\$@\" | sed 's/:  */: /' | grep 'current ar archive' | sed -n -e 's/^\(.*\):[  ]*current ar archive/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0
f6faf3
-- 
f6faf3
2.21.0
f6faf3