Merge commit 'v2.2.0_alpha74' into prefix
authorFabian Groffen <grobian@gentoo.org>
Fri, 2 Dec 2011 19:14:03 +0000 (20:14 +0100)
committerFabian Groffen <grobian@gentoo.org>
Fri, 2 Dec 2011 19:14:03 +0000 (20:14 +0100)
Most important, fix the _doebuild_path function for Prefix

Conflicts:
bin/dohtml.py
bin/ebuild-helpers/dobin
bin/ebuild-helpers/dodir
bin/ebuild-helpers/dodoc
bin/ebuild-helpers/doexe
bin/ebuild-helpers/dohard
bin/ebuild-helpers/doinfo
bin/ebuild-helpers/doins
bin/ebuild-helpers/dolib
bin/ebuild-helpers/domo
bin/ebuild-helpers/dosbin
bin/ebuild-helpers/dosed
bin/ebuild-helpers/dosym
bin/ebuild-helpers/ecompressdir
bin/ebuild-helpers/fowners
bin/ebuild-helpers/fperms
bin/ebuild-helpers/prepalldocs
bin/ebuild-helpers/prepallinfo
bin/ebuild-helpers/prepallman
bin/ebuild-helpers/prepallstrip
bin/ebuild-helpers/prepinfo
bin/ebuild-helpers/preplib
bin/ebuild-helpers/prepstrip
bin/ebuild.sh
bin/misc-functions.sh
bin/phase-helpers.sh
pym/portage/dbapi/bintree.py

41 files changed:
1  2 
bin/dohtml.py
bin/ebuild-helpers/dobin
bin/ebuild-helpers/dodir
bin/ebuild-helpers/dodoc
bin/ebuild-helpers/doexe
bin/ebuild-helpers/dohard
bin/ebuild-helpers/doinfo
bin/ebuild-helpers/doins
bin/ebuild-helpers/dolib
bin/ebuild-helpers/doman
bin/ebuild-helpers/domo
bin/ebuild-helpers/dosbin
bin/ebuild-helpers/dosed
bin/ebuild-helpers/dosym
bin/ebuild-helpers/ecompressdir
bin/ebuild-helpers/fowners
bin/ebuild-helpers/fperms
bin/ebuild-helpers/prepall
bin/ebuild-helpers/prepalldocs
bin/ebuild-helpers/prepallinfo
bin/ebuild-helpers/prepallman
bin/ebuild-helpers/prepallstrip
bin/ebuild-helpers/prepinfo
bin/ebuild-helpers/preplib
bin/ebuild-helpers/prepman
bin/ebuild-helpers/prepstrip
bin/ebuild.sh
bin/isolated-functions.sh
bin/misc-functions.sh
bin/phase-functions.sh
bin/phase-helpers.sh
bin/save-ebuild-env.sh
man/emerge.1
pym/_emerge/actions.py
pym/_emerge/depgraph.py
pym/_emerge/main.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py
pym/portage/package/ebuild/_config/special_env_vars.py
pym/portage/package/ebuild/doebuild.py
runtests.sh

diff --cc bin/dohtml.py
index bf9bcc836f8065d277155bbdddb63533a49549ab,122daf3f5ce7f9ff55e0a99f70dab0ec033baf36..546e6989dc14f748b5ab93397542d21f0f09e13f
@@@ -91,8 -91,10 +91,13 @@@ class OptionsClass
                
                if "PF" in os.environ:
                        self.PF = os.environ["PF"]
-               if os.environ.has_key("ED"):
-                       self.ED = os.environ["ED"]
 -              if os.environ.get("EAPI", "0") in ("0", "1", "2"):
 -                      self.ED = os.environ.get("D", "")
 -              else:
++              # PREFIX LOCAL: always retrieve ED
++              #if os.environ.get("EAPI", "0") in ("0", "1", "2"):
++              #       self.ED = os.environ.get("D", "")
++              #else:
++              if True:
+                       self.ED = os.environ.get("ED", "")
++              # END PREFIX LOCAL
                if "_E_DOCDESTTREE_" in os.environ:
                        self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"]
                
index e158a71768f074192df660be990dafb703f1e2da,af3af0d841783aacf1a86d7ebc16bf6efcde4b20..8adc65d48e3b32baef3a6b29ff6830b0f35c3a6d
@@@ -9,6 -9,8 +9,10 @@@ if [[ $# -lt 1 ]] ; the
        exit 1
  fi
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then
        install -d "${ED}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; }
  fi
index 7da507aee79a397665c4e02e527dc98ca6c7b491,7db7cafb141b10590f50bf3e0e5a6f6f55182ea9..06dd2fe7216d9fe0e10c8e8de0f8ed093f9cefcf
@@@ -1,9 -1,11 +1,13 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  install -d ${DIROPTIONS} "${@/#/${ED}/}"
  ret=$?
  [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
index 41fc8f5acfb22540e34796405cbc288524841ea4,37bbc79d037b947d473ecf201875dc6c9da59bf1..d1bcb4f26ad6e61880e80f24a71addaf7ed70389
@@@ -1,5 -1,4 +1,4 @@@
 -#!/bin/bash
 +#!@PORTAGE_BASH@
- #!/bin/bash
  # Copyright 1999-2011 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
@@@ -10,7 -9,9 +9,11 @@@ if [ $# -lt 1 ] ; the
        exit 1  
  fi
  
- dir="${ED}/usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
+ dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
  if [ ! -d "${dir}" ] ; then
        install -d "${dir}"
  fi
index 4f4040283c1e8fcd52acc0babfa574d128715481,a5b9af0ebc04ea72a20febdd043425c313737a73..ecf0b9a4c4f5aba96ec395ba615bfc39f55991ae
@@@ -1,14 -1,16 +1,18 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
  if [[ $# -lt 1 ]] ; then
        helpers_die "${0##*/}: at least one argument needed"
        exit 1
  fi
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
        install -d "${ED}${_E_EXEDESTTREE_}"
  fi
index c7c568ce254ab673ed2bb8ae70c13db816e9e7c1,cf6fb112dff8a47f731aa6b9f186fb4b03724a56..b5f8f70e45695c8d1e8ee056eb2d5f4fab9c693c
@@@ -1,5 -1,5 +1,5 @@@
 -#!/bin/bash
 +#!@PORTAGE_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,6 -7,8 +7,10 @@@
        exit 1
  fi
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  destdir=${2%/*}
  [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
  
index 3cfbe6f325e9cc5363414893e53daf9001441358,a922ef1be307ae11e47295b7715445b1e8f3a3be..56d9821d8e89ff838336c5bc9880aceaffb2d0b1
@@@ -1,5 -1,5 +1,5 @@@
 -#!/bin/bash
 +#!@PORTAGE_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,6 -9,8 +9,10 @@@ if [[ -z $1 ]] ; the
        exit 1  
  fi
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  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
index c91883ba7e15073ceaad34ae08ddc481db5c27ce,b9189d5ed90a076e7349462736e5824b82444658..46796cb3ba683fe17acfbe78f5ed98aa31a167a4
@@@ -32,16 -34,9 +34,16 @@@ if [[ ${INSDESTTREE#${ED}} != "${INSDES
        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
 +if [[ ${INSDESTTREE#${EPREFIX}} != "${INSDESTTREE}" ]]; then
 +      vecho "-------------------------------------------------------" 1>&2
 +      vecho "You should not use \${EPREFIX} with helpers." 1>&2
 +      vecho "  --> ${INSDESTTREE}" 1>&2
 +      vecho "-------------------------------------------------------" 1>&2
 +      exit 1
 +fi
  
  case "$EAPI" in
        0|1|2|3|3_pre2)
index 53805ea304c08b4e55d73e2b1d7e3c4dcaaa2ed6,9dd11d85703e32f4b40180b80146105e9f11f567..5b1b1be289b4b58036195aed6245ba4d5e178f53
@@@ -1,9 -1,11 +1,13 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  # Setup ABI cruft
  LIBDIR_VAR="LIBDIR_${ABI}"
  if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
Simple merge
index f8a7bb94aa2c60532df179895f4f95e69379641d,0e3656d588f3d69533798171b090b8987051fb8a..33af83ed6001d913e6fb039d7bc2ac768fd13c5d
@@@ -1,5 -1,5 +1,5 @@@
 -#!/bin/bash
 +#!@PORTAGE_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,6 -9,9 +9,11 @@@ if [ ${mynum} -lt 1 ] ; the
        helpers_die "${0}: at least one argument needed"
        exit 1
  fi
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
        install -d "${ED}${DESTTREE}/share/locale/"
  fi
index d1400f44edc88336a197321d9df4b7c2bb354361,d0783ed33a271a08f0c05098a23a7852c99c3630..e52df71739c6d9c06a9dcb90b6a1bd4e1e375be6
@@@ -1,14 -1,16 +1,18 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
  if [[ $# -lt 1 ]] ; then
        helpers_die "${0##*/}: at least one argument needed"
        exit 1
  fi
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then
        install -d "${ED}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; }
  fi
index 40cf39a05c1f126856451b9f07df58018b484b06,00cf5da17d71127ced55ce5454e84b5e9dbc15a6..5e234b317d25751e744dd1705b3c499886aa9a89
@@@ -1,5 -1,5 +1,5 @@@
 -#!/bin/bash
 +#!@PORTAGE_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,6 -7,8 +7,10 @@@
        exit 1
  fi
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  ret=0
  file_found=0
  mysed="s:${ED}::g"
index 16e0df0596e2c22fb07e5b8dabd1c9794014f8de,8b7b304ee869258f20e827e6739abdac4d58abbd..e5da3332f4e54e5021c3ee20410f18a3c470efbc
@@@ -1,14 -1,16 +1,18 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
  if [[ $# -ne 2 ]] ; then
        helpers_die "${0##*/}: two arguments needed"
        exit 1
  fi
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  if [[ ${2} == */ ]] || \
        [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
        # implicit basename not allowed by PMS (bug #379899)
@@@ -18,9 -20,7 +22,11 @@@ f
  destdir=${2%/*}
  [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
  
 -ln -snf "$1" "${ED}$2"
++# PREFIX LOCAL: when absolute, prefix with offset
 +target="${1}"
 +[[ ${target:0:1} == "/" ]] && target="${EPREFIX}${target}"
- ln -snf "${target}" "${ED}/${2}"
++ln -snf "${target}" "${ED}${2}"
++# END PREFIX LOCAL
  ret=$?
  [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
  exit $ret
index 3d5af2d9552882cea4c43a3f8d3d8ed742560a08,f9a846a90bc463346413a7c77bd26d09cce10355..32196695abd60886a44522fb72316550ba72ebad
@@@ -1,14 -1,16 +1,18 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
  if [[ -z $1 ]] ; then
        helpers_die "${0##*/}: at least one argument needed"
        exit 1
  fi
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  case $1 in
        --ignore)
                shift
index 0c5295b78ab60709e1e3a8ac10db1cddb0021228,3f51b4e540527eac1fdb66646ffdd2db2378018d..5c1ecac8b0d62a1ec5b9cee700e55f1f3a100023
@@@ -1,14 -1,11 +1,18 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
 +if hasq prefix ${USE} && [[ $EUID != 0 ]] ; then
 +      ewarn "fowners ignored in Prefix with non-privileged user"
 +      exit 0
 +fi
 +
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  # we can't prefix all arguments because
  # chown takes random options
  slash="/"
index dec0b4294b96cd206dfa211c4e720a7f4a48d06e,9a2971ae568ede6e16008e868a7437e709a51efb..25f77a9b75a4e4f2f73e599d066174246a6b7149
@@@ -1,9 -1,10 +1,12 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  # we can't prefix all arguments because
  # chmod takes random options
  slash="/"
index a765756ccc40724099037e348207e59faf11d852,611c4ce79348793c88c33ea7a425d53c4988a81c..c4e9ffccd02473d65f134e87cd7943832a565ebf
@@@ -2,10 -2,10 +2,12 @@@
  # 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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
 +
 +[[ -d ${ED} ]] || exit 0
  
+ 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 "${ED}" -k flags > "${T}/bsdflags.mtree"
index ab4166efe78ad20eb7afcb7362bb6c77ea332845,540d02500baa1aeabbde6a5a4bb1aa74d54bd779..67a3d8f3a8e18ccfdc01f31ba125a47723d0d87a
@@@ -1,15 -1,16 +1,18 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
  if [[ -n $1 ]] ; then
        vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
  fi
  
- cd "${D}"
- [[ -d ${EPREFIX}usr/share/doc ]] || exit 0
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
+ [[ -d ${ED}usr/share/doc ]] || exit 0
  
  ecompressdir --ignore /usr/share/doc/${PF}/html
  ecompressdir --queue /usr/share/doc
index 249e897a21f1a507e61b1f978a7425457c8d6a44,e351f878bec3348dcd73cef4dd684c0a562fc342..2b1b5b48ec6ecd200b2678e2ecfad48d648b2bbc
@@@ -1,7 -1,11 +1,13 @@@
 -#!/bin/bash
 +#!@PORTAGE_BASH@
- # Copyright 1999-2006 Gentoo Foundation
+ # Copyright 1999-2011 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
- [[ ! -d ${ED}usr/share/info ]] && exit 0
 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
++source "${PORTAGE_BIN_PATH:-@PORTAGE_BIN_PATH@}"/isolated-functions.sh
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
+ [[ -d ${ED}usr/share/info ]] || exit 0
  
  exec prepinfo
index 19437dd009baa5243f3c0d6907bc758034531d13,be7f19453d53d47b349bcee2a4b9e70a4b52260e..a7bb30b558a5dc767a2a0e08b7e4f13275fffd99
@@@ -7,10 -7,10 +7,16 @@@ source "${PORTAGE_BIN_PATH:-@PORTAGE_BA
  # replaced by controllable compression in EAPI 4
  has "${EAPI}" 0 1 2 3 || exit 0
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  ret=0
  
++# PREFIX LOCAL: ED needs not to exist, wheras D does
 +[[ -d ${ED} ]] || exit ${ret}
++# END PREFIX LOCAL
 +
  find "${ED}" -type d -name man > "${T}"/prepallman.filelist
  while read -r mandir ; do
        mandir=${mandir#${ED}}
index 18ce4cc3c14cf927dbee078df407394f586e0f55,e9f5f8e3e65a531f6aa4d4e39282f2b9ae9facfe..b03c05318ea435c786caaaefd66a14f1541e7e0e
@@@ -1,5 -1,7 +1,9 @@@
 -#!/bin/bash
 +#!@PORTAGE_BASH@
- # Copyright 1999-2006 Gentoo Foundation
+ # 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
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  exec prepstrip "${ED}"
index c350fba0fb8cdf350d85f5522ef62d4600785654,afe214c6b9e2a66388ff0042e11269eee65cf526..c0ab9c9fb29972db9c4ce0231255ddb42bb4ef8b
@@@ -2,15 -2,17 +2,19 @@@
  # 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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  if [[ -z $1 ]] ; then
-       infodir="${EPREFIX}/usr/share/info"
+       infodir="/usr/share/info"
  else
        if [[ -d ${ED}$1/share/info ]] ; then
-               infodir="${EPREFIX}$1/share/info"
+               infodir="$1/share/info"
        else
-               infodir="${EPREFIX}$1/info"
+               infodir="$1/info"
        fi
  fi
  
index 8b9e04d48b4ae90867baea313aa1c0fc8dd02dba,8c62921010b17aa16b2b2ffa22897f2afe2db753..7090d0c253e28e52276fa92af02aa837b7079ebf
@@@ -1,11 -1,13 +1,15 @@@
 -#!/bin/bash
 +#!@PORTAGE_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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
  eqawarn "QA Notice: Deprecated call to 'preplib'"
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  LIBDIR_VAR="LIBDIR_${ABI}"
  if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
        CONF_LIBDIR="${!LIBDIR_VAR}"
index f8c670feca0b69d0daefe89a5b952f6abbf2c73c,8ea7607df87f1486a6274616a81317265e3dac5c..2c10b26f95325d5583694710faa17b86699fb022
@@@ -2,8 -2,10 +2,10 @@@
  # 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
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
  
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
  if [[ -z $1 ]] ; then 
        mandir="${ED}usr/share/man"
  else
index 0305f0a3acc1459870a04391d5203157dbfd1ac5,fac20b24f6fd06bf35aa1f5345af7bfa83bf8aca..927078aee4223b1f3cdcb830e393932696ee33cc
@@@ -18,6 -18,8 +18,10 @@@ exp_tf() 
  exp_tf FEATURES installsources nostrip splitdebug
  exp_tf RESTRICT binchecks installsources strip
  
 -case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# PREFIX LOCAL: always support ED
++#case "$EAPI" in 0|1|2) ED=${D} ;; esac
++# END PREFIX LOCAL
  banner=false
  SKIP_STRIP=false
  if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
@@@ -99,7 -101,7 +103,9 @@@ save_elf_debug() 
        ${FEATURES_splitdebug} || return 0
  
        local x=$1
 -      local y="${ED}usr/lib/debug/${x:${#ED}}.debug"
++      # PREFIX LOCAL: keep offset path in debug location file
 +      local y="${ED}usr/lib/debug/${x:${#D}}.debug"
++      # END PREFIX LOCAL
  
        # dont save debug info twice
        [[ ${x} == *".debug" ]] && return 0
  
        local inode=$(inode_var_name "$x")
        if [[ -n ${!inode} ]] ; then
 -              ln "${ED}usr/lib/debug/${!inode:${#ED}}.debug" "$y"
++              # PREFIX LOCAL: keep offset path in debug location file
 +              ln "${ED}usr/lib/debug/${!inode:${#D}}.debug" "$y"
++              # END PREFIX LOCAL
        else
                eval $inode=\$x
                if [[ -e ${T}/prepstrip.split.debug ]] ; then
diff --cc bin/ebuild.sh
index 79525154ff66a3626562b282edb1596528e4902d,f39e5362a3c91bf18c2da702e3181731ca35030e..2ec34cd961d389b3c575308e998d63fe08387e0c
@@@ -2,23 -2,9 +2,9 @@@
  # Copyright 1999-2011 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
 -PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"
 -PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}"
 +PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"
 +PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-@PORTAGE_BASE@/pym}"
  
- ROOTPATH=${ROOTPATH##:}
- ROOTPATH=${ROOTPATH%%:}
- PREROOTPATH=${PREROOTPATH##:}
- PREROOTPATH=${PREROOTPATH%%:}
- #PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
- # PREFIX: our DEFAULT_PATH is equal to the above when not using an
- # offset prefix.  With such prefix, the usr/local bits are excluded, and
- # the prefixed variants of {usr/,}{s,}bin are taken.  The additional
- # paths given during configure, always come as last thing since they
- # should never override anything from the prefix itself.
- PATH="$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}"
- export PATH
  # Prevent aliases from causing portage to act inappropriately.
  # Make sure it's before everything so we don't mess aliases that follow.
  unalias -a
index 12edfbcd9990221054e711bd3211b353d2f3d3a4,d2ea319bd8bccd01df7aff2ac0c12708a6ae0deb..d9e46493a64d5b009cd4df78e8636ee6d74a8b6f
@@@ -436,36 -438,25 +440,31 @@@ RC_INDENTATION='
  RC_DEFAULT_INDENT=2
  RC_DOT_PATTERN=''
  
- if [[ $EBUILD_PHASE == depend ]] ; then
-       # avoid unneeded stty call in set_colors during "depend" phase
-       unset_colors
- else
-       case "${NOCOLOR:-false}" in
-               yes|true)
-                       unset_colors
-                       ;;
-               no|false)
-                       set_colors
-                       ;;
-       esac
- fi
+ case "${NOCOLOR:-false}" in
+       yes|true)
+               unset_colors
+               ;;
+       no|false)
+               set_colors
+               ;;
+ esac
  
 -if [[ -z ${USERLAND} ]] ; then
 -      case $(uname -s) in
 -      *BSD|DragonFly)
 -              export USERLAND="BSD"
 -              ;;
 -      *)
 -              export USERLAND="GNU"
 -              ;;
 -      esac
 -fi
 +# In Prefix every platform has USERLAND=GNU, even FreeBSD.  Since I
 +# don't know how to reliably "figure out" we are in a Prefix instance of
 +# portage here, I for now disable this check, and hardcode it to GNU.
 +# Somehow it appears stange to me that this code is in this file,
 +# non-ebuilds/eclasses should never rely on USERLAND and XARGS, don't they?
 +#if [[ -z ${USERLAND} ]] ; then
 +#     case $(uname -s) in
 +#     *BSD|DragonFly)
 +#             export USERLAND="BSD"
 +#             ;;
 +#     *)
 +#             export USERLAND="GNU"
 +#             ;;
 +#     esac
 +#fi
 +[[ -z ${USERLAND} ]] && USERLAND="GNU"
  
  if [[ -z ${XARGS} ]] ; then
        case ${USERLAND} in
index b0933825f3868338956b878ac8edd0afd8c7ae2b,1c11dc51a897866b17368b837d823348fc0caa72..58f5bc8e6de1f4018592abac57f7119852da4f98
mode 100644,100755..100644
  MISC_FUNCTIONS_ARGS="$@"
  shift $#
  
 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh"
 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}/ebuild.sh"
  
  install_symlink_html_docs() {
-       cd "${D}" || die "cd failed"
 -      case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++      # PREFIX LOCAL: always support ED
++      #case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++      # END PREFIX LOCAL
++      # PREFIX LOCAL: ED need not to exist, whereas D does
 +      [[ ! -d ${ED} ]] && dodir /
-       cd "${ED}" || die "cd shouldn't have failed"
++      # END PREFIX LOCAL
+       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
@@@ -147,8 -147,9 +152,13 @@@ prepcompress() 
  
  install_qa_check() {
        local f i x
 -      case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++      # PREFIX LOCAL: always support ED
++      #case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++      # END PREFIX LOCAL
  
 -      cd "${ED}" || die "cd failed"
++      # PREFIX LOCAL: ED needs not to exist, whereas D does
 +      cd "${D}" || die "cd failed"
++      # END PREFIX LOCAL
  
        export STRIP_MASK
        prepall
                sleep 1
        fi
  
-       # Prefix specific checks
-       [[ -n ${EPREFIX} ]] && install_qa_check_prefix
 +      # anything outside the prefix should be caught by the Prefix QA
 +      # check, so if there's nothing in ED, we skip searching for QA
 +      # checks there, the specific QA funcs can hence rely on ED existing
 +      if [[ -d ${ED} ]] ; then
 +              case ${CHOST} in
 +                      *-darwin*)
 +                              # Mach-O platforms (NeXT, Darwin, OSX)
 +                              install_qa_check_macho
 +                      ;;
 +                      *-interix*|*-winnt*)
 +                              # PECOFF platforms (Windows/Interix)
 +                              install_qa_check_pecoff
 +                      ;;
 +                      *-aix*)
 +                              # XCOFF platforms (AIX)
 +                              install_qa_check_xcoff
 +                      ;;
 +                      *)
 +                              # because this is the majority: ELF platforms (Linux,
 +                              # Solaris, *BSD, IRIX, etc.)
 +                              install_qa_check_elf
 +                      ;;
 +              esac
 +      fi
 +
 +      # this is basically here such that the diff with trunk remains just
 +      # offsetted and not out of order
 +      install_qa_check_misc
 +}
 +
 +install_qa_check_elf() {
        if type -P scanelf > /dev/null && ! has binchecks ${RESTRICT}; then
                local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
                local x
                if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && [[ "${PN}" != *-bin ]] ; then
                        qa_var="QA_DT_HASH_${ARCH/-/_}"
                        eval "[[ -n \${!qa_var} ]] && QA_DT_HASH=(\"\${${qa_var}[@]}\")"
-                       # use ED here, for the rest of the checks of scanelf's
-                       # output, scanelf is silent on non-existing ED
++
                        f=$(scanelf -qyRF '%k %p' -k .hash "${ED}" | sed -e "s:\.hash ::")
                        if [[ -n ${f} ]] ; then
                                echo "${f}" > "${T}"/scanelf-ignored-LDFLAGS.log
                # 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' "${ED}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:")
++              # PREFIX LOCAL: keep offset prefix in the recorded files
 +              f=$(scanelf -ByF '%n %p' "${ED}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
++              # END PREFIX LOCAL
                if [[ -n ${f} ]] ; then
                        echo "${f}" > "${T}"/scanelf-missing-NEEDED.log
                        if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then
  
                PORTAGE_QUIET=${tmp_quiet}
        fi
 +}
  
 -      local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${ED}:/:")
 +install_qa_check_misc() {
-       local unsafe_files=$(find "${D}" -type f '(' -perm -2002 -o -perm -4002 ')')
++      # PREFIX LOCAL: keep offset prefix in the reported files
++      local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${D}:/:")
++      # END PREFIX LOCAL
        if [[ -n ${unsafe_files} ]] ; then
                eqawarn "QA Notice: Unsafe files detected (set*id and world writable)"
                eqawarn "${unsafe_files}"
        abort="no"
        local a s
        for a in "${ED}"usr/lib*/*.a ; do
 -              s=${a%.a}.so
++              # PREFIX LOCAL: support MachO objects
 +              [[ ${CHOST} == *-darwin* ]] \
 +                      && s=${a%.a}.dylib \
 +                      || s=${a%.a}.so
++              # END PREFIX LOCAL
                if [[ ! -e ${s} ]] ; then
                        s=${s%usr/*}${s##*/usr/}
                        if [[ -e ${s} ]] ; then
        [[ ${abort} == "yes" ]] && die "add those ldscripts"
  
        # Make sure people don't store libtool files or static libs in /lib
-       # on AIX, "dynamic libs" have extension .a, so don't get false
-       # positives
 -      f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null)
++      # PREFIX LOCAL: on AIX, "dynamic libs" have extension .a, so don't
++      # get false positives
 +      [[ ${CHOST} == *-aix* ]] \
 +              && f=$(ls "${ED}"lib*/*.la 2>/dev/null || true) \
 +              || f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null)
++      # END PREFIX LOCAL
        if [[ -n ${f} ]] ; then
                vecho -ne '\n'
                eqawarn "QA Notice: Excessive files found in the / partition"
@@@ -894,372 -856,6 +910,371 @@@ install_qa_check_prefix() 
        fi
  }
  
 +install_qa_check_macho() {
 +      if ! has binchecks ${RESTRICT} ; then
 +              # on Darwin, dynamic libraries are called .dylibs instead of
 +              # .sos.  In addition the version component is before the
 +              # extension, not after it.  Check for this, and *only* warn
 +              # about it.  Some packages do ship .so files on Darwin and make
 +              # it work (ugly!).
 +              rm -f "${T}/mach-o.check"
 +              find ${ED%/} -name "*.so" -or -name "*.so.*" | \
 +              while read i ; do
 +                      [[ $(file $i) == *"Mach-O"* ]] && \
 +                              echo "${i#${D}}" >> "${T}/mach-o.check"
 +              done
 +              if [[ -f ${T}/mach-o.check ]] ; then
 +                      f=$(< "${T}/mach-o.check")
 +                      vecho -ne '\a\n'
 +                      eqawarn "QA Notice: Found .so dynamic libraries on Darwin:"
 +                      eqawarn "    ${f//$'\n'/\n    }"
 +              fi
 +              rm -f "${T}/mach-o.check"
 +
 +              # The naming for dynamic libraries is different on Darwin; the
 +              # version component is before the extention, instead of after
 +              # it, as with .sos.  Again, make this a warning only.
 +              rm -f "${T}/mach-o.check"
 +              find ${ED%/} -name "*.dylib.*" | \
 +              while read i ; do
 +                      echo "${i#${D}}" >> "${T}/mach-o.check"
 +              done
 +              if [[ -f "${T}/mach-o.check" ]] ; then
 +                      f=$(< "${T}/mach-o.check")
 +                      vecho -ne '\a\n'
 +                      eqawarn "QA Notice: Found wrongly named dynamic libraries on Darwin:"
 +                      eqawarn "    ${f// /\n    }"
 +              fi
 +              rm -f "${T}/mach-o.check"
 +      fi
 +
 +      # While we generate the NEEDED files, check that we don't get kernel
 +      # traps at runtime because of broken install_names on Darwin.
 +      rm -f "${T}"/.install_name_check_failed
 +      scanmacho -qyRF '%a;%p;%S;%n' "${D}" | { while IFS= read l ; do
 +              arch=${l%%;*}; l=${l#*;}
 +              obj="/${l%%;*}"; l=${l#*;}
 +              install_name=${l%%;*}; l=${l#*;}
 +              needed=${l%%;*}; l=${l#*;}
 +
 +              # See if the self-reference install_name points to an existing
 +              # and to be installed file.  This usually is a symlink for the
 +              # major version.
 +              if [[ ! -e ${D}${install_name} ]] ; then
 +                      eqawarn "QA Notice: invalid self-reference install_name ${install_name} in ${obj}"
 +                      # remember we are in an implicit subshell, that's
 +                      # why we touch a file here ... ideally we should be
 +                      # able to die correctly/nicely here
 +                      touch "${T}"/.install_name_check_failed
 +              fi
 +
 +              # this is ugly, paths with spaces won't work
 +              reevaluate=0
 +              for lib in ${needed//,/ } ; do
 +                      if [[ ${lib} == ${D}* ]] ; then
 +                              eqawarn "QA Notice: install_name references \${D}: ${lib} in ${obj}"
 +                              touch "${T}"/.install_name_check_failed
 +                      elif [[ ${lib} == ${S}* ]] ; then
 +                              eqawarn "QA Notice: install_name references \${S}: ${lib} in ${obj}"
 +                              touch "${T}"/.install_name_check_failed
 +                      elif [[ ! -e ${lib} && ! -e ${D}${lib} && ${lib} != "@executable_path/"* && ${lib} != "@loader_path/"* ]] ; then
 +                              # try to "repair" this if possible, happens because of
 +                              # gen_usr_ldscript tactics
 +                              s=${lib%usr/*}${lib##*/usr/}
 +                              if [[ -e ${D}${s} ]] ; then
 +                                      ewarn "correcting install_name from ${lib} to ${s} in ${obj}"
 +                                      install_name_tool -change \
 +                                              "${lib}" "${s}" "${D}${obj}"
 +                                      reevaluate=1
 +                              else
 +                                      eqawarn "QA Notice: invalid reference to ${lib} in ${obj}"
 +                                      # remember we are in an implicit subshell, that's
 +                                      # why we touch a file here ... ideally we should be
 +                                      # able to die correctly/nicely here
 +                                      touch "${T}"/.install_name_check_failed
 +                              fi
 +                      fi
 +              done
 +              if [[ ${reevaluate} == 1 ]]; then
 +                      # install_name(s) have been changed, refresh data so we
 +                      # store the correct meta data
 +                      l=$(scanmacho -qyF '%a;%p;%S;%n' ${D}${obj})
 +                      arch=${l%%;*}; l=${l#*;}
 +                      obj="/${l%%;*}"; l=${l#*;}
 +                      install_name=${l%%;*}; l=${l#*;}
 +                      needed=${l%%;*}; l=${l#*;}
 +              fi
 +
 +              # backwards compatability
 +              echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +              # what we use
 +              echo "${arch};${obj};${install_name};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.MACHO.3
 +      done }
 +      if [[ -f ${T}/.install_name_check_failed ]] ; then
 +              # secret switch "allow_broken_install_names" to get
 +              # around this and install broken crap (not a good idea)
 +              has allow_broken_install_names ${FEATURES} || \
 +                      die "invalid install_name found, your application or library will crash at runtime"
 +      fi
 +}
 +
 +install_qa_check_pecoff() {
 +      local _pfx_scan="readpecoff ${CHOST}"
 +
 +      # this one uses readpecoff, which supports multiple prefix platforms!
 +      # this is absolutely _not_ optimized for speed, and there may be plenty
 +      # of possibilities by introducing one or the other cache!
 +      if ! has binchecks ${RESTRICT}; then
 +              # copied and adapted from the above scanelf code.
 +              local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
 +              local f x
 +
 +              # display warnings when using stricter because we die afterwards
 +              if has stricter ${FEATURES} ; then
 +                      unset PORTAGE_QUIET
 +              fi
 +
 +              local _exec_find_opt="-executable"
 +              [[ ${CHOST} == *-winnt* ]] && _exec_find_opt='-name *.dll -o -name *.exe'
 +
 +              # Make sure we disallow insecure RUNPATH/RPATH's
 +              # Don't want paths that point to the tree where the package was built
 +              # (older, broken libtools would do this).  Also check for null paths
 +              # because the loader will search $PWD when it finds null paths.
 +
 +              f=$(
 +                      find "${ED}" -type f '(' ${_exec_find_opt} ')' -print0 | xargs -0 ${_pfx_scan} | \
 +                      while IFS=";" read arch obj soname rpath needed ; do \
 +                      echo "${rpath}" | grep -E "(${PORTAGE_BUILDDIR}|: |::|^:|^ )" > /dev/null 2>&1 \
 +                              && echo "${obj}"; done;
 +              )
 +              # Reject set*id binaries with $ORIGIN in RPATH #260331
 +              x=$(
 +                      find "${ED}" -type f '(' -perm -u+s -o -perm -g+s ')' -print0 | \
 +                      xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; do \
 +                      echo "${rpath}" | grep '$ORIGIN' > /dev/null 2>&1 && echo "${obj}"; done;
 +              )
 +              if [[ -n ${f}${x} ]] ; then
 +                      vecho -ne '\a\n'
 +                      eqawarn "QA Notice: The following files contain insecure RUNPATH's"
 +                      eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
 +                      eqawarn " with the maintaining herd of the package."
 +                      eqawarn "${f}${f:+${x:+\n}}${x}"
 +                      vecho -ne '\a\n'
 +                      if [[ -n ${x} ]] || has stricter ${FEATURES} ; then
 +                              insecure_rpath=1
 +                      else
 +                              eqawarn "cannot automatically fix runpaths on interix platforms!"
 +                      fi
 +              fi
 +
 +              rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +              rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
 +
 +              # Save NEEDED information after removing self-contained providers
 +              find "${ED}" -type f '(' ${_exec_find_opt} ')' -print0 | xargs -0 ${_pfx_scan} | { while IFS=';' read arch obj soname rpath needed; do
 +                      # need to strip image dir from object name.
 +                      obj="/${obj#${D}}"
 +                      if [ -z "${rpath}" -o -n "${rpath//*ORIGIN*}" ]; then
 +                              # object doesn't contain $ORIGIN in its runpath attribute
 +                              echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +                              echo "${arch};${obj};${soname};${rpath};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
 +                      else
 +                              dir=${obj%/*}
 +                              # replace $ORIGIN with the dirname of the current object for the lookup
 +                              opath=$(echo :${rpath}: | sed -e "s#.*:\(.*\)\$ORIGIN\(.*\):.*#\1${dir}\2#")
 +                              sneeded=$(echo ${needed} | tr , ' ')
 +                              rneeded=""
 +                              for lib in ${sneeded}; do
 +                                      found=0
 +                                      for path in ${opath//:/ }; do
 +                                              [ -e "${ED}/${path}/${lib}" ] && found=1 && break
 +                                      done
 +                                      [ "${found}" -eq 0 ] && rneeded="${rneeded},${lib}"
 +                              done
 +                              rneeded=${rneeded:1}
 +                              if [ -n "${rneeded}" ]; then
 +                                      echo "${obj} ${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +                                      echo "${arch};${obj};${soname};${rpath};${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
 +                              fi
 +                      fi
 +              done }
 +              
 +              if [[ ${insecure_rpath} -eq 1 ]] ; then
 +                      die "Aborting due to serious QA concerns with RUNPATH/RPATH"
 +              elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then
 +                      die "Aborting due to QA concerns: ${die_msg}"
 +              fi
 +
 +              local _so_ext='.so*'
 +
 +              case "${CHOST}" in
 +                      *-winnt*) _so_ext=".dll" ;; # no "*" intentionally!
 +              esac
 +
 +              # Run some sanity checks on shared libraries
 +              for d in "${ED}"lib* "${ED}"usr/lib* ; do
 +                      [[ -d "${d}" ]] || continue
 +                      f=$(find "${d}" -name "lib*${_so_ext}" -print0 | \
 +                              xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; \
 +                              do [[ -z "${soname}" ]] && echo "${obj}"; done)
 +                      if [[ -n ${f} ]] ; then
 +                              vecho -ne '\a\n'
 +                              eqawarn "QA Notice: The following shared libraries lack a SONAME"
 +                              eqawarn "${f}"
 +                              vecho -ne '\a\n'
 +                              sleep 1
 +                      fi
 +
 +                      f=$(find "${d}" -name "lib*${_so_ext}" -print0 | \
 +                              xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; \
 +                              do [[ -z "${needed}" ]] && echo "${obj}"; done)
 +                      if [[ -n ${f} ]] ; then
 +                              vecho -ne '\a\n'
 +                              eqawarn "QA Notice: The following shared libraries lack NEEDED entries"
 +                              eqawarn "${f}"
 +                              vecho -ne '\a\n'
 +                              sleep 1
 +                      fi
 +              done
 +
 +              PORTAGE_QUIET=${tmp_quiet}
 +      fi
 +}
 +
 +install_qa_check_xcoff() {
 +      if ! has binchecks ${RESTRICT}; then
 +              local tmp_quiet=${PORTAGE_QUIET}
 +              local queryline deplib
 +              local insecure_rpath_list= undefined_symbols_list=
 +
 +              # display warnings when using stricter because we die afterwards
 +              if has stricter ${FEATURES} ; then
 +                      unset PORTAGE_QUIET
 +              fi
 +
 +              rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED.XCOFF.1
 +
 +              local neededfd
 +              for neededfd in {3..1024} none; do ( : <&${neededfd} ) 2>/dev/null || break; done
 +              [[ ${neededfd} != none ]] || die "cannot find free file descriptor handle"
 +
 +              eval "exec ${neededfd}>\"${PORTAGE_BUILDDIR}\"/build-info/NEEDED.XCOFF.1" || die "cannot open ${PORTAGE_BUILDDIR}/build-info/NEEDED.XCOFF.1"
 +
 +              (       # work around a problem in /usr/bin/dump (used by aixdll-query)
 +                      # dumping core when path names get too long.
 +                      cd "${ED}" >/dev/null &&
 +                      find . -not -type d -exec \
 +                              aixdll-query '{}' FILE MEMBER FLAGS FORMAT RUNPATH DEPLIBS ';'
 +              ) > "${T}"/needed 2>/dev/null
 +
 +              # Symlinking shared archive libraries is not a good idea on aix,
 +              # as there is nothing like "soname" on pure filesystem level.
 +              # So we create a copy instead of the symlink.
 +              local prev_FILE=
 +              local FILE MEMBER FLAGS FORMAT RUNPATH DEPLIBS
 +              while read queryline
 +              do
 +                      FILE= MEMBER= FLAGS= FORMAT= RUNPATH= DEPLIBS=
 +                      eval ${queryline}
 +                      FILE=${FILE#./}
 +
 +                      if [[ ${prev_FILE} != ${FILE} ]]; then
 +                              if [[ " ${FLAGS} " == *" SHROBJ "* && -h ${ED}${FILE} ]]; then
 +                                      prev_FILE=${FILE}
 +                                      local target=$(readlink "${ED}${FILE}")
 +                                      if [[ ${target} == /* ]]; then
 +                                              target=${D}${target}
 +                                      else
 +                                              target=${FILE%/*}/${target}
 +                                      fi
 +                                      rm -f "${ED}${FILE}" || die "cannot prune ${FILE}"
 +                                      cp -f "${ED}${target}" "${ED}${FILE}" || die "cannot copy ${target} to ${FILE}"
 +                              fi
 +                      fi
 +              done <"${T}"/needed
 +
 +              prev_FILE=
 +              while read queryline
 +              do
 +                      FILE= MEMBER= FLAGS= FORMAT= RUNPATH= DEPLIBS=
 +                      eval ${queryline}
 +                      FILE=${FILE#./}
 +
 +                      if [[ -n ${MEMBER} && ${prev_FILE} != ${FILE} ]]; then
 +                              # Save NEEDED information for each archive library stub
 +                              # even if it is static only: the already installed archive
 +                              # may contain shared objects to be preserved.
 +                              echo "${FORMAT##* }${FORMAT%%-*};${EPREFIX}/${FILE};${FILE##*/};;" >&${neededfd}
 +                      fi
 +                      prev_FILE=${FILE}
 +
 +                      # shared objects have both EXEC and SHROBJ flags,
 +                      # while executables have EXEC flag only.
 +                      [[ " ${FLAGS} " == *" EXEC "* ]] || continue
 +
 +                      # Make sure we disallow insecure RUNPATH's
 +                      # Don't want paths that point to the tree where the package was built
 +                      # (older, broken libtools would do this).  Also check for null paths
 +                      # because the loader will search $PWD when it finds null paths.
 +                      # And we really want absolute paths only.
 +                      if [[ -n $(echo ":${RUNPATH}:" | grep -E "(${PORTAGE_BUILDDIR}|::|:[^/])") ]]; then
 +                              insecure_rpath_list="${insecure_rpath_list}\n${FILE}${MEMBER:+[${MEMBER}]}"
 +                      fi
 +
 +                      local needed=
 +                      [[ -n ${MEMBER} ]] && needed=${FILE##*/}
 +                      for deplib in ${DEPLIBS}; do
 +                              eval deplib=${deplib}
 +                              if [[ ${deplib} == '.' || ${deplib} == '..' ]]; then
 +                                      # Although we do have runtime linking, we don't want undefined symbols.
 +                                      # AIX does indicate this by needing either '.' or '..'
 +                                      undefined_symbols_list="${undefined_symbols_list}\n${FILE}"
 +                              else
 +                                      needed="${needed}${needed:+,}${deplib}"
 +                              fi
 +                      done
 +
 +                      FILE=${EPREFIX}/${FILE}
 +
 +                      [[ -n ${MEMBER} ]] && MEMBER="[${MEMBER}]"
 +                      # Save NEEDED information
 +                      echo "${FORMAT##* }${FORMAT%%-*};${FILE}${MEMBER};${FILE##*/}${MEMBER};${RUNPATH};${needed}" >&${neededfd}
 +              done <"${T}"/needed
 +
 +              eval "exec ${neededfd}>&-" || die "cannot close handle to ${PORTAGE_BUILDDIR}/build-info/NEEDED.XCOFF.1"
 +
 +              if [[ -n ${undefined_symbols_list} ]]; then
 +                      vecho -ne '\a\n'
 +                      eqawarn "QA Notice: The following files contain undefined symbols."
 +                      eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
 +                      eqawarn " with 'prefix' as the maintaining herd of the package."
 +                      eqawarn "${undefined_symbols_list}"
 +                      vecho -ne '\a\n'
 +              fi
 +
 +              if [[ -n ${insecure_rpath_list} ]] ; then
 +                      vecho -ne '\a\n'
 +                      eqawarn "QA Notice: The following files contain insecure RUNPATH's"
 +                      eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
 +                      eqawarn " with 'prefix' as the maintaining herd of the package."
 +                      eqawarn "${insecure_rpath_list}"
 +                      vecho -ne '\a\n'
 +                      if has stricter ${FEATURES} ; then
 +                              insecure_rpath=1
 +                      fi
 +              fi
 +
 +              if [[ ${insecure_rpath} -eq 1 ]] ; then
 +                      die "Aborting due to serious QA concerns with RUNPATH/RPATH"
 +              elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then
 +                      die "Aborting due to QA concerns: ${die_msg}"
 +              fi
 +
 +              PORTAGE_QUIET=${tmp_quiet}
 +      fi
 +}
 +
  install_mask() {
        local root="$1"
        shift
Simple merge
index 04cc291dedc9640dd9a5be1a3a7b44280c8571ba,04cf35aa44bb94b257cbe651fc73b3233261ba87..ad469edd504cf2126c5848a1e5c4c08385ce7f8e
@@@ -19,6 -19,7 +19,9 @@@ into() 
                export DESTTREE=""
        else
                export DESTTREE=$1
 -              case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++              # PREFIX LOCAL: always support ED
++              #case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++              # END PREFIX LOCAL
                if [ ! -d "${ED}${DESTTREE}" ]; then
                        install -d "${ED}${DESTTREE}"
                        local ret=$?
@@@ -35,6 -36,7 +38,9 @@@ insinto() 
                export INSDESTTREE=""
        else
                export INSDESTTREE=$1
 -              case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++              # PREFIX LOCAL: always support ED
++              #case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++              # END PREFIX LOCAL
                if [ ! -d "${ED}${INSDESTTREE}" ]; then
                        install -d "${ED}${INSDESTTREE}"
                        local ret=$?
@@@ -51,6 -53,7 +57,9 @@@ exeinto() 
                export _E_EXEDESTTREE_=""
        else
                export _E_EXEDESTTREE_="$1"
 -              case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++              # PREFIX LOCAL: always support ED
++              #case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++              # END PREFIX LOCAL
                if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then
                        install -d "${ED}${_E_EXEDESTTREE_}"
                        local ret=$?
@@@ -67,6 -70,7 +76,9 @@@ docinto() 
                export _E_DOCDESTTREE_=""
        else
                export _E_DOCDESTTREE_="$1"
 -              case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++              # PREFIX LOCAL: always support ED
++              #case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++              # END PREFIX LOCAL
                if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
                        install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
                        local ret=$?
@@@ -133,6 -137,7 +145,9 @@@ docompress() 
  keepdir() {
        dodir "$@"
        local x
 -      case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++      # PREFIX LOCAL: always support ED
++      #case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++      # END PREFIX LOCAL
        if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
                shift
                find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
@@@ -369,6 -374,8 +384,10 @@@ unpack() 
  econf() {
        local x
  
 -      case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
++      # PREFIX LOCAL: always support EPREFIX
++      #case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
++      # END PREFIX LOCAL
        _hasg() {
                local x s=$1
                shift
  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
++      # PREFIX LOCAL: always support ED
++      #case "$EAPI" in 0|1|2) local ED=${D} ;; esac
++      # END PREFIX LOCAL
        LIBDIR_VAR="LIBDIR_${ABI}"
        if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
                CONF_LIBDIR="${!LIBDIR_VAR}"
@@@ -581,15 -589,28 +603,30 @@@ _eapi4_src_install() 
        fi
  }
  
+ # @FUNCTION: has_version
+ # @USAGE: <DEPEND ATOM>
+ # @DESCRIPTION:
  # Return true if given package is installed. Otherwise return false.
- # Takes single depend-type atoms.
+ # Callers may override the ROOT variable in order to match packages from an
+ # alternative ROOT.
  has_version() {
  
 -              0|1|2)
 -                      eroot=${ROOT}
 -                      ;;
+       local eroot
+       case "$EAPI" in
++              # PREFIX LOCAL: always support ED
++              #0|1|2)
++              #       eroot=${ROOT}
++              #       ;;
++              # END PREFIX LOCAL
+               *)
+                       eroot=${ROOT%/}${EPREFIX}/
+                       ;;
+       esac
        if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
-               "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1"
+               "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "${eroot}" "$1"
        else
                PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-               "${PORTAGE_PYTHON:-@PORTAGE_PREFIX_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1"
 -              "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${eroot}" "$1"
++              "${PORTAGE_PYTHON:-@PORTAGE_PREFIX_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" has_version "${eroot}" "$1"
        fi
        local retval=$?
        case "${retval}" in
        esac
  }
  
+ # @FUNCTION: best_version
+ # @USAGE: <DEPEND ATOM>
+ # @DESCRIPTION:
  # Returns the best/most-current match.
- # Takes single depend-type atoms.
+ # Callers may override the ROOT variable in order to match packages from an
+ # alternative ROOT.
  best_version() {
  
 -              0|1|2)
 -                      eroot=${ROOT}
 -                      ;;
+       local eroot
+       case "$EAPI" in
++              # PREFIX LOCAL: always support ED
++              #0|1|2)
++              #       eroot=${ROOT}
++              #       ;;
++              # END PREFIX LOCAL
+               *)
+                       eroot=${ROOT%/}${EPREFIX}/
+                       ;;
+       esac
        if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
-               "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1"
+               "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "${eroot}" "$1"
        else
                PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-               "${PORTAGE_PYTHON:-@PORTAGE_PREFIX_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" best_version "${ROOT}" "$1"
 -              "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" best_version "${eroot}" "$1"
++              "${PORTAGE_PYTHON:-@PORTAGE_PREFIX_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" best_version "${eroot}" "$1"
        fi
        local retval=$?
        case "${retval}" in
Simple merge
diff --cc man/emerge.1
Simple merge
Simple merge
Simple merge
index e9eb025cb86f710e95d7a2b4e742af82f3d04478,a2995e2b7eddf0662c2ef3411fc7e10f896178a3..97a4b48e2f81782484131a95b0ac950ef6865da6
@@@ -98,9 -97,24 +98,24 @@@ shortmapping=
  "v":"--verbose",   "V":"--version"
  }
  
+ COWSAY_MOO = """
+   Larry loves Gentoo (%s)
+  _______________________
+ < Have you mooed today? >
+  -----------------------
+         \   ^__^
+          \  (oo)\_______
+             (__)\       )\/\ 
+                 ||----w |
+                 ||     ||
+ """
  def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
  
 -      if os.path.exists("/usr/bin/install-info"):
 +      if os.path.exists(EPREFIX + "/usr/bin/install-info"):
                out = portage.output.EOutput()
                regen_infodirs=[]
                for z in infodirs:
index 48c075f292174719b454fa7b17db1f8d75c07129,31ba364a465b7b23f6d14ab30670efca4b24e6a3..5f46dad6e2674b6f721cada696da77b6952e22d0
@@@ -69,7 -68,7 +69,7 @@@ class bindbapi(fakedbapi)
                        ["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS",
                        "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE",
                        "RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES",
-                       "REQUIRED_USE", "EPREFIX"])
 -                      ])
++                      "EPREFIX"])
                self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys)
                self._aux_cache = {}
  
@@@ -291,7 -290,7 +291,7 @@@ class binarytree(object)
                                ["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI",
                                "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES",
                                "PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES",
-                               "REQUIRED_USE", "BASE_URI", "EPREFIX"]
 -                              "BASE_URI"]
++                              "BASE_URI", "EPREFIX"]
                        self._pkgindex_aux_keys = list(self._pkgindex_aux_keys)
                        self._pkgindex_use_evaluated_keys = \
                                ("LICENSE", "RDEPEND", "DEPEND",
                                "SLOT"    : "0",
                                "USE"     : "",
                                "DEFINED_PHASES" : "",
-                               "REQUIRED_USE" : ""
                        }
 -                      self._pkgindex_inherited_keys = ["CHOST", "repository"]
 +                      self._pkgindex_inherited_keys = ["CHOST", "repository", "EPREFIX"]
  
                        # Populate the header with appropriate defaults.
                        self._pkgindex_default_header_data = {
Simple merge
diff --cc runtests.sh
Simple merge