[pacman-dev] [PATCH 4/9] Cleaned up and simplified tidy_install().

Andrew Fyfe andrew at neptune-one.net
Sun Apr 1 18:49:56 EDT 2007


Added 'LC_ALL= LANG=' to find commands for stripping symbols from binaries/libraries.
This stops the greps failing if LC_ALL or LANG != en_US|C|POSIX.

Signed-off-by: Andrew Fyfe <andrew at neptune-one.net>

diff --git a/scripts/makepkg.in b/scripts/makepkg.in
index 03d8eb1..e4af2a1 100755
--- a/scripts/makepkg.in
+++ b/scripts/makepkg.in
@@ -357,62 +357,60 @@ removedeps() {
 }
 
 tidy_install () {
+	cd "$startdir"/pkg
+	msg2 "$(gettext "Tidying install...")"
+
 	if [ "$(check_option docs)" = "n" ]; then
-		# remove info/doc files
-		msg "$(gettext "Removing info/doc files...")"
-		cd "$startdir/pkg"
+		msg2 "$(gettext "Removing info/doc files...")"
 		#fix flyspray bug #5021
 		rm -rf ${DOC_DIRS[@]}
 	fi
 
-	# move /usr/share/man files to /usr/man
-	if [ -d $startdir/pkg/usr/share/man ]; then
-		cd "$startdir"
-		mkdir -p pkg/usr/man 
-		cp -a pkg/usr/share/man/* pkg/usr/man/
-		rm -rf pkg/usr/share/man
+	if [ -d usr/share/man ]; then
+		msg2 "$(gettext "Moving usr/share/man files to usr/man")"
+		mkdir -p usr/man 
+		cp -a usr/share/man/* usr/man/
+		rm -rf usr/share/man
 	fi
 
-	# compress man pages
-	msg "$(gettext "Compressing man pages...")"
-	find "$startdir"/pkg/{usr{,/local},opt/*}/man -type f 2>/dev/null | while read i ; do
-		ext="${i##*.}"
-		fn="${i##*/}"
+	msg2 "$(gettext "Compressing man pages...")"
+	local manpage ext file link
+	find {usr{,/local},opt/*}/man -type f 2>/dev/null | while read manpage ; do
+		ext="${manpage##*.}"
+		fn="${manpage##*/}"
 		if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
 			# update symlinks to this manpage
-			find "$startdir"/pkg/{usr{,/local},opt/*}/man -lname "$fn" 2> /dev/null | while read ln ; do
-				rm -f "$ln"
-				ln -sf "${fn}.gz" "${ln}.gz"
+			find {usr{,/local},opt/*}/man -lname "$file" 2>/dev/null | while read link ; do
+				rm -f "$link"
+				ln -sf "${file}.gz" "${link}.gz"
 			done
 			# compress the original
-			gzip -9 "$i"
+			gzip -9 "$manpage"
 		fi
 	done
 
-	cd "$startdir"
-
-	# strip binaries
 	if [ "$(check_option strip)" = "y" ]; then
-		msg "$(gettext "Stripping debugging symbols from libraries...")"
+		msg2 "$(gettext "Stripping debugging symbols from libraries...")"
+		LC_ALL= LANG= \
+		find {.,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \
 		find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \
-		-exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \
-		| grep -v "No such file" | grep -v "format not recognized"
-		msg "$(gettext "Stripping symbols from binaries...")"
-		find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name "*.dll" -not -name "*.exe" \
-		-exec /usr/bin/strip '{}' \; 2>&1 \
-		| grep -v "No such file" | grep -v "format not recognized"
+			-exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \
+			| grep -v "No such file" | grep -v "format not recognized"
+
+		msg2 "$(gettext "Stripping symbols from binaries...")"
+		LC_ALL= LANG= \
+		find {.,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name "*.dll" -not -name "*.exe" \
+			-exec /usr/bin/strip '{}' \; 2>&1 \
+			| grep -v "No such file" | grep -v "format not recognized"
 	fi
 
-	# remove libtool (.la) files
 	if [ "$(check_option libtool)" = "n" ]; then
-		msg "$(gettext "Removing libtool .la files...")"
-		find pkg -type f -name "*.la" -exec rm -f -- '{}' \;
+		msg2 "$(gettext "Removing libtool .la files...")"
+		find -type f -name "*.la" -exec rm -f -- '{}' \;
 	fi
 
-	# remove empty directories
 	if [ "$(check_option emptydirs)" = "n" ]; then
-		msg "$(gettext "Removing empty directories...")"
-		cd "$startdir/pkg"
+		msg2 "$(gettext "Removing empty directories...")"
 		find -depth -type d -empty -delete;
 	fi
 }
-- 
1.5.0.6





More information about the pacman-dev mailing list