[Rpm-maint] [rpm-software-management/rpm] scripts/brp-strip: Rectify parallel stripping logic (PR #2161)

Panu Matilainen notifications at github.com
Fri Sep 2 04:49:49 UTC 2022


@pmatilai commented on this pull request.



> +# Only operate on non-stripped binaries
+find "$RPM_BUILD_ROOT" -type f \
+  ! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" \
+  ! -name "*.go" -links 1 -print0 | \
+  xargs -0 -r -P${NCPUS} -n${MAX_ARGS} sh -c "file \"\$@\" | \
+  sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped.*/\1/p' | \
+  grep -v 'no machine' | \
+  xargs -I\{\} $STRIP -g \{\}" ARG0
+
+# Same as above but for files with more than 1 link
+for f in $(find "$RPM_BUILD_ROOT" -type f \
+          ! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" \
+          ! -name "*.go" -links +1 -exec file {} \; | \
+          sed -n -e 's/^\(.*\):[  ]*ELF.*, not stripped.*/\1/p' | \
+          grep -v 'no machine'); do
+  $STRIP -g "$f" || :

The two commands now differ fundamentally, the latter being subject to issues with whitespace in filenames etc and any change to the logic now needs to be done twice, to a different command, one of which doesn't trigger at all for most packages. Which is a recipe for problems.
 
Put the parallel-aware command into a function which takes the limits as arguments, and never mind that non-parallel run will be slightly more complicated than it strictly needs to be. The calling would then look basically like this:

```
strip_files 1 ${NCPUS}
strip_files +1 1
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2161#pullrequestreview-1094306014
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2161/review/1094306014 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220901/b964e07f/attachment.html>


More information about the Rpm-maint mailing list