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_"]
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
-#!/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"
-#!/bin/bash
+#!@PORTAGE_BASH@
- #!/bin/bash
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
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
-#!/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
-#!/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
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}"
-#!/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
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
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)
-#!/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
-#!/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
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
-#!/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
-#!/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
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"
-#!/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)
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
-#!/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
-#!/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="/"
-#!/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="/"
# 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"
-#!/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
-#!/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
# 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}}
-#!/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}"
# 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
-#!/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}"
# 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
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
${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
# 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
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
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
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"
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
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=$?
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=$?
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=$?
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=$?
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" \
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}"
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
"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:
["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 = {}
["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 = {