diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-04-11 16:23:54 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-04-11 16:23:54 -0700 |
commit | 2e334d77e3d1836ab6ba5dfc1700e90f9599d4d3 (patch) | |
tree | 38552b608c5423028d4eb58c4fbb36c2d88fb6fa | |
parent | d7dbb7e0f266bb24ab284a1e66d66e6a145d0901 (diff) | |
download | portage-2e334d77e3d1836ab6ba5dfc1700e90f9599d4d3.tar.gz portage-2e334d77e3d1836ab6ba5dfc1700e90f9599d4d3.tar.bz2 portage-2e334d77e3d1836ab6ba5dfc1700e90f9599d4d3.zip |
doins: dereference abs symlinks to files
Our fake $DISTDIR contains symlinks that should not be reproduced
inside $D. In order to ensure that things like dodoc
"$DISTDIR"/foo.pdf work as expected, we dereference symlinked files
that are referenced by absolute paths. Thanks to James Cloos
<cloos@jhcloos.com> for reporting this issue which he observed with
the sci-mathematics/minisat ebuild.
-rwxr-xr-x | bin/ebuild-helpers/doins | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins index 0aedcb9e5..3daa9a01a 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -55,7 +55,13 @@ _doins() { local mysrc="$1" mydir="$2" cleanup="" rval if [ -L "$mysrc" ] ; then - if [ $PRESERVE_SYMLINKS = y ] ; then + # Our fake $DISTDIR contains symlinks that should + # not be reproduced inside $D. In order to ensure + # that things like dodoc "$DISTDIR"/foo.pdf work + # as expected, we dereference symlinked files that + # are referenced by absolute paths. + if [ $PRESERVE_SYMLINKS = y ] && \ + ! [[ -f "$mysrc" && $(readlink "$mysrc") == /* ]] ; then rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $? cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}" return $? |