chantra / rpms / rpm

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