Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: reavertm@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH autotools-utils 4/9] Clean up & simplify la removal code a little.
Date: Tue, 13 Sep 2011 14:12:58
Message-Id: 1315923033-23397-4-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH autotools-utils 1/9] Fix handling whitespace in filenames when looking for .la files. by "Michał Górny"
1 ---
2 eclass/autotools-utils.eclass | 11 +++++------
3 1 files changed, 5 insertions(+), 6 deletions(-)
4
5 diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
6 index ab8650f..fd644bb 100644
7 --- a/eclass/autotools-utils.eclass
8 +++ b/eclass/autotools-utils.eclass
9 @@ -149,21 +149,20 @@ remove_libtool_files() {
10 find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do
11 local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}")
12 local archivefile=${f/%.la/.a}
13 + [[ "${f}" != "${archivefile}" ]] || die 'regex sanity check failed'
14
15 # Keep .la files when:
16 # - they have shouldnotlink=yes - likely plugins,
17 # - respective static archive exists.
18 if [[ "$1" == 'all' || ( -z ${shouldnotlink} && ! -f ${archivefile} ) ]]; then
19 einfo "Removing unnecessary ${f#${D%/}}"
20 - rm -f "${f}"
21 + rm -f "${f}" || die
22 fi
23
24 # Remove static libs we're not supposed to link against
25 - if [[ -n ${shouldnotlink} ]]; then
26 - local remove=${f/%.la/.a}
27 - [[ "${f}" != "${remove}" ]] || die 'regex sanity check failed'
28 - einfo "Removing unnecessary ${remove#${D%/}}"
29 - rm -f "${remove}"
30 + if [[ ${shouldnotlink} ]]; then
31 + einfo "Removing unnecessary ${archivefile#${D%/}}"
32 + rm -f "${archivefile}" || die
33 fi
34 done
35 }
36 --
37 1.7.6.1