From: Zac Medico <zmedico@gentoo.org>
Date: Mon, 10 Oct 2011 06:27:16 +0000 (-0700)
Subject: prepstrip: tweak style of debugedit checks
X-Git-Tag: v2.2.0_alpha65
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=aeced1ac893951aec4992b2a1af7a4d057d6ce24;p=portage.git

prepstrip: tweak style of debugedit checks

Make the checks more like the FEATURES/RESTRICT checks from commit
286675a500998e536dbbf2ee2dfe1fedf4290b38.
---

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index bd518430e..68b2133e3 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -36,9 +36,9 @@ type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=objcopy
 export SAFE_STRIP_FLAGS="--strip-unneeded"
 export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment}
 prepstrip_sources_dir=/usr/src/debug/${CATEGORY}/${PF}
-type -P debugedit >/dev/null
-debugedit_found=$?
-debugedit_warned=
+
+type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false
+debugedit_warned=false
 
 unset ${!INODE_*}
 
@@ -53,9 +53,9 @@ inode_var_name() {
 save_elf_sources() {
 	${FEATURES_installsources} || return 0
 	${RESTRICT_installsources} && return 0
-	if [ ${debugedit_found} -ne 0 ] ; then
-		if [ -z ${debugedit_warned} ] ; then
-			debugedit_warned=1
+	if ! ${debugedit_found} ; then
+		if ! ${debugedit_warned} ; then
+			debugedit_warned=true
 			ewarn "FEATURES=installsources is enabled but the debugedit binary could not"
 			ewarn "be found. This feature will not work unless debugedit is installed!"
 		fi
@@ -79,7 +79,7 @@ save_elf_debug() {
 	[[ ${x} == *".debug" ]] && return 0
 
 	# this will recompute the build-id, but for now that's ok
-	local buildid="$( [ ${debugedit_found} -eq 0 ] && debugedit -i "${x}" )"
+	local buildid="$( ${debugedit_found} && debugedit -i "${x}" )"
 
 	mkdir -p $(dirname "${y}")
 
@@ -191,7 +191,7 @@ done
 if [[ -s ${T}/debug.sources ]] && \
    ${FEATURES_installsources} && \
    ! ${RESTRICT_installsources} && \
-   [ ${debugedit_found} -eq 0 ]
+   ${debugedit_found}
 then
 	vecho "installsources: rsyncing source files"
 	[[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sources_dir}"