public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, pym/portage/tests/emerge/, bin/
@ 2011-11-02  2:17 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2011-11-02  2:17 UTC (permalink / raw
  To: gentoo-commits

commit:     1af0c40b1300651ca03a7509f49f152c1e595736
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  2 02:17:19 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Nov  2 02:17:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1af0c40b

Add EPREFIX and ED support in all ebuild helpers.

This allows our prefix tests to use helpers like insinto, doins, and dosym.

---
 bin/dohtml.py                           |   12 ++-
 bin/ebuild-helpers/dobin                |    8 +-
 bin/ebuild-helpers/dodir                |    6 +-
 bin/ebuild-helpers/dodoc                |    4 +-
 bin/ebuild-helpers/doexe                |   10 ++-
 bin/ebuild-helpers/dohard               |    8 +-
 bin/ebuild-helpers/doinfo               |   10 ++-
 bin/ebuild-helpers/doins                |   16 ++--
 bin/ebuild-helpers/dolib                |    6 +-
 bin/ebuild-helpers/doman                |    8 +-
 bin/ebuild-helpers/domo                 |   11 ++-
 bin/ebuild-helpers/dosbin               |   10 ++-
 bin/ebuild-helpers/dosed                |    8 +-
 bin/ebuild-helpers/dosym                |   10 ++-
 bin/ebuild-helpers/ecompressdir         |   26 ++++---
 bin/ebuild-helpers/fowners              |    6 +-
 bin/ebuild-helpers/fperms               |    5 +-
 bin/ebuild-helpers/prepall              |   10 ++-
 bin/ebuild-helpers/prepalldocs          |    7 +-
 bin/ebuild-helpers/prepallinfo          |    6 +-
 bin/ebuild-helpers/prepallman           |    6 +-
 bin/ebuild-helpers/prepallstrip         |    6 +-
 bin/ebuild-helpers/prepinfo             |    8 +-
 bin/ebuild-helpers/preplib              |    8 +-
 bin/ebuild-helpers/prepman              |   10 ++-
 bin/ebuild-helpers/prepstrip            |   26 ++++---
 bin/ebuild.sh                           |    8 +-
 bin/misc-functions.sh                   |  124 ++++++++++++++++++-------------
 bin/phase-functions.sh                  |    9 ++-
 bin/phase-helpers.sh                    |   81 ++++++++++++--------
 pym/portage/tests/emerge/test_simple.py |   24 ++++--
 31 files changed, 299 insertions(+), 198 deletions(-)

diff --git a/bin/dohtml.py b/bin/dohtml.py
index 00258ec..122daf3 100755
--- a/bin/dohtml.py
+++ b/bin/dohtml.py
@@ -56,9 +56,9 @@ def install(basename, dirname, options, prefix=""):
 		fullpath = dirname + "/" + fullpath
 
 	if options.DOCDESTTREE:
-		destdir = options.D + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix
+		destdir = options.ED + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix
 	else:
-		destdir = options.D + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix
+		destdir = options.ED + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix
 
 	if not os.path.exists(fullpath):
 		sys.stderr.write("!!! dohtml: %s does not exist\n" % fullpath)
@@ -86,13 +86,15 @@ def install(basename, dirname, options, prefix=""):
 class OptionsClass:
 	def __init__(self):
 		self.PF = ""
-		self.D = ""
+		self.ED = ""
 		self.DOCDESTTREE = ""
 		
 		if "PF" in os.environ:
 			self.PF = os.environ["PF"]
-		if "D" in os.environ:
-			self.D = os.environ["D"]
+		if os.environ.get("EAPI", "0") in ("0", "1", "2"):
+			self.ED = os.environ.get("D", "")
+		else:
+			self.ED = os.environ.get("ED", "")
 		if "_E_DOCDESTTREE_" in os.environ:
 			self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"]
 		

diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index e385455..af3af0d 100755
--- a/bin/ebuild-helpers/dobin
+++ b/bin/ebuild-helpers/dobin
@@ -9,15 +9,17 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-if [[ ! -d ${D}${DESTTREE}/bin ]] ; then
-	install -d "${D}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${D}${DESTTREE}/bin"; exit 2; }
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then
+	install -d "${ED}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; }
 fi
 
 ret=0
 
 for x in "$@" ; do
 	if [[ -e ${x} ]] ; then
-		install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/bin"
+		install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/bin"
 	else
 		echo "!!! ${0##*/}: $x does not exist" 1>&2
 		false

diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
index f40bee7..7db7caf 100755
--- a/bin/ebuild-helpers/dodir
+++ b/bin/ebuild-helpers/dodir
@@ -1,10 +1,12 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
-install -d ${DIROPTIONS} "${@/#/${D}/}"
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+install -d ${DIROPTIONS} "${@/#/${ED}/}"
 ret=$?
 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 65713db..37bbc79 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -9,7 +9,9 @@ if [ $# -lt 1 ] ; then
 	exit 1 	
 fi
 
-dir="${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
 if [ ! -d "${dir}" ] ; then
 	install -d "${dir}"
 fi

diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index 360800e..a5b9af0 100755
--- a/bin/ebuild-helpers/doexe
+++ b/bin/ebuild-helpers/doexe
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,8 +9,10 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then
-	install -d "${D}${_E_EXEDESTTREE_}"
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
+	install -d "${ED}${_E_EXEDESTTREE_}"
 fi
 
 TMP=$T/.doexe_tmp
@@ -29,7 +31,7 @@ for x in "$@" ; do
 		mysrc="${x}"
 	fi
 	if [ -e "$mysrc" ] ; then
-		install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_"
+		install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_"
 	else
 		echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
 		false

diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard
index 2270487..cf6fb11 100755
--- a/bin/ebuild-helpers/dohard
+++ b/bin/ebuild-helpers/dohard
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2007 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 if [[ $# -ne 2 ]] ; then
@@ -7,7 +7,9 @@ if [[ $# -ne 2 ]] ; then
 	exit 1
 fi
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 destdir=${2%/*}
-[[ ! -d ${D}${destdir} ]] && dodir "${destdir}"
+[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
 
-exec ln -f "${D}$1" "${D}$2"
+exec ln -f "${ED}$1" "${ED}$2"

diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
index 54fb8da..a922ef1 100755
--- a/bin/ebuild-helpers/doinfo
+++ b/bin/ebuild-helpers/doinfo
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,11 +9,13 @@ if [[ -z $1 ]] ; then
 	exit 1 	
 fi
 
-if [[ ! -d ${D}usr/share/info ]] ; then
-	install -d "${D}usr/share/info" || { helpers_die "${0##*/}: failed to install ${D}usr/share/info"; exit 1; }
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}usr/share/info ]] ; then
+	install -d "${ED}usr/share/info" || { helpers_die "${0##*/}: failed to install ${ED}usr/share/info"; exit 1; }
 fi
 
-install -m0644 "$@" "${D}usr/share/info"
+install -m0644 "$@" "${ED}usr/share/info"
 rval=$?
 if [ $rval -ne 0 ] ; then
 	for x in "$@" ; do

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 7dec146..b9189d5 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -27,12 +27,14 @@ else
 	DOINSRECUR=n
 fi
 
-if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
+case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
+
+if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
 	vecho "-------------------------------------------------------" 1>&2
-	vecho "You should not use \${D} with helpers." 1>&2
+	vecho "You should not use \${D} or \${ED} with helpers." 1>&2
 	vecho "  --> ${INSDESTTREE}" 1>&2
 	vecho "-------------------------------------------------------" 1>&2
-	helpers_die "${0##*/} used with \${D}"
+	helpers_die "${0##*/} used with \${D} or \${ED}"
 	exit 1
 fi
 
@@ -49,7 +51,7 @@ export TMP=$T/.doins_tmp
 # Use separate directories to avoid potential name collisions.
 mkdir -p "$TMP"/{1,2}
 
-[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
+[[ ! -d ${ED}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
 
 _doins() {
 	local mysrc="$1" mydir="$2" cleanup="" rval
@@ -63,8 +65,8 @@ _doins() {
 		# $PORTAGE_ACTUAL_DISTDIR/.
 		if [ $PRESERVE_SYMLINKS = y ] && \
 			! [[ $(readlink "$mysrc") == "$PORTAGE_ACTUAL_DISTDIR"/* ]] ; then
-			rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
-			cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}"
+			rm -rf "${ED}$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
+			cp -P "$mysrc" "${ED}$INSDESTTREE/$mydir/${mysrc##*/}"
 			return $?
 		else
 			cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $?
@@ -73,7 +75,7 @@ _doins() {
 		fi
 	fi
 
-	install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}"
+	install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}"
 	rval=$?
 	[[ -n ${cleanup} ]] && rm -f "${cleanup}"
 	[ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2

diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index 87ade42..9dd11d8 100755
--- a/bin/ebuild-helpers/dolib
+++ b/bin/ebuild-helpers/dolib
@@ -1,9 +1,11 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 # Setup ABI cruft
 LIBDIR_VAR="LIBDIR_${ABI}"
 if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
@@ -12,7 +14,7 @@ fi
 unset LIBDIR_VAR
 # we need this to default to lib so that things dont break
 CONF_LIBDIR=${CONF_LIBDIR:-lib}
-libdir="${D}${DESTTREE}/${CONF_LIBDIR}"
+libdir="${ED}${DESTTREE}/${CONF_LIBDIR}"
 
 
 if [[ $# -lt 1 ]] ; then

diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
index 4561bef..27401f3 100755
--- a/bin/ebuild-helpers/doman
+++ b/bin/ebuild-helpers/doman
@@ -9,6 +9,8 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 i18n=""
 
 ret=0
@@ -44,11 +46,11 @@ for x in "$@" ; do
 
 	if [[ ${mandir} == *man[0-9n] ]] ; then
 		if [[ -s ${x} ]] ; then
-			if [[ ! -d ${D}/usr/share/man/${mandir} ]] ; then
-				install -d "${D}/usr/share/man/${mandir}"
+			if [[ ! -d ${ED}/usr/share/man/${mandir} ]] ; then
+				install -d "${ED}/usr/share/man/${mandir}"
 			fi
 
-			install -m0644 "${x}" "${D}/usr/share/man/${mandir}/${name}"
+			install -m0644 "${x}" "${ED}/usr/share/man/${mandir}/${name}"
 			((ret|=$?))
 		elif [[ ! -e ${x} ]] ; then
 			echo "!!! ${0##*/}: $x does not exist" 1>&2

diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
index 4737f44..0e3656d 100755
--- a/bin/ebuild-helpers/domo
+++ b/bin/ebuild-helpers/domo
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,8 +9,11 @@ if [ ${mynum} -lt 1 ] ; then
 	helpers_die "${0}: at least one argument needed"
 	exit 1
 fi
-if [ ! -d "${D}${DESTTREE}/share/locale" ] ; then
-	install -d "${D}${DESTTREE}/share/locale/"
+
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
+	install -d "${ED}${DESTTREE}/share/locale/"
 fi
 
 ret=0
@@ -18,7 +21,7 @@ ret=0
 for x in "$@" ; do
 	if [ -e "${x}" ] ; then
 		mytiny="${x##*/}"
-		mydir="${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES"
+		mydir="${ED}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES"
 		if [ ! -d "${mydir}" ] ; then
 			install -d "${mydir}"
 		fi

diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin
index 87a3091..d0783ed 100755
--- a/bin/ebuild-helpers/dosbin
+++ b/bin/ebuild-helpers/dosbin
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,15 +9,17 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then
-	install -d "${D}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${D}${DESTTREE}/sbin"; exit 2; }
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then
+	install -d "${ED}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; }
 fi
 
 ret=0
 
 for x in "$@" ; do
 	if [[ -e ${x} ]] ; then
-		install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/sbin"
+		install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/sbin"
 	else
 		echo "!!! ${0##*/}: ${x} does not exist" 1>&2
 		false

diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed
index afc949b..00cf5da 100755
--- a/bin/ebuild-helpers/dosed
+++ b/bin/ebuild-helpers/dosed
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 if [[ $# -lt 1 ]] ; then
@@ -7,12 +7,14 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 ret=0
 file_found=0
-mysed="s:${D}::g"
+mysed="s:${ED}::g"
 
 for x in "$@" ; do
-	y=$D${x#/}
+	y=$ED${x#/}
 	if [ -e "${y}" ] ; then
 		if [ -f "${y}" ] ; then
 			file_found=1

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index 7dd4c6d..8b7b304 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,16 +9,18 @@ if [[ $# -ne 2 ]] ; then
 	exit 1
 fi
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 if [[ ${2} == */ ]] || \
-	[[ -d ${D}${2} && ! -L ${D}${2} ]] ; then
+	[[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
 	# implicit basename not allowed by PMS (bug #379899)
 	eqawarn "QA Notice: dosym target omits basename: '${2}'"
 fi
 
 destdir=${2%/*}
-[[ ! -d ${D}${destdir} ]] && dodir "${destdir}"
+[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
 
-ln -snf "$1" "${D}$2"
+ln -snf "$1" "${ED}$2"
 ret=$?
 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
index 7a95120..76c2718 100755
--- a/bin/ebuild-helpers/ecompressdir
+++ b/bin/ebuild-helpers/ecompressdir
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,19 +9,21 @@ if [[ -z $1 ]] ; then
 	exit 1
 fi
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 case $1 in
 	--ignore)
 		shift
 		for skip in "$@" ; do
-			[[ -d ${D}${skip} || -f ${D}${skip} ]] \
-				&& >> "${D}${skip}.ecompress.skip"
+			[[ -d ${ED}${skip} || -f ${ED}${skip} ]] \
+				&& >> "${ED}${skip}.ecompress.skip"
 		done
 		exit 0
 		;;
 	--queue)
 		shift
 		set -- "${@/%/.ecompress.dir}"
-		set -- "${@/#/${D}}"
+		set -- "${@/#/${ED}}"
 		ret=0
 		for x in "$@" ; do
 			>> "$x"
@@ -32,10 +34,10 @@ case $1 in
 		;;
 	--dequeue)
 		[[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
-		find "${D}" -name '*.ecompress.dir' -print0 \
-			| sed -e 's:\.ecompress\.dir::g' -e "s:${D}:/:g" \
+		find "${ED}" -name '*.ecompress.dir' -print0 \
+			| sed -e 's:\.ecompress\.dir::g' -e "s:${ED}:/:g" \
 			| ${XARGS} -0 ecompressdir
-		find "${D}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
+		find "${ED}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
 		exit 0
 		;;
 	--*)
@@ -95,8 +97,8 @@ _relocate_skip_dirs() {
 		mv "${src}.ecompress.skip" "${dst}.ecompress.skip"
 	done
 }
-hide_skip_dirs()    { _relocate_skip_dirs "${D}" "${T}"/ecompress-skip/ ; }
-restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${D}" ; }
+hide_skip_dirs()    { _relocate_skip_dirs "${ED}" "${T}"/ecompress-skip/ ; }
+restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${ED}" ; }
 
 ret=0
 
@@ -104,9 +106,9 @@ rm -rf "${T}"/ecompress-skip
 
 for dir in "$@" ; do
 	dir=${dir#/}
-	dir="${D}${dir}"
+	dir="${ED}${dir}"
 	if [[ ! -d ${dir} ]] ; then
-		vecho "${0##*/}: /${dir#${D}} does not exist!"
+		vecho "${0##*/}: /${dir#${ED}} does not exist!"
 		continue
 	fi
 	cd "${dir}"
@@ -132,7 +134,7 @@ for dir in "$@" ; do
 
 	# now lets do our work
 	[[ -z ${suffix} ]] && continue
-	vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}"
+	vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}"
 	funk_up_dir "compress" "${suffix}" "ecompress"
 
 	# finally, restore the skipped stuff

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index 4cc6bfa..3f51b4e 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -1,13 +1,15 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 # we can't prefix all arguments because
 # chown takes random options
 slash="/"
-chown "${@/#${slash}/${D}${slash}}"
+chown "${@/#${slash}/${ED}${slash}}"
 ret=$?
 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index 0260bdc..9a2971a 100755
--- a/bin/ebuild-helpers/fperms
+++ b/bin/ebuild-helpers/fperms
@@ -1,13 +1,14 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
 # we can't prefix all arguments because
 # chmod takes random options
 slash="/"
-chmod "${@/#${slash}/${D}${slash}}"
+chmod "${@/#${slash}/${ED}${slash}}"
 ret=$?
 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 701ecba..611c4ce 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -4,12 +4,14 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 if has chflags $FEATURES ; then
 	# Save all the file flags for restoration at the end of prepall.
-	mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree"
+	mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
 	# Remove all the file flags so that prepall can do anything necessary.
-	chflags -R noschg,nouchg,nosappnd,nouappnd "${D}"
-	chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null
+	chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
+	chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
 fi
 
 prepallman
@@ -19,5 +21,5 @@ prepallstrip
 
 if has chflags $FEATURES ; then
 	# Restore all the file flags that were saved at the beginning of prepall.
-	mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
+	mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
 fi

diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
index fdc735d..540d025 100755
--- a/bin/ebuild-helpers/prepalldocs
+++ b/bin/ebuild-helpers/prepalldocs
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -8,8 +8,9 @@ if [[ -n $1 ]] ; then
 	vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
 fi
 
-cd "${D}"
-[[ -d usr/share/doc ]] || exit 0
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+[[ -d ${ED}usr/share/doc ]] || exit 0
 
 ecompressdir --ignore /usr/share/doc/${PF}/html
 ecompressdir --queue /usr/share/doc

diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo
index 0d97803..e351f87 100755
--- a/bin/ebuild-helpers/prepallinfo
+++ b/bin/ebuild-helpers/prepallinfo
@@ -1,9 +1,11 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
-[[ ! -d ${D}usr/share/info ]] && exit 0
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+[[ -d ${ED}usr/share/info ]] || exit 0
 
 exec prepinfo

diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
index e50de6d..be7f194 100755
--- a/bin/ebuild-helpers/prepallman
+++ b/bin/ebuild-helpers/prepallman
@@ -7,11 +7,13 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 # replaced by controllable compression in EAPI 4
 has "${EAPI}" 0 1 2 3 || exit 0
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 ret=0
 
-find "${D}" -type d -name man > "${T}"/prepallman.filelist
+find "${ED}" -type d -name man > "${T}"/prepallman.filelist
 while read -r mandir ; do
-	mandir=${mandir#${D}}
+	mandir=${mandir#${ED}}
 	prepman "${mandir%/man}"
 	((ret|=$?))
 done < "${T}"/prepallman.filelist

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
index ec12ce6..e9f5f8e 100755
--- a/bin/ebuild-helpers/prepallstrip
+++ b/bin/ebuild-helpers/prepallstrip
@@ -1,5 +1,7 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-exec prepstrip "${D}"
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+exec prepstrip "${ED}"

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index 691fd13..afe214c 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -4,17 +4,19 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 if [[ -z $1 ]] ; then
 	infodir="/usr/share/info"
 else
-	if [[ -d ${D}$1/share/info ]] ; then
+	if [[ -d ${ED}$1/share/info ]] ; then
 		infodir="$1/share/info"
 	else
 		infodir="$1/info"
 	fi
 fi
 
-if [[ ! -d ${D}${infodir} ]] ; then
+if [[ ! -d ${ED}${infodir} ]] ; then
 	if [[ -n $1 ]] ; then
 		vecho "${0##*/}: '${infodir}' does not exist!"
 		exit 1
@@ -23,7 +25,7 @@ if [[ ! -d ${D}${infodir} ]] ; then
 	fi
 fi
 
-find "${D}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
+find "${ED}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
 	for f in "${x}"/.keepinfodir*; do
 		[[ -e ${f} ]] && continue 2
 	done

diff --git a/bin/ebuild-helpers/preplib b/bin/ebuild-helpers/preplib
index 76aabe6..8c62921 100755
--- a/bin/ebuild-helpers/preplib
+++ b/bin/ebuild-helpers/preplib
@@ -1,11 +1,13 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 eqawarn "QA Notice: Deprecated call to 'preplib'"
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 LIBDIR_VAR="LIBDIR_${ABI}"
 if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
 	CONF_LIBDIR="${!LIBDIR_VAR}"
@@ -18,9 +20,9 @@ if [ -z "${CONF_LIBDIR}" ]; then
 fi
 
 if [ -z "$1" ] ; then
-	z="${D}usr/${CONF_LIBDIR}"
+	z="${ED}usr/${CONF_LIBDIR}"
 else
-	z="${D}$1/${CONF_LIBDIR}"
+	z="${ED}$1/${CONF_LIBDIR}"
 fi
 
 if [ -d "${z}" ] ; then

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index c9add8a..8ea7607 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -4,14 +4,16 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 if [[ -z $1 ]] ; then 
-	mandir="${D}usr/share/man"
+	mandir="${ED}usr/share/man"
 else
-	mandir="${D}$1/man"
+	mandir="${ED}$1/man"
 fi
 
 if [[ ! -d ${mandir} ]] ; then
-	eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${D}}'"
+	eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${ED}}'"
 	exit 0
 fi
 
@@ -27,6 +29,6 @@ for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do
 	[[ -d ${subdir} ]] && really_is_mandir=1 && break
 done
 
-[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${D}}"
+[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${ED}}"
 
 exit 0

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 8c2ca48..fac20b2 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -18,6 +18,8 @@ exp_tf() {
 exp_tf FEATURES installsources nostrip splitdebug
 exp_tf RESTRICT binchecks installsources strip
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 banner=false
 SKIP_STRIP=false
 if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
@@ -99,7 +101,7 @@ save_elf_debug() {
 	${FEATURES_splitdebug} || return 0
 
 	local x=$1
-	local y="${D}usr/lib/debug/${x:${#D}}.debug"
+	local y="${ED}usr/lib/debug/${x:${#ED}}.debug"
 
 	# dont save debug info twice
 	[[ ${x} == *".debug" ]] && return 0
@@ -108,7 +110,7 @@ save_elf_debug() {
 
 	local inode=$(inode_var_name "$x")
 	if [[ -n ${!inode} ]] ; then
-		ln "${D}usr/lib/debug/${!inode:${#D}}.debug" "$y"
+		ln "${ED}usr/lib/debug/${!inode:${#ED}}.debug" "$y"
 	else
 		eval $inode=\$x
 		if [[ -e ${T}/prepstrip.split.debug ]] ; then
@@ -129,18 +131,18 @@ save_elf_debug() {
 			| awk '$NF ~ /GNU/ { getline; printf $2$3$4$5; getline; print $2 }')
 	fi
 	if [[ -n ${buildid} ]] ; then
-		local buildid_dir="${D}usr/lib/debug/.build-id/${buildid:0:2}"
+		local buildid_dir="${ED}usr/lib/debug/.build-id/${buildid:0:2}"
 		local buildid_file="${buildid_dir}/${buildid:2}"
 		mkdir -p "${buildid_dir}"
-		ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug"
-		ln -s "/${x:${#D}}" "${buildid_file}"
+		ln -s "../../${x:${#ED}}.debug" "${buildid_file}.debug"
+		ln -s "/${x:${#ED}}" "${buildid_file}"
 	fi
 }
 
 process_elf() {
 	local x=$1 strip_flags=${*:2}
 
-	vecho "   ${x:${#D}}"
+	vecho "   ${x:${#ED}}"
 	save_elf_sources "${x}"
 
 	if ${strip_this} ; then
@@ -165,7 +167,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
 	log=$T/scanelf-already-stripped.log
 	qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
 	[[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}"
-	scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^$D##" > "$log"
+	scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "$log"
 	if [[ -n $QA_PRESTRIPPED && -s $log && \
 		${QA_STRICT_PRESTRIPPED-unset} = unset ]] ; then
 		shopts=$-
@@ -206,7 +208,7 @@ do
 		set -o noglob
 		strip_this=true
 		for m in $(eval echo ${STRIP_MASK}) ; do
-			[[ /${x#${D}} == ${m} ]] && strip_this=false && break
+			[[ /${x#${ED}} == ${m} ]] && strip_this=false && break
 		done
 		set +o noglob
 	else
@@ -221,7 +223,7 @@ do
 
 	buildid=
 	if [[ ${f} == *"current ar archive"* ]] ; then
-		vecho "   ${x:${#D}}"
+		vecho "   ${x:${#ED}}"
 		if ${strip_this} ; then
 			# hmm, can we split debug/sources for .a ?
 			${STRIP} -g "${x}"
@@ -239,10 +241,10 @@ if [[ -s ${T}/debug.sources ]] && \
    ${debugedit_found}
 then
 	vecho "installsources: rsyncing source files"
-	[[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sources_dir}"
+	[[ -d ${ED}${prepstrip_sources_dir} ]] || mkdir -p "${ED}${prepstrip_sources_dir}"
 	grep -zv '/<[^/>]*>$' "${T}"/debug.sources | \
 		(cd "${WORKDIR}"; LANG=C sort -z -u | \
-		rsync -tL0 --files-from=- "${WORKDIR}/" "${D}${prepstrip_sources_dir}/" )
+		rsync -tL0 --files-from=- "${WORKDIR}/" "${ED}${prepstrip_sources_dir}/" )
 
 	# Preserve directory structure.
 	# Needed after running save_elf_sources.
@@ -250,5 +252,5 @@ then
 	while read -r -d $'\0' emptydir
 	do
 		>> "$emptydir"/.keepdir
-	done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0)
+	done < <(find "${ED}${prepstrip_sources_dir}/" -type d -empty -print0)
 fi

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 7b77c10..5648a97 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -597,17 +597,19 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 			PATH=$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
 			unset _ebuild_helpers_path
 
+			_eprefix=${EPREFIX}
+			case "$EAPI" in 0|1|2) _eprefix= ;; esac
 			# Use default ABI libdir in accordance with bug #355283.
 			x=LIBDIR_${DEFAULT_ABI}
 			[[ -n $DEFAULT_ABI && -n ${!x} ]] && x=${!x} || x=lib
 
 			if has distcc $FEATURES ; then
-				PATH="/usr/$x/distcc/bin:$PATH"
+				PATH="${_eprefix}/usr/$x/distcc/bin:$PATH"
 				[[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
 			fi
 
 			if has ccache $FEATURES ; then
-				PATH="/usr/$x/ccache/bin:$PATH"
+				PATH="${_eprefix}/usr/$x/ccache/bin:$PATH"
 
 				if [[ -n $CCACHE_DIR ]] ; then
 					addread "$CCACHE_DIR"
@@ -617,7 +619,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 				[[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
 			fi
 
-			unset x
+			unset x _eprefix
 
 			if [[ -n $QA_PREBUILT ]] ; then
 

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 80cd0f8..81bae76 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -17,7 +17,9 @@ shift $#
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh"
 
 install_symlink_html_docs() {
-	cd "${D}" || die "cd failed"
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
+	cd "${ed}" || die "cd failed"
 	#symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf)
 	if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
 		local mydocdir docdir
@@ -64,11 +66,13 @@ canonicalize() {
 prepcompress() {
 	local -a include exclude incl_d incl_f
 	local f g i real_f real_d
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
 
 	# Canonicalize path names and check for their existence.
-	real_d=$(canonicalize "${D}")
+	real_d=$(canonicalize "${ed}")
 	for (( i = 0; i < ${#PORTAGE_DOCOMPRESS[@]}; i++ )); do
-		real_f=$(canonicalize "${D}${PORTAGE_DOCOMPRESS[i]}")
+		real_f=$(canonicalize "${ed}${PORTAGE_DOCOMPRESS[i]}")
 		f=${real_f#"${real_d}"}
 		if [[ ${real_f} != "${f}" ]] && [[ -d ${real_f} || -f ${real_f} ]]
 		then
@@ -79,7 +83,7 @@ prepcompress() {
 		fi
 	done
 	for (( i = 0; i < ${#PORTAGE_DOCOMPRESS_SKIP[@]}; i++ )); do
-		real_f=$(canonicalize "${D}${PORTAGE_DOCOMPRESS_SKIP[i]}")
+		real_f=$(canonicalize "${ed}${PORTAGE_DOCOMPRESS_SKIP[i]}")
 		f=${real_f#"${real_d}"}
 		if [[ ${real_f} != "${f}" ]] && [[ -d ${real_f} || -f ${real_f} ]]
 		then
@@ -128,7 +132,7 @@ prepcompress() {
 
 	# Split the include list into directories and files
 	for f in "${include[@]}"; do
-		if [[ -d ${D}${f} ]]; then
+		if [[ -d ${ed}${f} ]]; then
 			incl_d[${#incl_d[@]}]=${f}
 		else
 			incl_f[${#incl_f[@]}]=${f}
@@ -138,15 +142,17 @@ prepcompress() {
 	# Queue up for compression.
 	# ecompress{,dir} doesn't like to be called with empty argument lists.
 	[[ ${#incl_d[@]} -gt 0 ]] && ecompressdir --queue "${incl_d[@]}"
-	[[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${D}}"
+	[[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${ed}}"
 	[[ ${#exclude[@]} -gt 0 ]] && ecompressdir --ignore "${exclude[@]}"
 	return 0
 }
 
 install_qa_check() {
 	local f i x
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
 
-	cd "${D}" || die "cd failed"
+	cd "${ed}" || die "cd failed"
 
 	export STRIP_MASK
 	prepall
@@ -154,15 +160,12 @@ install_qa_check() {
 	ecompressdir --dequeue
 	ecompress --dequeue
 
-	local ed=${ED}
-	case "$EAPI" in 0|1|2) ed=${D} ;; esac
-
 	# Prefix specific checks
 	[[ ${ed} != ${D} ]] && install_qa_check_prefix
 
 	f=
 	for x in etc/app-defaults usr/man usr/info usr/X11R6 usr/doc usr/locale ; do
-		[[ -d $D/$x ]] && f+="  $x\n"
+		[[ -d $ed/$x ]] && f+="  $x\n"
 	done
 
 	if [[ -n $f ]] ; then
@@ -172,7 +175,7 @@ install_qa_check() {
 	fi
 
 	# Now we look for all world writable files.
-	local unsafe_files=$(find "${D}" -type f -perm -2 | sed -e "s:^${D}:- :")
+	local unsafe_files=$(find "${ed}" -type f -perm -2 | sed -e "s:^${ed}:- :")
 	if [[ -n ${unsafe_files} ]] ; then
 		vecho "QA Security Notice: world writable file(s):"
 		vecho "${unsafe_files}"
@@ -202,7 +205,7 @@ install_qa_check() {
 		if [[ -n "${ROOT}" && "${ROOT}" != "/" ]]; then
 			forbidden_dirs+=" ${ROOT}"
 		fi
-		local dir l rpath_files=$(scanelf -F '%F:%r' -qBR "${D}")
+		local dir l rpath_files=$(scanelf -F '%F:%r' -qBR "${ed}")
 		f=""
 		for dir in ${forbidden_dirs}; do
 			for l in $(echo "${rpath_files}" | grep -E ":${dir}|::|: "); do
@@ -216,7 +219,7 @@ install_qa_check() {
 
 		# Reject set*id binaries with $ORIGIN in RPATH #260331
 		x=$(
-			find "${D}" -type f \( -perm -u+s -o -perm -g+s \) -print0 | \
+			find "${ed}" -type f \( -perm -u+s -o -perm -g+s \) -print0 | \
 			xargs -0 scanelf -qyRF '%r %p' | grep '$ORIGIN'
 		)
 
@@ -242,7 +245,7 @@ install_qa_check() {
 		[[ -n ${!qa_var} ]] && QA_TEXTRELS=${!qa_var}
 		[[ -n ${QA_STRICT_TEXTRELS} ]] && QA_TEXTRELS=""
 		export QA_TEXTRELS="${QA_TEXTRELS} lib*/modules/*.ko"
-		f=$(scanelf -qyRF '%t %p' "${D}" | grep -v 'usr/lib/debug/')
+		f=$(scanelf -qyRF '%t %p' "${ed}" | grep -v 'usr/lib/debug/')
 		if [[ -n ${f} ]] ; then
 			scanelf -qyRAF '%T %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-textrel.log
 			vecho -ne '\n'
@@ -282,7 +285,7 @@ install_qa_check() {
 					[[ -n ${QA_STRICT_WX_LOAD} ]] && QA_WX_LOAD=""
 					export QA_EXECSTACK="${QA_EXECSTACK} lib*/modules/*.ko"
 					export QA_WX_LOAD="${QA_WX_LOAD} lib*/modules/*.ko"
-					f=$(scanelf -qyRAF '%e %p' "${D}" | grep -v 'usr/lib/debug/')
+					f=$(scanelf -qyRAF '%e %p' "${ed}" | grep -v 'usr/lib/debug/')
 					;;
 			esac
 			;;
@@ -309,7 +312,7 @@ install_qa_check() {
 		if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && [[ "${PN}" != *-bin ]] ; then
 			qa_var="QA_DT_HASH_${ARCH/-/_}"
 			eval "[[ -n \${!qa_var} ]] && QA_DT_HASH=(\"\${${qa_var}[@]}\")"
-			f=$(scanelf -qyRF '%k %p' -k .hash "${D}" | sed -e "s:\.hash ::")
+			f=$(scanelf -qyRF '%k %p' -k .hash "${ed}" | sed -e "s:\.hash ::")
 			if [[ -n ${f} ]] ; then
 				echo "${f}" > "${T}"/scanelf-ignored-LDFLAGS.log
 				if [ "${QA_STRICT_DT_HASH-unset}" == unset ] ; then
@@ -391,7 +394,7 @@ install_qa_check() {
 		# Check for shared libraries lacking SONAMEs
 		qa_var="QA_SONAME_${ARCH/-/_}"
 		eval "[[ -n \${!qa_var} ]] && QA_SONAME=(\"\${${qa_var}[@]}\")"
-		f=$(scanelf -ByF '%S %p' "${D}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
+		f=$(scanelf -ByF '%S %p' "${ed}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ed}:/:")
 		if [[ -n ${f} ]] ; then
 			echo "${f}" > "${T}"/scanelf-missing-SONAME.log
 			if [[ "${QA_STRICT_SONAME-unset}" == unset ]] ; then
@@ -425,7 +428,7 @@ install_qa_check() {
 		# Check for shared libraries lacking NEEDED entries
 		qa_var="QA_DT_NEEDED_${ARCH/-/_}"
 		eval "[[ -n \${!qa_var} ]] && QA_DT_NEEDED=(\"\${${qa_var}[@]}\")"
-		f=$(scanelf -ByF '%n %p' "${D}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
+		f=$(scanelf -ByF '%n %p' "${ed}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ed}:/:")
 		if [[ -n ${f} ]] ; then
 			echo "${f}" > "${T}"/scanelf-missing-NEEDED.log
 			if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then
@@ -459,7 +462,7 @@ install_qa_check() {
 		PORTAGE_QUIET=${tmp_quiet}
 	fi
 
-	local unsafe_files=$(find "${D}" -type f '(' -perm -2002 -o -perm -4002 ')')
+	local unsafe_files=$(find "${ed}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${ed}:/:")
 	if [[ -n ${unsafe_files} ]] ; then
 		eqawarn "QA Notice: Unsafe files detected (set*id and world writable)"
 		eqawarn "${unsafe_files}"
@@ -479,8 +482,8 @@ install_qa_check() {
 	# Sanity check syntax errors in init.d scripts
 	local d
 	for d in /etc/conf.d /etc/init.d ; do
-		[[ -d ${D}/${d} ]] || continue
-		for i in "${D}"/${d}/* ; do
+		[[ -d ${ed}/${d} ]] || continue
+		for i in "${ed}"/${d}/* ; do
 			[[ -L ${i} ]] && continue
 			# if empty conf.d/init.d dir exists (baselayout), then i will be "/etc/conf.d/*" and not exist
 			[[ ! -e ${i} ]] && continue
@@ -491,17 +494,17 @@ install_qa_check() {
 	# this should help to ensure that all (most?) shared libraries are executable
 	# and that all libtool scripts / static libraries are not executable
 	local j
-	for i in "${D}"opt/*/lib{,32,64} \
-	         "${D}"lib{,32,64}       \
-	         "${D}"usr/lib{,32,64}   \
-	         "${D}"usr/X11R6/lib{,32,64} ; do
+	for i in "${ed}"opt/*/lib{,32,64} \
+	         "${ed}"lib{,32,64}       \
+	         "${ed}"usr/lib{,32,64}   \
+	         "${ed}"usr/X11R6/lib{,32,64} ; do
 		[[ ! -d ${i} ]] && continue
 
 		for j in "${i}"/*.so.* "${i}"/*.so ; do
 			[[ ! -e ${j} ]] && continue
 			[[ -L ${j} ]] && continue
 			[[ -x ${j} ]] && continue
-			vecho "making executable: ${j#${D}}"
+			vecho "making executable: ${j#${ed}}"
 			chmod +x "${j}"
 		done
 
@@ -509,7 +512,7 @@ install_qa_check() {
 			[[ ! -e ${j} ]] && continue
 			[[ -L ${j} ]] && continue
 			[[ ! -x ${j} ]] && continue
-			vecho "removing executable bit: ${j#${D}}"
+			vecho "removing executable bit: ${j#${ed}}"
 			chmod -x "${j}"
 		done
 
@@ -533,7 +536,7 @@ install_qa_check() {
 	# http://bugs.gentoo.org/4411
 	abort="no"
 	local a s
-	for a in "${D}"usr/lib*/*.a ; do
+	for a in "${ed}"usr/lib*/*.a ; do
 		s=${a%.a}.so
 		if [[ ! -e ${s} ]] ; then
 			s=${s%usr/*}${s##*/usr/}
@@ -547,7 +550,7 @@ install_qa_check() {
 	[[ ${abort} == "yes" ]] && die "add those ldscripts"
 
 	# Make sure people don't store libtool files or static libs in /lib
-	f=$(ls "${D}"lib*/*.{a,la} 2>/dev/null)
+	f=$(ls "${ed}"lib*/*.{a,la} 2>/dev/null)
 	if [[ -n ${f} ]] ; then
 		vecho -ne '\n'
 		eqawarn "QA Notice: Excessive files found in the / partition"
@@ -558,9 +561,9 @@ install_qa_check() {
 
 	# Verify that the libtool files don't contain bogus $D entries.
 	local abort=no gentoo_bug=no always_overflow=no
-	for a in "${D}"usr/lib*/*.la ; do
+	for a in "${ed}"usr/lib*/*.la ; do
 		s=${a##*/}
-		if grep -qs "${D}" "${a}" ; then
+		if grep -qs "${ed}" "${a}" ; then
 			vecho -ne '\n'
 			eqawarn "QA Notice: ${s} appears to contain PORTAGE_TMPDIR paths"
 			abort="yes"
@@ -702,7 +705,7 @@ install_qa_check() {
 	fi
 
 	# Portage regenerates this on the installed system.
-	rm -f "${D}"/usr/share/info/dir{,.gz,.bz2}
+	rm -f "${ed}"/usr/share/info/dir{,.gz,.bz2}
 
 	if has multilib-strict ${FEATURES} && \
 	   [[ -x /usr/bin/file && -x /usr/bin/find ]] && \
@@ -711,15 +714,15 @@ install_qa_check() {
 		local abort=no dir file firstrun=yes
 		MULTILIB_STRICT_EXEMPT=$(echo ${MULTILIB_STRICT_EXEMPT} | sed -e 's:\([(|)]\):\\\1:g')
 		for dir in ${MULTILIB_STRICT_DIRS} ; do
-			[[ -d ${D}/${dir} ]] || continue
-			for file in $(find ${D}/${dir} -type f | grep -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
+			[[ -d ${ed}/${dir} ]] || continue
+			for file in $(find ${ed}/${dir} -type f | grep -v "^${ed}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
 				if file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" ; then
 					if [[ ${firstrun} == yes ]] ; then
 						echo "Files matching a file type that is not allowed:"
 						firstrun=no
 					fi
 					abort=yes
-					echo "   ${file#${D}//}"
+					echo "   ${file#${ed}//}"
 				fi
 			done
 		done
@@ -728,7 +731,7 @@ install_qa_check() {
 
 	# ensure packages don't install systemd units automagically
 	if ! has systemd ${INHERITED} && \
-		[[ -d "${D}"/lib/systemd/system ]]
+		[[ -d "${ed}"/lib/systemd/system ]]
 	then
 		eqawarn "QA Notice: package installs systemd unit files (/lib/systemd/system)"
 		eqawarn "           but does not inherit systemd.eclass."
@@ -886,6 +889,9 @@ preinst_mask() {
 		 return 1
 	fi
 
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
+
 	# Make sure $PWD is not ${D} so that we don't leave gmon.out files
 	# in there in case any tools were built with -pg in CFLAGS.
 	cd "${T}"
@@ -898,11 +904,11 @@ preinst_mask() {
 		fi
 	done
 
-	install_mask "${D}" "${INSTALL_MASK}"
+	install_mask "${ed}" "${INSTALL_MASK}"
 
 	# remove share dir if unnessesary
 	if has nodoc $FEATURES || has noman $FEATURES || has noinfo $FEATURES; then
-		rmdir "${D}usr/share" &> /dev/null
+		rmdir "${ed}usr/share" &> /dev/null
 	fi
 }
 
@@ -911,29 +917,33 @@ preinst_sfperms() {
 		 eerror "${FUNCNAME}: D is unset"
 		 return 1
 	fi
+
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
+
 	# Smart FileSystem Permissions
 	if has sfperms $FEATURES; then
 		local i
-		find "${D}" -type f -perm -4000 -print0 | \
+		find "${ed}" -type f -perm -4000 -print0 | \
 		while read -r -d $'\0' i ; do
 			if [ -n "$(find "$i" -perm -2000)" ] ; then
-				ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${D}}"
+				ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${ed}}"
 				chmod o-r "$i"
 				eend $?
 			else
-				ebegin ">>> SetUID: [chmod go-r] /${i#${D}}"
+				ebegin ">>> SetUID: [chmod go-r] /${i#${ed}}"
 				chmod go-r "$i"
 				eend $?
 			fi
 		done
-		find "${D}" -type f -perm -2000 -print0 | \
+		find "${ed}" -type f -perm -2000 -print0 | \
 		while read -r -d $'\0' i ; do
 			if [ -n "$(find "$i" -perm -4000)" ] ; then
 				# This case is already handled
 				# by the SetUID check above.
 				true
 			else
-				ebegin ">>> SetGID: [chmod o-r] /${i#${D}}"
+				ebegin ">>> SetGID: [chmod o-r] /${i#${ed}}"
 				chmod o-r "$i"
 				eend $?
 			fi
@@ -946,6 +956,10 @@ preinst_suid_scan() {
 		 eerror "${FUNCNAME}: D is unset"
 		 return 1
 	fi
+
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
+
 	# total suid control.
 	if has suidctl $FEATURES; then
 		local i sfconf x
@@ -954,10 +968,10 @@ preinst_suid_scan() {
 		# to files outside of the sandbox, but this
 		# can easly be bypassed using the addwrite() function
 		addwrite "${sfconf}"
-		vecho ">>> Performing suid scan in ${D}"
-		for i in $(find "${D}" -type f \( -perm -4000 -o -perm -2000 \) ); do
+		vecho ">>> Performing suid scan in ${ed}"
+		for i in $(find "${ed}" -type f \( -perm -4000 -o -perm -2000 \) ); do
 			if [ -s "${sfconf}" ]; then
-				install_path=/${i#${D}}
+				install_path=/${i#${ed}}
 				if grep -q "^${install_path}\$" "${sfconf}" ; then
 					vecho "- ${install_path} is an approved suid file"
 				else
@@ -967,7 +981,7 @@ preinst_suid_scan() {
 					chmod ugo-s "${i}"
 					grep "^#${install_path}$" "${sfconf}" > /dev/null || {
 						vecho ">>> Appending commented out entry to ${sfconf} for ${PF}"
-						echo "## ${ls_ret%${D}*}${install_path}" >> "${sfconf}"
+						echo "## ${ls_ret%${ed}*}${install_path}" >> "${sfconf}"
 						echo "#${install_path}" >> "${sfconf}"
 						# no delwrite() eh?
 						# delwrite ${sconf}
@@ -1008,10 +1022,14 @@ preinst_selinux_labels() {
 }
 
 dyn_package() {
+
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
+
 	# Make sure $PWD is not ${D} so that we don't leave gmon.out files
 	# in there in case any tools were built with -pg in CFLAGS.
 	cd "${T}"
-	install_mask "${PORTAGE_BUILDDIR}/image" "${PKG_INSTALL_MASK}"
+	install_mask "${ed}" "${PKG_INSTALL_MASK}"
 	local tar_options=""
 	[[ $PORTAGE_VERBOSE = 1 ]] && tar_options+=" -v"
 	# Sandbox is disabled in case the user wants to use a symlink
@@ -1085,10 +1103,14 @@ __END1__
 }
 
 dyn_rpm() {
+
+	local eprefix=${EPREFIX}
+	case "$EAPI" in 0|1|2) eprefix= ;; esac
+
 	cd "${T}" || die "cd failed"
 	local machine_name=$(uname -m)
-	local dest_dir=/usr/src/rpm/RPMS/${machine_name}
-	addwrite /usr/src/rpm
+	local dest_dir=${eprefix}/usr/src/rpm/RPMS/${machine_name}
+	addwrite ${eprefix}/usr/src/rpm
 	addwrite "${RPMDIR}"
 	dyn_spec
 	rpmbuild -bb --clean --rmsource "${PF}.spec" || die "Failed to integrate rpm spec file"

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 164b309..9dcbf76 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -498,8 +498,13 @@ dyn_install() {
 	fi
 	trap "abort_install" SIGINT SIGQUIT
 	ebuild_phase pre_src_install
-	rm -rf "${PORTAGE_BUILDDIR}/image"
-	mkdir "${PORTAGE_BUILDDIR}/image"
+
+	_x=${ED}
+	case "$EAPI" in 0|1|2) _x=${D} ;; esac
+	rm -rf "${D}"
+	mkdir -p "${_x}"
+	unset _x
+
 	if [[ -d $S ]] ; then
 		cd "${S}"
 	elif has $EAPI 0 1 2 3 3_pre2 ; then

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index a033fa8..8a2f381 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -19,8 +19,10 @@ into() {
 		export DESTTREE=""
 	else
 		export DESTTREE=$1
-		if [ ! -d "${D}${DESTTREE}" ]; then
-			install -d "${D}${DESTTREE}"
+		local ed=${ED}
+		case "$EAPI" in 0|1|2) ed=${D} ;; esac
+		if [ ! -d "${ed}${DESTTREE}" ]; then
+			install -d "${ed}${DESTTREE}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -35,8 +37,10 @@ insinto() {
 		export INSDESTTREE=""
 	else
 		export INSDESTTREE=$1
-		if [ ! -d "${D}${INSDESTTREE}" ]; then
-			install -d "${D}${INSDESTTREE}"
+		local ed=${ED}
+		case "$EAPI" in 0|1|2) ed=${D} ;; esac
+		if [ ! -d "${ed}${INSDESTTREE}" ]; then
+			install -d "${ed}${INSDESTTREE}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -51,8 +55,10 @@ exeinto() {
 		export _E_EXEDESTTREE_=""
 	else
 		export _E_EXEDESTTREE_="$1"
-		if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then
-			install -d "${D}${_E_EXEDESTTREE_}"
+		local ed=${ED}
+		case "$EAPI" in 0|1|2) ed=${D} ;; esac
+		if [ ! -d "${ed}${_E_EXEDESTTREE_}" ]; then
+			install -d "${ed}${_E_EXEDESTTREE_}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -67,8 +73,10 @@ docinto() {
 		export _E_DOCDESTTREE_=""
 	else
 		export _E_DOCDESTTREE_="$1"
-		if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
-			install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+		local ed=${ED}
+		case "$EAPI" in 0|1|2) ed=${D} ;; esac
+		if [ ! -d "${ed}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
+			install -d "${ed}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -133,9 +141,11 @@ docompress() {
 keepdir() {
 	dodir "$@"
 	local x
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
 	if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
 		shift
-		find "$@" -type d -printf "${D}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
+		find "$@" -type d -printf "${ed}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
 			| tr "\n" "\0" | \
 			while read -r -d $'\0' ; do
 				>> "$REPLY" || \
@@ -143,8 +153,8 @@ keepdir() {
 			done
 	else
 		for x in "$@"; do
-			>> "${D}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
-				die "Failed to create .keep in ${D}${x}"
+			>> "${ed}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
+				die "Failed to create .keep in ${ed}${x}"
 		done
 	fi
 }
@@ -369,6 +379,9 @@ unpack() {
 econf() {
 	local x
 
+	local eprefix=${EPREFIX}
+	case "$EAPI" in 0|1|2) eprefix= ;; esac
+
 	_hasg() {
 		local x s=$1
 		shift
@@ -398,12 +411,12 @@ econf() {
 			sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \
 				die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
 		fi
-		if [ -e /usr/share/gnuconfig/ ]; then
+		if [ -e "${eprefix}"/usr/share/gnuconfig/ ]; then
 			find "${WORKDIR}" -type f '(' \
 			-name config.guess -o -name config.sub ')' -print0 | \
 			while read -r -d $'\0' x ; do
-				vecho " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}"
-				cp -f /usr/share/gnuconfig/"${x##*/}" "${x}"
+				vecho " * econf: updating ${x/${WORKDIR}\/} with ${eprefix}/usr/share/gnuconfig/${x##*/}"
+				cp -f "${eprefix}"/usr/share/gnuconfig/"${x##*/}" "${x}"
 			done
 		fi
 
@@ -423,7 +436,7 @@ econf() {
 		if [[ -n ${CONF_LIBDIR} ]] && ! _hasgq --libdir=\* "$@" ; then
 			export CONF_PREFIX=$(_hasg --exec-prefix=\* "$@")
 			[[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(_hasg --prefix=\* "$@")
-			: ${CONF_PREFIX:=/usr}
+			: ${CONF_PREFIX:=${eprefix}/usr}
 			CONF_PREFIX=${CONF_PREFIX#*=}
 			[[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
 			[[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
@@ -431,15 +444,15 @@ econf() {
 		fi
 
 		set -- \
-			--prefix=/usr \
+			--prefix="${eprefix}"/usr \
 			${CBUILD:+--build=${CBUILD}} \
 			--host=${CHOST} \
 			${CTARGET:+--target=${CTARGET}} \
-			--mandir=/usr/share/man \
-			--infodir=/usr/share/info \
-			--datadir=/usr/share \
-			--sysconfdir=/etc \
-			--localstatedir=/var/lib \
+			--mandir="${eprefix}"/usr/share/man \
+			--infodir="${eprefix}"/usr/share/info \
+			--datadir="${eprefix}"/usr/share \
+			--sysconfdir="${eprefix}"/etc \
+			--localstatedir="${eprefix}"/var/lib \
 			"$@" \
 			${EXTRA_ECONF}
 		vecho "${ECONF_SOURCE}/configure" "$@"
@@ -463,6 +476,8 @@ econf() {
 einstall() {
 	# CONF_PREFIX is only set if they didn't pass in libdir above.
 	local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
 	LIBDIR_VAR="LIBDIR_${ABI}"
 	if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
 		CONF_LIBDIR="${!LIBDIR_VAR}"
@@ -477,22 +492,22 @@ einstall() {
 
 	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
 		if [ "${PORTAGE_DEBUG}" == "1" ]; then
-			${MAKE:-make} -n prefix="${D}usr" \
-				datadir="${D}usr/share" \
-				infodir="${D}usr/share/info" \
-				localstatedir="${D}var/lib" \
-				mandir="${D}usr/share/man" \
-				sysconfdir="${D}etc" \
+			${MAKE:-make} -n prefix="${ed}usr" \
+				datadir="${ed}usr/share" \
+				infodir="${ed}usr/share/info" \
+				localstatedir="${ed}var/lib" \
+				mandir="${ed}usr/share/man" \
+				sysconfdir="${ed}etc" \
 				${LOCAL_EXTRA_EINSTALL} \
 				${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
 				"$@" install
 		fi
-		${MAKE:-make} prefix="${D}usr" \
-			datadir="${D}usr/share" \
-			infodir="${D}usr/share/info" \
-			localstatedir="${D}var/lib" \
-			mandir="${D}usr/share/man" \
-			sysconfdir="${D}etc" \
+		${MAKE:-make} prefix="${ed}usr" \
+			datadir="${ed}usr/share" \
+			infodir="${ed}usr/share/info" \
+			localstatedir="${ed}var/lib" \
+			mandir="${ed}usr/share/man" \
+			sysconfdir="${ed}etc" \
 			${LOCAL_EXTRA_EINSTALL} \
 			${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
 			"$@" install || die "einstall failed"

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 7ed679d..d108959 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -36,11 +36,10 @@ pkg_pretend() {
 
 src_install() {
 	einfo "installing something..."
-	# TODO: Add prefix support to shell code/helpers, so we
-	#       can use things like dodir and doins here.
-	mkdir -p "${ED}"/usr/lib/${P} || die
-	echo "blah blah blah" > "${ED}"/usr/lib/${P}/regular-file || die
-	ln -s regular-file "${ED}"/usr/lib/${P}/symlink || die
+	insinto /usr/lib/${P}
+	echo "blah blah blah" > "${T}"/regular-file
+	doins "${T}"/regular-file
+	dosym regular-file /usr/lib/${P}/symlink || die
 
 	# Test code for bug #381629, using a copyright symbol encoded with latin-1.
 	# We use $(printf "\\xa9") rather than $'\\xa9', since printf apparently
@@ -48,10 +47,11 @@ src_install() {
 	# some conditions. TODO: Find out why it transforms to \\xef\\xbf\\xbd when
 	# running tests for Python 3.2 (even though it's bash that is ultimately
 	# responsible for performing the transformation).
-	local latin_1_dir=${ED}/usr/lib/${P}/latin-1-$(printf "\\xa9")-directory
-	mkdir "${latin_1_dir}"
-	echo "blah blah blah" > ${latin_1_dir}/latin-1-$(printf "\\xa9")-regular-file || die
-	ln -s latin-1-$(printf "\\xa9")-regular-file ${latin_1_dir}/latin-1-$(printf "\\xa9")-symlink || die
+	local latin_1_dir=/usr/lib/${P}/latin-1-$(printf "\\xa9")-directory
+	insinto "${latin_1_dir}"
+	echo "blah blah blah" > "${T}"/latin-1-$(printf "\\xa9")-regular-file || die
+	doins "${T}"/latin-1-$(printf "\\xa9")-regular-file
+	dosym latin-1-$(printf "\\xa9")-regular-file ${latin_1_dir}/latin-1-$(printf "\\xa9")-symlink || die
 }
 
 pkg_config() {
@@ -80,6 +80,11 @@ pkg_info() {
 				"LICENSE": "GPL-2",
 				"MISC_CONTENT": install_something,
 			},
+			"virtual/foo-0": {
+				"EAPI" : "4",
+				"KEYWORDS": "x86",
+				"LICENSE": "GPL-2",
+			},
 		}
 
 		installed = {
@@ -201,6 +206,7 @@ pkg_info() {
 				emerge_cmd + ("--metadata",),
 			emerge_cmd + ("--metadata",),
 			rm_cmd + ("-rf", cachedir),
+			emerge_cmd + ("--oneshot", "virtual/foo"),
 			emerge_cmd + ("--pretend", "dev-libs/A"),
 			ebuild_cmd + (test_ebuild, "manifest", "clean", "package", "merge"),
 			emerge_cmd + ("--pretend", "--tree", "--complete-graph", "dev-libs/A"),



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-02  2:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-02  2:17 [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, pym/portage/tests/emerge/, bin/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox