diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-05-14 13:53:36 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-05-14 15:02:38 -0700 |
commit | ad944275b88a50d2a1f694826b127cceb9221e78 (patch) | |
tree | b28cd42cb9b768cd2645fed0ef45383a0edd984f | |
parent | 4941c3c674400116f118a9c75b520c3fd1a25490 (diff) | |
download | portage-ad944275b88a50d2a1f694826b127cceb9221e78.tar.gz portage-ad944275b88a50d2a1f694826b127cceb9221e78.tar.bz2 portage-ad944275b88a50d2a1f694826b127cceb9221e78.zip |
prepstrip: fix hardlink handling for subshells
-rwxr-xr-x | bin/ebuild-helpers/prepstrip | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index a58a83b87..6f2c742cc 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -67,16 +67,15 @@ multijob_init # Setup $T filesystem layout that we care about. tmpdir="${T}/prepstrip" rm -rf "${tmpdir}" -mkdir -p "${tmpdir}"/{splitdebug,sources} - -unset ${!INODE_*} +mkdir -p "${tmpdir}"/{inodes,splitdebug,sources} # Usage: inode_var_name: <file> -inode_var_name() { +inode_file_link() { + echo -n "${tmpdir}/inodes/" if [[ ${USERLAND} == "BSD" ]] ; then - stat -f 'INODE_%d_%i' "$1" + stat -f '%i' "$1" else - stat -c 'INODE_%d_%i' "$1" + stat -c '%i' "$1" fi } @@ -94,8 +93,7 @@ save_elf_sources() { fi local x=$1 - local inode=$(inode_var_name "${x}") - [[ -n ${!inode} ]] && return 0 + [[ -f $(inode_file_link "${x}") ]] && return 0 # since we're editing the ELF here, we should recompute the build-id # (the -i flag below). save that output so we don't need to recompute @@ -124,11 +122,10 @@ save_elf_debug() { mkdir -p "${y%/*}" - local inode=$(inode_var_name "${x}") - if [[ -n ${!inode} ]] ; then - ln "${ED}usr/lib/debug/${!inode:${#D}}.debug" "${y}" + local inode=$(inode_file_link "${x}") + if [[ -f ${inode} ]] ; then + ln "${inode}" "${y}" else - eval ${inode}=\${x} if [[ -n ${splitdebug} ]] ; then mv "${splitdebug}" "${y}" else @@ -140,6 +137,12 @@ save_elf_debug() { local args="a-x,o-w" [[ -g ${x} || -u ${x} ]] && args+=",go-r" chmod ${args} "${y}" + if ! ln "${y}" "${inode}" ; then + # This means a parallel process has already created the + # inode link. So, replace ${y} with a link to that inode. + rm -f "${y}" + ln "${inode}" "${y}" + fi fi # if we don't already have build-id from debugedit, look it up @@ -304,3 +307,5 @@ then >> "${emptydir}"/.keepdir done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0) fi + +rm -rf "${tmpdir}" |