From 240c950eb8ca95e2dd5659b035037d075a5ba828 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 7 Jan 2009 00:41:33 +0000 Subject: Bug #252354 - Ensure that hardlinked files are not processed multiple times when necessary. svn path=/main/trunk/; revision=12385 --- bin/prepstrip | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/prepstrip b/bin/prepstrip index 143bd3da7..c9cb4c29f 100755 --- a/bin/prepstrip +++ b/bin/prepstrip @@ -30,12 +30,22 @@ if hasq installsources ${FEATURES} && ! type -P debugedit >/dev/null ; then ewarn "be found. This feature will not work unless debugedit is installed!" fi +inode_var_name() { + if [[ $USERLAND = BSD ]] ; then + stat -f 'INODE_%d_%i' "$1" + else + stat -c 'INODE_%d_%i' "$1" + fi +} + save_elf_sources() { hasq installsources ${FEATURES} || return 0 hasq installsources ${RESTRICT} && return 0 type -P debugedit >/dev/null || return 0 local x=$1 + local inode=$(inode_var_name "$x") + [[ -n ${!inode} ]] && return 0 local sources_dir=/usr/src/debug/${CATEGORY}/${PF} debugedit -b "${WORKDIR}" -d "${sources_dir}" \ -l "${T}"/debug.sources "${x}" @@ -60,11 +70,18 @@ save_elf_debug() { local buildid="$( type -P debugedit >/dev/null && debugedit -i "${x}" )" mkdir -p $(dirname "${y}") - ${OBJCOPY} --only-keep-debug "${x}" "${y}" - ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}" - [[ -g ${x} ]] && chmod go-r "${y}" - [[ -u ${x} ]] && chmod go-r "${y}" - chmod a-x,o-w "${y}" + + local inode=$(inode_var_name "$x") + if [[ -n ${!inode} ]] ; then + ln "${D}usr/lib/debug/${!inode:${#D}}.debug" "$y" + else + eval $inode=\"$x\" + ${OBJCOPY} --only-keep-debug "${x}" "${y}" + ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}" + [[ -g ${x} ]] && chmod go-r "${y}" + [[ -u ${x} ]] && chmod go-r "${y}" + chmod a-x,o-w "${y}" + fi if [[ -n ${buildid} ]] ; then local buildid_dir="${D}usr/lib/debug/.build-id/${buildid:0:2}" -- cgit v1.2.3-1-g7c22