hooks/post-install/06-strip-and-debug-pkgs.sh: speed up.

Only run file once for each file in the destdir, only double-check
when we are about to strip the ELF files.
This commit is contained in:
Leah Neukirchen 2021-01-28 01:18:07 +01:00
parent 6ecbbf767a
commit 210b461028
1 changed files with 8 additions and 5 deletions

View File

@ -70,10 +70,6 @@ hook() {
continue
fi
if [[ $(file -b "$f") =~ "no machine" ]]; then
continue
fi
fname=${f##*/}
for x in ${nostrip_files}; do
if [ "$x" = "$fname" ]; then
@ -119,6 +115,13 @@ hook() {
fi
;;
application/x-sharedlib*|application/x-pie-executable*)
local type="$(file -b "$f")"
if [[ $type =~ "no machine" ]]; then
# using ELF as a container format (e.g. guile)
echo " Ignoring ELF file without machine set: ${f#$PKGDESTDIR}"
continue
fi
chmod +w "$f"
# shared library
make_debug "$f"
@ -127,7 +130,7 @@ hook() {
msg_red "$pkgver: failed to strip ${f#$PKGDESTDIR}\n"
return 1
fi
if [[ $(file $f) =~ "interpreter " ]]; then
if [[ $type =~ "interpreter " ]]; then
echo " Stripped position-independent executable: ${f#$PKGDESTDIR}"
else
echo " Stripped library: ${f#$PKGDESTDIR}"