Use -xtype, and delay the removal to catch .la file symlinks as well.

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=436996
---
 gx86/eclass/eutils.eclass | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass
index 1657076..77f7b0c 100644
--- a/gx86/eclass/eutils.eclass
+++ b/gx86/eclass/eutils.eclass
@@ -1414,6 +1414,7 @@ prune_libtool_files() {
        done
 
        local f
+       local queue=()
        while IFS= read -r -d '' f; do # for all .la files
                local archivefile=${f/%.la/.a}
 
@@ -1423,7 +1424,7 @@ prune_libtool_files() {
                if grep -q '^shouldnotlink=yes$' "${f}"; then
                        if [[ -f ${archivefile} ]]; then
                                einfo "Removing unnecessary 
${archivefile#${D%/}} (static plugin)"
-                               rm -f "${archivefile}"
+                               queue+=( "${archivefile}" )
                        fi
 
                        # The .la file may be used by a module loader, so avoid 
removing it
@@ -1474,9 +1475,13 @@ prune_libtool_files() {
 
                if [[ ${reason} ]]; then
                        einfo "Removing unnecessary ${f#${D%/}} (${reason})"
-                       rm -f "${f}"
+                       queue+=( "${f}" )
                fi
-       done < <(find "${D}" -type f -name '*.la' -print0)
+       done < <(find "${D}" -xtype f -name '*.la' -print0)
+
+       if [[ ${queue[@]} ]]; then
+               rm -f "${queue[@]}"
+       fi
 }
 
 check_license() { die "you no longer need this as portage supports 
ACCEPT_LICENSE itself"; }
-- 
1.7.12


Reply via email to