From 8923329bfbfc0c1f6b574c581b5c937b475eaff9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 11 Apr 2011 16:23:54 -0700 Subject: 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. --- bin/ebuild-helpers/doins | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 $? -- cgit v1.2.3-1-g7c22