diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-04-11 16:23:54 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-04-13 00:50:45 -0700 |
commit | 8923329bfbfc0c1f6b574c581b5c937b475eaff9 (patch) | |
tree | 6ae3737743e703cb898f846d3701c82146837c82 /bin | |
parent | a7d6cd56bbb00d5c219ae8d9b00f480975684118 (diff) | |
download | portage-8923329bfbfc0c1f6b574c581b5c937b475eaff9.tar.gz portage-8923329bfbfc0c1f6b574c581b5c937b475eaff9.tar.bz2 portage-8923329bfbfc0c1f6b574c581b5c937b475eaff9.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.
Diffstat (limited to 'bin')
-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 $? |