From: Zac Medico Date: Mon, 11 Apr 2011 23:23:54 +0000 (-0700) Subject: doins: dereference abs symlinks to files X-Git-Tag: v2.2.0_alpha30~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2e334d77e3d1836ab6ba5dfc1700e90f9599d4d3;p=portage.git 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 for reporting this issue which he observed with the sci-mathematics/minisat ebuild. --- 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 $?