diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-01-07 00:41:33 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-01-07 00:41:33 +0000 |
commit | 240c950eb8ca95e2dd5659b035037d075a5ba828 (patch) | |
tree | 7b121220330c363643265817e974b4801d8bcc2f | |
parent | fa8a4c3afbe528c1f479b73efa25b269424f0283 (diff) | |
download | portage-240c950eb8ca95e2dd5659b035037d075a5ba828.tar.gz portage-240c950eb8ca95e2dd5659b035037d075a5ba828.tar.bz2 portage-240c950eb8ca95e2dd5659b035037d075a5ba828.zip |
Bug #252354 - Ensure that hardlinked files are not processed multiple times
when necessary.
svn path=/main/trunk/; revision=12385
-rwxr-xr-x | bin/prepstrip | 27 |
1 files changed, 22 insertions, 5 deletions
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}" |