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"
---
 eclass/autotools-utils.eclass |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
index ab8650f..fd644bb 100644
--- a/eclass/autotools-utils.eclass
+++ b/eclass/autotools-utils.eclass
@@ -149,21 +149,20 @@ remove_libtool_files() {
 	find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do
 		local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}")
 		local archivefile=${f/%.la/.a}
+		[[ "${f}" != "${archivefile}" ]] || die 'regex sanity check failed'
 
 		# Keep .la files when:
 		# - they have shouldnotlink=yes - likely plugins,
 		# - respective static archive exists.
 		if [[ "$1" == 'all' || ( -z ${shouldnotlink} && ! -f ${archivefile} ) ]]; then
 			einfo "Removing unnecessary ${f#${D%/}}"
-			rm -f "${f}"
+			rm -f "${f}" || die
 		fi
 
 		# Remove static libs we're not supposed to link against
-		if [[ -n ${shouldnotlink} ]]; then
-			local remove=${f/%.la/.a}
-			[[ "${f}" != "${remove}" ]] || die 'regex sanity check failed'
-			einfo "Removing unnecessary ${remove#${D%/}}"
-			rm -f "${remove}"
+		if [[ ${shouldnotlink} ]]; then
+			einfo "Removing unnecessary ${archivefile#${D%/}}"
+			rm -f "${archivefile}" || die
 		fi
 	done
 }
-- 
1.7.6.1