summaryrefslogtreecommitdiffstats
path: root/bin/ebuild-helpers/doins
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-10-17 21:20:34 +0000
committerZac Medico <zmedico@gentoo.org>2009-10-17 21:20:34 +0000
commit630489db115d06de12dfcfb0d9f81a11dfbc6b08 (patch)
treec9955fad4dfb086dd87f6797256a569e6328d57a /bin/ebuild-helpers/doins
parent55cd5a52e0101676a46d2e8fbff4eff11ae2b73c (diff)
downloadportage-630489db115d06de12dfcfb0d9f81a11dfbc6b08.tar.gz
portage-630489db115d06de12dfcfb0d9f81a11dfbc6b08.tar.bz2
portage-630489db115d06de12dfcfb0d9f81a11dfbc6b08.zip
Bug #273636 - Add doins and newins support for symlink preservation in
EAPI 3. Thanks to Jonathan Callen <abcd@g.o> for the initial patch (I added EAPI conditionals in order to share code between all EAPIs). svn path=/main/trunk/; revision=14625
Diffstat (limited to 'bin/ebuild-helpers/doins')
-rwxr-xr-xbin/ebuild-helpers/doins26
1 files changed, 21 insertions, 5 deletions
diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 82f0bf3b6..b5f00e8d8 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2007 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
@@ -25,6 +25,15 @@ if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
exit 1
fi
+case "$EAPI" in
+ 0|1|2)
+ PRESERVE_SYMLINKS=n
+ ;;
+ *)
+ PRESERVE_SYMLINKS=y
+ ;;
+esac
+
export TMP=$T/.doins_tmp
# Use separate directories to avoid potential name collisions.
mkdir -p "$TMP"/{1,2}
@@ -35,9 +44,15 @@ _doins() {
local mysrc="$1" mydir="$2" cleanup="" rval
if [ -L "$mysrc" ] ; then
- cp "$mysrc" "$TMP/2"
- mysrc="$TMP/2/${mysrc##*/}"
- cleanup=${mysrc}
+ if [ $PRESERVE_SYMLINKS = y ] ; then
+ rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
+ cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}"
+ return $?
+ else
+ cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $?
+ mysrc="$TMP/2/${mysrc##*/}"
+ cleanup=$mysrc
+ fi
fi
install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}"
@@ -56,7 +71,8 @@ _xdoins() {
success=0
for x in "$@" ; do
- if [ -d "$x" ] ; then
+ if [[ $PRESERVE_SYMLINKS = n && -d $x ]] || \
+ [[ $PRESERVE_SYMLINKS = y && -d $x && ! -L $x ]] ; then
if [ "${DOINSRECUR}" == "n" ] ; then
continue
fi