From: Zac Medico Date: Thu, 8 Dec 2011 06:22:31 +0000 (-0800) Subject: Make USE=prefix enable EPREFIX in all EAPIs. X-Git-Tag: v2.2.0_alpha80~60 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ff52f9dc31004becb8022e6437088d01917f413c;p=portage.git Make USE=prefix enable EPREFIX in all EAPIs. This is safe because the prefix flag should be masked in all non-prefix profiles, and older EAPIs would otherwise be useless with prefix configurations. This brings compatibility with the prefix branch of portage, which also supports EPREFIX for all EAPIs (for obvious reasons). --- diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin index af3af0d84..7ea29d4d4 100755 --- a/bin/ebuild-helpers/dobin +++ b/bin/ebuild-helpers/dobin @@ -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,7 +9,8 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + 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; } diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir index 7db7cafb1..5bedd05c9 100755 --- a/bin/ebuild-helpers/dodir +++ b/bin/ebuild-helpers/dodir @@ -4,7 +4,8 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac install -d ${DIROPTIONS} "${@/#/${ED}/}" ret=$? diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc index 37bbc79d0..6280536e5 100755 --- a/bin/ebuild-helpers/dodoc +++ b/bin/ebuild-helpers/dodoc @@ -9,7 +9,8 @@ if [ $# -lt 1 ] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" if [ ! -d "${dir}" ] ; then diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe index a5b9af0eb..65f355af9 100755 --- a/bin/ebuild-helpers/doexe +++ b/bin/ebuild-helpers/doexe @@ -9,7 +9,8 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then install -d "${ED}${_E_EXEDESTTREE_}" diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard index cf6fb112d..7a6fc7698 100755 --- a/bin/ebuild-helpers/dohard +++ b/bin/ebuild-helpers/dohard @@ -7,7 +7,8 @@ if [[ $# -ne 2 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac destdir=${2%/*} [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}" diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo index a922ef1be..c4b767e9b 100755 --- a/bin/ebuild-helpers/doinfo +++ b/bin/ebuild-helpers/doinfo @@ -9,7 +9,8 @@ if [[ -z $1 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + 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; } diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins index b9189d5ed..c3af28905 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -27,7 +27,8 @@ else DOINSRECUR=n fi -case "$EAPI" in 0|1|2) export ED="${D}" ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) export ED="${D}" ;; esac if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then vecho "-------------------------------------------------------" 1>&2 diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib index 9dd11d857..8357dfaa9 100755 --- a/bin/ebuild-helpers/dolib +++ b/bin/ebuild-helpers/dolib @@ -4,7 +4,8 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac # Setup ABI cruft LIBDIR_VAR="LIBDIR_${ABI}" diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman index 27401f3b3..817743d7e 100755 --- a/bin/ebuild-helpers/doman +++ b/bin/ebuild-helpers/doman @@ -9,7 +9,8 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac i18n="" diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo index 0e3656d58..551785e76 100755 --- a/bin/ebuild-helpers/domo +++ b/bin/ebuild-helpers/domo @@ -10,7 +10,8 @@ if [ ${mynum} -lt 1 ] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then install -d "${ED}${DESTTREE}/share/locale/" diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin index d0783ed33..560607754 100755 --- a/bin/ebuild-helpers/dosbin +++ b/bin/ebuild-helpers/dosbin @@ -9,7 +9,8 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + 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; } diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed index 00cf5da17..200b011fb 100755 --- a/bin/ebuild-helpers/dosed +++ b/bin/ebuild-helpers/dosed @@ -7,7 +7,8 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac ret=0 file_found=0 diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym index 8b7b304ee..8925001e4 100755 --- a/bin/ebuild-helpers/dosym +++ b/bin/ebuild-helpers/dosym @@ -9,7 +9,8 @@ if [[ $# -ne 2 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac if [[ ${2} == */ ]] || \ [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir index f9a846a90..937ba268b 100755 --- a/bin/ebuild-helpers/ecompressdir +++ b/bin/ebuild-helpers/ecompressdir @@ -9,7 +9,8 @@ if [[ -z $1 ]] ; then exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac case $1 in --ignore) diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners index 3f51b4e54..b3e4555cd 100755 --- a/bin/ebuild-helpers/fowners +++ b/bin/ebuild-helpers/fowners @@ -4,7 +4,8 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac # we can't prefix all arguments because # chown takes random options diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms index 9a2971ae5..207cf54a5 100755 --- a/bin/ebuild-helpers/fperms +++ b/bin/ebuild-helpers/fperms @@ -4,7 +4,9 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac + # we can't prefix all arguments because # chmod takes random options slash="/" diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall index 611c4ce79..512feb33a 100755 --- a/bin/ebuild-helpers/prepall +++ b/bin/ebuild-helpers/prepall @@ -4,7 +4,8 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + 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. diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs index 540d02500..1d0224981 100755 --- a/bin/ebuild-helpers/prepalldocs +++ b/bin/ebuild-helpers/prepalldocs @@ -8,7 +8,8 @@ if [[ -n $1 ]] ; then vecho "${0##*/}: invalid usage; takes no arguments" 1>&2 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac [[ -d ${ED}usr/share/doc ]] || exit 0 diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo index e351f878b..183e1ca62 100755 --- a/bin/ebuild-helpers/prepallinfo +++ b/bin/ebuild-helpers/prepallinfo @@ -4,7 +4,8 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac [[ -d ${ED}usr/share/info ]] || exit 0 diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman index be7f19453..a5699c2f1 100755 --- a/bin/ebuild-helpers/prepallman +++ b/bin/ebuild-helpers/prepallman @@ -7,7 +7,8 @@ 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 +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac ret=0 diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip index e9f5f8e3e..6032b48c9 100755 --- a/bin/ebuild-helpers/prepallstrip +++ b/bin/ebuild-helpers/prepallstrip @@ -2,6 +2,7 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + 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 afe214c6b..7c60d9b86 100755 --- a/bin/ebuild-helpers/prepinfo +++ b/bin/ebuild-helpers/prepinfo @@ -4,7 +4,8 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac if [[ -z $1 ]] ; then infodir="/usr/share/info" diff --git a/bin/ebuild-helpers/preplib b/bin/ebuild-helpers/preplib index 8c6292101..cbff76d4c 100755 --- a/bin/ebuild-helpers/preplib +++ b/bin/ebuild-helpers/preplib @@ -6,7 +6,8 @@ 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 +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac LIBDIR_VAR="LIBDIR_${ABI}" if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman index 8ea7607df..18c0f992a 100755 --- a/bin/ebuild-helpers/prepman +++ b/bin/ebuild-helpers/prepman @@ -4,7 +4,8 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac if [[ -z $1 ]] ; then mandir="${ED}usr/share/man" diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index fac20b24f..085c93d56 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -18,7 +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 +[[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=${D} ;; esac banner=false SKIP_STRIP=false diff --git a/bin/ebuild.sh b/bin/ebuild.sh index a3ac1e0bb..d77b52c85 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -670,6 +670,8 @@ else declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS case "$EAPI" in 0|1|2) + [[ " ${USE} " == *" prefix "* ]] && \ + declare -r ED EPREFIX EROOT ;; *) declare -r ED EPREFIX EROOT diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 1c11dc51a..584d16a00 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -17,7 +17,8 @@ shift $# source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh" install_symlink_html_docs() { - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local 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 @@ -65,7 +66,8 @@ canonicalize() { prepcompress() { local -a include exclude incl_d incl_f local f g i real_f real_d - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac # Canonicalize path names and check for their existence. real_d=$(canonicalize "${ED}") @@ -147,7 +149,8 @@ prepcompress() { install_qa_check() { local f i x - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac cd "${ED}" || die "cd failed" @@ -886,7 +889,8 @@ preinst_mask() { return 1 fi - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local 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. @@ -914,7 +918,8 @@ preinst_sfperms() { return 1 fi - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac # Smart FileSystem Permissions if has sfperms $FEATURES; then @@ -952,7 +957,8 @@ preinst_suid_scan() { return 1 fi - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac # total suid control. if has suidctl $FEATURES; then @@ -1017,7 +1023,8 @@ preinst_selinux_labels() { dyn_package() { - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local 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. @@ -1097,7 +1104,8 @@ __END1__ dyn_rpm() { - case "$EAPI" in 0|1|2) local EPREFIX= ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local EPREFIX= ;; esac cd "${T}" || die "cd failed" local machine_name=$(uname -m) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index f46368d68..351ae9e1d 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -96,6 +96,8 @@ filter_readonly_variables() { # supported by the current EAPI. case "${EAPI:-0}" in 0|1|2) + [[ " ${USE} " == *" prefix "* ]] && \ + filtered_vars+=" ED EPREFIX EROOT" ;; *) filtered_vars+=" ED EPREFIX EROOT" @@ -500,7 +502,8 @@ dyn_install() { ebuild_phase pre_src_install _x=${ED} - case "$EAPI" in 0|1|2) _x=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) _x=${D} ;; esac rm -rf "${D}" mkdir -p "${_x}" unset _x diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 04cf35aa4..aadfac17d 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -19,7 +19,8 @@ into() { export DESTTREE="" else export DESTTREE=$1 - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac if [ ! -d "${ED}${DESTTREE}" ]; then install -d "${ED}${DESTTREE}" local ret=$? @@ -36,7 +37,8 @@ insinto() { export INSDESTTREE="" else export INSDESTTREE=$1 - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac if [ ! -d "${ED}${INSDESTTREE}" ]; then install -d "${ED}${INSDESTTREE}" local ret=$? @@ -53,7 +55,8 @@ exeinto() { export _E_EXEDESTTREE_="" else export _E_EXEDESTTREE_="$1" - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then install -d "${ED}${_E_EXEDESTTREE_}" local ret=$? @@ -70,7 +73,8 @@ docinto() { export _E_DOCDESTTREE_="" else export _E_DOCDESTTREE_="$1" - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" local ret=$? @@ -137,7 +141,8 @@ docompress() { keepdir() { dodir "$@" local x - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then shift find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \ @@ -374,7 +379,8 @@ unpack() { econf() { local x - case "$EAPI" in 0|1|2) local EPREFIX= ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local EPREFIX= ;; esac _hasg() { local x s=$1 @@ -470,7 +476,8 @@ econf() { einstall() { # CONF_PREFIX is only set if they didn't pass in libdir above. local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}" - case "$EAPI" in 0|1|2) local ED=${D} ;; esac + [[ " ${USE} " == *" prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=${D} ;; esac LIBDIR_VAR="LIBDIR_${ABI}" if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then CONF_LIBDIR="${!LIBDIR_VAR}" @@ -600,7 +607,8 @@ has_version() { local eroot case "$EAPI" in 0|1|2) - eroot=${ROOT} + [[ " ${USE} " == *" prefix "* ]] && \ + eroot=${ROOT%/}${EPREFIX}/ || eroot=${ROOT} ;; *) eroot=${ROOT%/}${EPREFIX}/ @@ -634,7 +642,8 @@ best_version() { local eroot case "$EAPI" in 0|1|2) - eroot=${ROOT} + [[ " ${USE} " == *" prefix "* ]] && \ + eroot=${ROOT%/}${EPREFIX}/ || eroot=${ROOT} ;; *) eroot=${ROOT%/}${EPREFIX}/ diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 2995740bc..1ccaee7c8 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -2238,8 +2238,17 @@ class config(object): if not eapi_exports_merge_type(eapi): mydict.pop("MERGE_TYPE", None) - # Prefix variables are supported starting with EAPI 3. - if phase == 'depend' or eapi is None or not eapi_supports_prefix(eapi): + # Prefix variables are supported beginning with EAPI 3, or when EPREFIX + # is non-empty (implying that EPREFIX support is required in the + # current environment, regardless of EAPI). For EAPIs prior to 3, + # ebuild helpers rely on these variables only when USE=prefix is + # enabled. This is safe because the prefix flag should be masked in all + # non-prefix profiles, and older EAPIs would otherwise be useless with + # prefix configurations. This brings compatibility with the prefix + # branch of portage, which also supports EPREFIX for all EAPIs (for + # obvious reasons). + if phase == 'depend' or eapi is None or \ + (not eapi_supports_prefix(eapi) and not mydict.get("EPREFIX")): mydict.pop("ED", None) mydict.pop("EPREFIX", None) mydict.pop("EROOT", None)