From 13a759213ec1fefe5e637e5467fe9d5f35d8f570 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 9 Oct 2011 23:04:33 -0700 Subject: [PATCH] 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. --- bin/ebuild-helpers/prepstrip | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index e22f417cb..bd518430e 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -36,6 +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= unset ${!INODE_*} @@ -50,9 +53,12 @@ inode_var_name() { 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 @@ save_elf_debug() { [[ ${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 @@ done 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}" -- 2.26.2