summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-08-01 16:48:07 -0700
committerZac Medico <zmedico@gentoo.org>2011-08-01 16:48:07 -0700
commit75a0cce2b6d7ecb8f369a65fbb047e3ce9d96b44 (patch)
treedb5eb2be308eb801e7a2f73e8dd4d94549994a9b
parentc72376156311ffa96a5d130bd8b0a207b3fc9ceb (diff)
downloadportage-75a0cce2b6d7ecb8f369a65fbb047e3ce9d96b44.tar.gz
portage-75a0cce2b6d7ecb8f369a65fbb047e3ce9d96b44.tar.bz2
portage-75a0cce2b6d7ecb8f369a65fbb047e3ce9d96b44.zip
unpack: always unpack to cwd (bug #376741)
This brings portage into agreement with PMS. Also, for existing EAPIs, if the source file is in a writable directory then this will create a symlink for backward-compatible emulation of tools like gunzip and bunzip2.
-rwxr-xr-xbin/ebuild.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 4aef4134d..3d4d5576a 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -370,7 +370,21 @@ unpack() {
$1 -c -- "$srcdir$x" | tar xof -
assert_sigpipe_ok "$myfail"
else
- $1 -c -- "${srcdir}${x}" > ${x%.*} || die "$myfail"
+ local cwd_dest=${x##*/}
+ cwd_dest=${cwd_dest%.*}
+ $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail"
+ case "$EAPI" in
+ 0|1|2|3|4|4-python)
+ # If the source file is in a writable directory then
+ # create a symlink for backward-compatible emulation
+ # of tools like gunzip and bunzip2 (see bug #376741).
+ if [[ ! -e ${x%.*} && -w ${x%/*} ]] && \
+ [[ ${x} == "${PORTAGE_BUILDDIR}/"* ||
+ ${x} == ./* || ${x} != /* ]] ; then
+ ln -snf "${PWD}/${cwd_dest}" "${x%.*}"
+ fi
+ ;;
+ esac
fi
}