Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Development (http://www.linux-archive.org/gentoo-development/)
-   -   prune_libtool_files(): correctly remove symlinks. (http://www.linux-archive.org/gentoo-development/709451-prune_libtool_files-correctly-remove-symlinks.html)

Michał Górny 10-03-2012 10:33 PM

prune_libtool_files(): correctly remove symlinks.
 
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


All times are GMT. The time now is 05:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.