From 6c1f257900c82ac5d08c821f12b30bfbb6c67736 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 28 Jan 2021 01:18:07 +0100 Subject: [PATCH] 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. --- .../hooks/post-install/06-strip-and-debug-pkgs.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/hooks/post-install/06-strip-and-debug-pkgs.sh b/common/hooks/post-install/06-strip-and-debug-pkgs.sh index b59dde5ab3c..d42c79b5c41 100644 --- a/common/hooks/post-install/06-strip-and-debug-pkgs.sh +++ b/common/hooks/post-install/06-strip-and-debug-pkgs.sh @@ -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}"