prepstrip: merge debugedit checks more

Use a ${debugedit_found} to remember if it's found or not, and use
${debugedit_warned} to avoid showing duplicate warnings.
diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index e22f417..bd51843 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -36,6 +36,9 @@
 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=
 
 unset ${!INODE_*}
 
@@ -50,9 +53,12 @@
 save_elf_sources() {
 	${FEATURES_installsources} || return 0
 	${RESTRICT_installsources} && return 0
-	if ! type -P debugedit >/dev/null ; then
-		ewarn "FEATURES=installsources is enabled but the debugedit binary could not"
-		ewarn "be found. This feature will not work unless debugedit is installed!"
+	if [ ${debugedit_found} -ne 0 ] ; then
+		if [ -z ${debugedit_warned} ] ; then
+			debugedit_warned=1
+			ewarn "FEATURES=installsources is enabled but the debugedit binary could not"
+			ewarn "be found. This feature will not work unless debugedit is installed!"
+		fi
 		return 0
 	fi
 
@@ -73,7 +79,7 @@
 	[[ ${x} == *".debug" ]] && return 0
 
 	# this will recompute the build-id, but for now that's ok
-	local buildid="$( type -P debugedit >/dev/null && debugedit -i "${x}" )"
+	local buildid="$( [ ${debugedit_found} -eq 0 ] && debugedit -i "${x}" )"
 
 	mkdir -p $(dirname "${y}")
 
@@ -185,7 +191,7 @@
 if [[ -s ${T}/debug.sources ]] && \
    ${FEATURES_installsources} && \
    ! ${RESTRICT_installsources} && \
-   type -P debugedit >/dev/null
+   [ ${debugedit_found} -eq 0 ]
 then
 	vecho "installsources: rsyncing source files"
 	[[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sources_dir}"