Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH eutils 1/2] prune_libtool_files(): correctly remove symlinks.
Date: Wed, 03 Oct 2012 22:39:57
Message-Id: 1349303592-25204-1-git-send-email-mgorny@gentoo.org
1 Use -xtype, and delay the removal to catch .la file symlinks as well.
2
3 Fixes: https://bugs.gentoo.org/show_bug.cgi?id=436996
4 ---
5 gx86/eclass/eutils.eclass | 11 ++++++++---
6 1 file changed, 8 insertions(+), 3 deletions(-)
7
8 diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass
9 index 1657076..77f7b0c 100644
10 --- a/gx86/eclass/eutils.eclass
11 +++ b/gx86/eclass/eutils.eclass
12 @@ -1414,6 +1414,7 @@ prune_libtool_files() {
13 done
14
15 local f
16 + local queue=()
17 while IFS= read -r -d '' f; do # for all .la files
18 local archivefile=${f/%.la/.a}
19
20 @@ -1423,7 +1424,7 @@ prune_libtool_files() {
21 if grep -q '^shouldnotlink=yes$' "${f}"; then
22 if [[ -f ${archivefile} ]]; then
23 einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)"
24 - rm -f "${archivefile}"
25 + queue+=( "${archivefile}" )
26 fi
27
28 # The .la file may be used by a module loader, so avoid removing it
29 @@ -1474,9 +1475,13 @@ prune_libtool_files() {
30
31 if [[ ${reason} ]]; then
32 einfo "Removing unnecessary ${f#${D%/}} (${reason})"
33 - rm -f "${f}"
34 + queue+=( "${f}" )
35 fi
36 - done < <(find "${D}" -type f -name '*.la' -print0)
37 + done < <(find "${D}" -xtype f -name '*.la' -print0)
38 +
39 + if [[ ${queue[@]} ]]; then
40 + rm -f "${queue[@]}"
41 + fi
42 }
43
44 check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; }
45 --
46 1.7.12

Replies