--- /dev/null
+#!/bin/bash
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# PHASES
+
+___eapi_has_pkg_pretend() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_src_prepare() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1)$ ]]
+}
+
+___eapi_has_src_configure() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1)$ ]]
+}
+
+___eapi_default_src_test_disables_parallel_jobs() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_has_S_WORKDIR_fallback() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+# VARIABLES
+
+___eapi_has_prefix_variables() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2)$ || " ${FEATURES} " == *" force-prefix "* ]]
+}
+
+___eapi_has_HDEPEND() {
+ [[ ${1-${EAPI}} =~ ^(5-hdepend)$ ]]
+}
+
+___eapi_has_RDEPEND_DEPEND_fallback() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+# HELPERS PRESENCE
+
+___eapi_has_dohard() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_dosed() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_docompress() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_nonfatal() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_doheader() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_has_usex() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+# HELPERS BEHAVIOR
+
+___eapi_best_version_and_has_version_support_--host-root() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_unpack_supports_xz() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2)$ ]]
+}
+
+___eapi_econf_passes_--disable-dependency-tracking() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_econf_passes_--disable-silent-rules() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_use_enable_and_use_with_support_empty_third_argument() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_dodoc_supports_-r() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_doins_and_newins_preserve_symlinks() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_newins_supports_reading_from_standard_input() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_helpers_can_die() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_disallows_helpers_in_global_scope() {
+ [[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]]
+}
+
+# OTHERS
+
+___eapi_enables_globstar() {
+ [[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]]
+}
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 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
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then
install -d "${ED}${DESTTREE}/bin" || { __helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; }
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
install -d ${DIROPTIONS} "${@/#/${ED}/}"
ret=$?
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-case "${EAPI}" in
- 0|1|2|3)
- ;;
- *)
- exec \
- env \
- __PORTAGE_HELPER="dodoc" \
- doins "$@"
- ;;
-esac
+if ___eapi_dodoc_supports_-r; then
+ exec \
+ env \
+ __PORTAGE_HELPER="dodoc" \
+ doins "$@"
+fi
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
exit 1
fi
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
if [ ! -d "${dir}" ] ; then
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 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
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
install -d "${ED}${_E_EXEDESTTREE_}"
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-case "${EAPI}" in
- 0|1|2|3)
- ;;
- *)
- die "'${0##*/}' has been banned for EAPI '$EAPI'"
- exit 1
- ;;
-esac
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_dohard; then
+ die "'${0##*/}' has been banned for EAPI '$EAPI'"
+ exit 1
+fi
if [[ $# -ne 2 ]] ; then
echo "$0: two arguments needed" 1>&2
exit 1
fi
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
destdir=${2%/*}
[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "${EAPI}" in
- 0|1|2|3|4|4-python|4-slot-abi)
- die "${0##*/} is not supported in EAPI ${EAPI}"
- ;;
-esac
+if ! ___eapi_has_doheader; then
+ die "${0##*/} is not supported in EAPI ${EAPI}"
+fi
if [[ $# -lt 1 ]] || [[ $1 == -r && $# -lt 2 ]] ; then
__helpers_die "${0##*/}: at least one argument needed"
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 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
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
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; }
DOINSRECUR=n
fi
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
+if ! ___eapi_has_prefix_variables; then
+ export ED="${D}"
+fi
if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
__vecho "-------------------------------------------------------" 1>&2
exit 1
fi
-case "$EAPI" in
- 0|1|2|3)
- PRESERVE_SYMLINKS=n
- ;;
- *)
- PRESERVE_SYMLINKS=y
- ;;
-esac
+if ___eapi_doins_and_newins_preserve_symlinks; then
+ PRESERVE_SYMLINKS=y
+else
+ PRESERVE_SYMLINKS=n
+fi
export TMP=$T/.doins_tmp
# Use separate directories to avoid potential name collisions.
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
# Setup ABI cruft
LIBDIR_VAR="LIBDIR_${ABI}"
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 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
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
i18n=""
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 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
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
install -d "${ED}${DESTTREE}/share/locale/"
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 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
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then
install -d "${ED}${DESTTREE}/sbin" || { __helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; }
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-case "${EAPI}" in
- 0|1|2|3)
- ;;
- *)
- die "'${0##*/}' has been banned for EAPI '$EAPI'"
- exit 1
- ;;
-esac
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_dosed; then
+ die "'${0##*/}' has been banned for EAPI '$EAPI'"
+ exit 1
+fi
if [[ $# -lt 1 ]] ; then
echo "!!! ${0##*/}: at least one argument needed" >&2
exit 1
fi
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
ret=0
file_found=0
exit 1
fi
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
if [[ ${2} == */ ]] || \
[[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
exit 1
fi
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} EPREFIX= ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D} EPREFIX=
+fi
case $1 in
--ignore)
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) EPREFIX= ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ EPREFIX= ED=${D}
+fi
# we can't prefix all arguments because
# chown takes random options
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
# we can't prefix all arguments because
# chmod takes random options
eqawarn "QA Notice: ${helper} called with more than 2 arguments: ${@:3}"
stdin=
-case "${EAPI}" in
- 0|1|2|3|4|4-python|4-slot-abi) ;;
- *) [[ $1 = "-" ]] && stdin=yes ;;
-esac
+if ___eapi_newins_supports_reading_from_standard_input && [[ $1 == "-" ]]; then
+ stdin=yes
+fi
rm -rf "${T}/$2"
cp_args="-f"
if [[ ${helper} == newins ]] ; then
- case "${EAPI}" in
- 0|1|2|3)
- ;;
- *)
- cp_args+=" -P"
- ;;
- esac
+ if ___eapi_doins_and_newins_preserve_symlinks; then
+ cp_args+=" -P"
+ fi
fi
cp ${cp_args} "$1" "${T}/$2"
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
if has chflags $FEATURES ; then
# Save all the file flags for restoration at the end of prepall.
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "${EAPI}" in
- 0|1|2|3)
- ;;
- *)
- die "'${0##*/}' has been banned for EAPI '$EAPI'"
- exit 1
- ;;
-esac
+if ! ___eapi_has_docompress; then
+ die "'${0##*/}' has been banned for EAPI '$EAPI'"
+ exit 1
+fi
if [[ -n $1 ]] ; then
__vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
fi
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
[[ -d ${ED}usr/share/doc ]] || exit 0
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
[[ -d ${ED}usr/share/info ]] || exit 0
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
# replaced by controllable compression in EAPI 4
-has "${EAPI}" 0 1 2 3 || exit 0
+___eapi_has_docompress && exit 0
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
ret=0
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
exec prepstrip "${ED}"
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
if [[ -z $1 ]] ; then
infodir="/usr/share/info"
rm -f "${x}"/dir{,.info}{,.gz,.bz2}
done
-has "${EAPI}" 0 1 2 3 || exit 0
+___eapi_has_docompress && exit 0
exec ecompressdir --queue "${infodir}"
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
eqawarn "QA Notice: Deprecated call to 'preplib'"
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
LIBDIR_VAR="LIBDIR_${ABI}"
if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
if [[ -z $1 ]] ; then
mandir="${ED}usr/share/man"
fi
# replaced by controllable compression in EAPI 4
-has "${EAPI}" 0 1 2 3 || exit 0
+___eapi_has_docompress && exit 0
shopt -s nullglob
exp_tf FEATURES compressdebug installsources nostrip splitdebug
exp_tf RESTRICT binchecks installsources strip
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "${EAPI}" in 0|1|2) EPREFIX= ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+ EPREFIX= ED=${D}
+fi
banner=false
SKIP_STRIP=false
__strip_duplicate_slashes \
use_with use_enable ; do
eval "${x}() {
- if has \"\${EAPI:-0}\" 4-python 5-progress; then
+ if ___eapi_disallows_helpers_in_global_scope; then
die \"\${FUNCNAME}() calls are not allowed in global scope\"
fi
}"
done
- # These dummy functions return false in older EAPIs, in order to ensure that
+ # These dummy functions return false in non-strict EAPIs, in order to ensure that
# `use multislot` is false for the "depend" phase.
for x in use useq usev usex ; do
eval "${x}() {
- if has \"\${EAPI:-0}\" 4-python 5-progress; then
+ if ___eapi_disallows_helpers_in_global_scope; then
die \"\${FUNCNAME}() calls are not allowed in global scope\"
else
return 1
[[ -n $EAPI ]] || EAPI=0
fi
-if has "${EAPI:-0}" 4-python 5-progress; then
+if ___eapi_enables_globstar; then
shopt -s globstar
fi
# export EAPI for helpers (especially since we unset it above)
export EAPI
- if has "$EAPI" 0 1 2 3 ; then
+ if ___eapi_has_RDEPEND_DEPEND_fallback; then
export RDEPEND=${RDEPEND-${DEPEND}}
debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
fi
PROPERTIES DEFINED_PHASES HDEPEND UNUSED_04
UNUSED_03 UNUSED_02 UNUSED_01"
- case ${EAPI} in
- 5-hdepend)
- ;;
- *)
- unset HDEPEND
- ;;
- esac
+ if ! ___eapi_has_HDEPEND; then
+ unset HDEPEND
+ fi
# The extra $(echo) commands remove newlines.
if [ -n "${dbkey}" ] ; then
# Note: readonly variables interfere with __preprocess_ebuild_env(), so
# declare them only after it has already run.
declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
- case ${EAPI} in
- 0|1|2)
- [[ " ${FEATURES} " == *" force-prefix "* ]] && \
- declare -r ED EPREFIX EROOT
- ;;
- *)
- declare -r ED EPREFIX EROOT
- ;;
- esac
+ if ___eapi_has_prefix_variables; then
+ declare -r ED EPREFIX EROOT
+ fi
if [[ -n $EBUILD_SH_ARGS ]] ; then
(
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/eapi.sh"
+
# We need this next line for "die" and "assert". It expands
# It _must_ preceed all the calls to die and assert.
shopt -s expand_aliases
}
nonfatal() {
- if has "${EAPI:-0}" 0 1 2 3 ; then
+ if ! ___eapi_has_nonfatal; then
die "$FUNCNAME() not supported in this EAPI"
fi
if [[ $# -lt 1 ]]; then
}
__helpers_die() {
- case "${EAPI:-0}" in
- 0|1|2|3)
- echo -e "$@" >&2
- ;;
- *)
- die "$@"
- ;;
- esac
+ if ___eapi_helpers_can_die; then
+ die "$@"
+ else
+ echo -e "$@" >&2
+ fi
}
die() {
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh"
install_symlink_html_docs() {
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
cd "${ED}" || die "cd failed"
#symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf)
if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
prepcompress() {
local -a include exclude incl_d incl_f
local f g i real_f real_d
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
# Canonicalize path names and check for their existence.
real_d=$(canonicalize "${ED}")
install_qa_check() {
local f i qa_var x
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local EPREFIX= ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local EPREFIX= ED=${D}
+ fi
cd "${ED}" || die "cd failed"
export STRIP_MASK
prepall
- has "${EAPI}" 0 1 2 3 || prepcompress
+ ___eapi_has_docompress && prepcompress
ecompressdir --dequeue
ecompress --dequeue
return 1
fi
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
# Make sure $PWD is not ${D} so that we don't leave gmon.out files
# in there in case any tools were built with -pg in CFLAGS.
return 1
fi
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
# Smart FileSystem Permissions
if has sfperms $FEATURES; then
return 1
fi
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
# total suid control.
if has suidctl $FEATURES; then
__dyn_package() {
local PROOT
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local EPREFIX= ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local EPREFIX= ED=${D}
+ fi
# Make sure $PWD is not ${D} so that we don't leave gmon.out files
# in there in case any tools were built with -pg in CFLAGS.
}
__dyn_rpm() {
-
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local EPREFIX=
+ fi
cd "${T}" || die "cd failed"
local machine_name=$(uname -m)
# Don't filter/interfere with prefix variables unless they are
# supported by the current EAPI.
- case "${EAPI:-0}" in
- 0|1|2)
- [[ " ${FEATURES} " == *" force-prefix "* ]] && \
- filtered_vars+=" ED EPREFIX EROOT"
- ;;
- *)
- filtered_vars+=" ED EPREFIX EROOT"
- ;;
- esac
+ if ___eapi_has_prefix_variables; then
+ filtered_vars+=" ED EPREFIX EROOT"
+ fi
if has --filter-sandbox $* ; then
filtered_vars="${filtered_vars} SANDBOX_.*"
if [[ -d $S ]] ; then
cd "${S}"
- elif has $EAPI 0 1 2 3 ; then
+ elif ___eapi_has_S_WORKDIR_fallback; then
cd "${WORKDIR}"
elif [[ -z ${A} ]] && ! __has_phase_defined_up_to prepare; then
cd "${WORKDIR}"
if [[ -d $S ]] ; then
cd "${S}"
- elif has $EAPI 0 1 2 3 ; then
+ elif ___eapi_has_S_WORKDIR_fallback; then
cd "${WORKDIR}"
elif [[ -z ${A} ]] && ! __has_phase_defined_up_to configure; then
cd "${WORKDIR}"
if [[ -d $S ]] ; then
cd "${S}"
- elif has $EAPI 0 1 2 3 ; then
+ elif ___eapi_has_S_WORKDIR_fallback; then
cd "${WORKDIR}"
elif [[ -z ${A} ]] && ! __has_phase_defined_up_to compile; then
cd "${WORKDIR}"
trap "__abort_install" SIGINT SIGQUIT
__ebuild_phase pre_src_install
- _x=${ED}
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) _x=${D} ;; esac
+ if ___eapi_has_prefix_variables; then
+ _x=${ED}
+ else
+ _x=${D}
+ fi
rm -rf "${D}"
mkdir -p "${_x}"
unset _x
if [[ -d $S ]] ; then
cd "${S}"
- elif has $EAPI 0 1 2 3 ; then
+ elif ___eapi_has_S_WORKDIR_fallback; then
cd "${WORKDIR}"
elif [[ -z ${A} ]] && ! __has_phase_defined_up_to install; then
cd "${WORKDIR}"
# Save EPREFIX, since it makes it easy to use chpathtool to
# adjust the content of a binary package so that it will
# work in a different EPREFIX from the one is was built for.
- case "${EAPI:-0}" in
- 0|1|2)
- [[ " ${FEATURES} " == *" force-prefix "* ]] && \
- [ -n "${EPREFIX}" ] && echo "${EPREFIX}" > EPREFIX
- ;;
- *)
- [ -n "${EPREFIX}" ] && echo "${EPREFIX}" > EPREFIX
- ;;
- esac
+ if ___eapi_has_prefix_variables && [[ -n ${EPREFIX} ]]; then
+ echo "${EPREFIX}" > EPREFIX
+ fi
set +f
# Translate a known ebuild(1) argument into the precise
# name of it's corresponding ebuild phase.
__ebuild_arg_to_phase() {
- [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*"
- local eapi=$1
- local arg=$2
+ [ $# -ne 1 ] && die "expected exactly 1 arg, got $#: $*"
+ local arg=$1
local phase_func=""
case "$arg" in
pretend)
- ! has $eapi 0 1 2 3 && \
+ ___eapi_has_pkg_pretend && \
phase_func=pkg_pretend
;;
setup)
phase_func=src_unpack
;;
prepare)
- ! has $eapi 0 1 && \
+ ___eapi_has_src_prepare && \
phase_func=src_prepare
;;
configure)
- ! has $eapi 0 1 && \
+ ___eapi_has_src_configure && \
phase_func=src_configure
;;
compile)
# respect FEATURES="-ccache".
has ccache $FEATURES || export CCACHE_DISABLE=1
- local phase_func=$(__ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
+ local phase_func=$(__ebuild_arg_to_phase "$EBUILD_PHASE")
[[ -n $phase_func ]] && __ebuild_phase_funcs "$EAPI" "$phase_func"
unset phase_func
export DESTTREE=""
else
export DESTTREE=$1
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
if [ ! -d "${ED}${DESTTREE}" ]; then
install -d "${ED}${DESTTREE}"
local ret=$?
export INSDESTTREE=""
else
export INSDESTTREE=$1
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
if [ ! -d "${ED}${INSDESTTREE}" ]; then
install -d "${ED}${INSDESTTREE}"
local ret=$?
export _E_EXEDESTTREE_=""
else
export _E_EXEDESTTREE_="$1"
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then
install -d "${ED}${_E_EXEDESTTREE_}"
local ret=$?
export _E_DOCDESTTREE_=""
else
export _E_DOCDESTTREE_="$1"
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
local ret=$?
}
docompress() {
- has "${EAPI}" 0 1 2 3 && die "'docompress' not supported in this EAPI"
+ ___eapi_has_docompress || die "'docompress' not supported in this EAPI"
local f g
if [[ $1 = "-x" ]]; then
keepdir() {
dodir "$@"
local x
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
shift
find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
return 1
}
-case "${EAPI}" in
- 0|1|2|3|4|4-python|4-slot-abi) ;;
- *)
- usex() {
- if use "$1"; then
- echo "${2-yes}$4"
- else
- echo "${3-no}$5"
- fi
- return 0
- }
- ;;
-esac
+if ___eapi_has_usex; then
+ usex() {
+ if use "$1"; then
+ echo "${2-yes}$4"
+ else
+ echo "${3-no}$5"
+ fi
+ return 0
+ }
+fi
use() {
local u=$1
return 1
fi
- if ! has "${EAPI:-0}" 0 1 2 3 ; then
+ if ___eapi_use_enable_and_use_with_support_empty_third_argument; then
local UW_SUFFIX=${3+=$3}
else
local UW_SUFFIX=${3:+=$3}
return 1
fi
- if ! has "${EAPI:-0}" 0 1 2 3 ; then
+ if ___eapi_use_enable_and_use_with_support_empty_third_argument; then
local UE_SUFFIX=${3+=$3}
else
local UE_SUFFIX=${3:+=$3}
__unpack_tar "lzma -d"
;;
xz)
- if has $eapi 0 1 2 ; then
- __vecho "unpack ${x}: file format not recognized. Ignoring."
- else
+ if ___eapi_unpack_supports_xz; then
__unpack_tar "xz -d"
+ else
+ __vecho "unpack ${x}: file format not recognized. Ignoring."
fi
;;
*)
econf() {
local x
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local EPREFIX=
+ fi
__hasg() {
local x s=$1
__hasgq() { __hasg "$@" >/dev/null ; }
- local phase_func=$(__ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
+ local phase_func=$(__ebuild_arg_to_phase "$EBUILD_PHASE")
if [[ -n $phase_func ]] ; then
- if has "$EAPI" 0 1 ; then
+ if ! ___eapi_has_src_configure; then
[[ $phase_func != src_compile ]] && \
eqawarn "QA Notice: econf called in" \
"$phase_func instead of src_compile"
done
fi
- # EAPI=4 adds --disable-dependency-tracking to econf
- case "${EAPI}" in
- 0|1|2|3)
- ;;
- *)
- local conf_help=$("${ECONF_SOURCE}/configure" --help 2>/dev/null)
+ if ___eapi_econf_passes_--disable-dependency-tracking || ___eapi_econf_passes_--disable-silent-rules; then
+ local conf_help=$("${ECONF_SOURCE}/configure" --help 2>/dev/null)
+
+ if ___eapi_econf_passes_--disable-dependency-tracking; then
case "${conf_help}" in
*--disable-dependency-tracking*)
set -- --disable-dependency-tracking "$@"
;;
esac
- case "${EAPI}" in
- 4|4-python|4-slot-abi)
- ;;
- *)
- case "${conf_help}" in
- *--disable-silent-rules*)
- set -- --disable-silent-rules "$@"
- ;;
- esac
+ fi
+
+ if ___eapi_econf_passes_--disable-silent-rules; then
+ case "${conf_help}" in
+ *--disable-silent-rules*)
+ set -- --disable-silent-rules "$@"
;;
esac
- ;;
- esac
+ fi
+ fi
# if the profile defines a location to install libs to aside from default, pass it on.
# if the ebuild passes in --libdir, they're responsible for the conf_libdir fun.
einstall() {
# CONF_PREFIX is only set if they didn't pass in libdir above.
local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
- [[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if ! ___eapi_has_prefix_variables; then
+ local ED=${D}
+ fi
LIBDIR_VAR="LIBDIR_${ABI}"
if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
CONF_LIBDIR="${!LIBDIR_VAR}"
# to emulate the desired parts of emake behavior.
local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}"
local internal_opts=
- case "$EAPI" in
- 0|1|2|3|4|4-python|4-slot-abi)
- internal_opts+=" -j1"
- ;;
- esac
+ if ___eapi_default_src_test_disables_parallel_jobs; then
+ internal_opts+=" -j1"
+ fi
if $emake_cmd ${internal_opts} check -n &> /dev/null; then
__vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
$emake_cmd ${internal_opts} check || \
[ $# -gt 0 ] && die "${FUNCNAME[0]}: unused argument(s): $*"
if ${host_root} ; then
- case "${EAPI}" in
- 0|1|2|3|4|4-python|4-slot-abi)
- die "${FUNCNAME[0]}: option --host-root is not supported with EAPI ${EAPI}"
- ;;
- esac
+ if ! ___eapi_best_version_and_has_version_support_--host-root; then
+ die "${FUNCNAME[0]}: option --host-root is not supported with EAPI ${EAPI}"
+ fi
root=/
fi
- case "$EAPI" in
- 0|1|2)
- [[ " ${FEATURES} " == *" force-prefix "* ]] && \
- eroot=${root%/}${EPREFIX}/ || eroot=${root}
- ;;
- *)
- eroot=${root%/}${EPREFIX}/
- ;;
- esac
+ if ___eapi_has_prefix_variables; then
+ eroot=${root%/}${EPREFIX}/
+ else
+ eroot=${root}
+ fi
if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
"$PORTAGE_BIN_PATH"/ebuild-ipc has_version "${eroot}" "${atom}"
else
[ $# -gt 0 ] && die "${FUNCNAME[0]}: unused argument(s): $*"
if ${host_root} ; then
- case "${EAPI}" in
- 0|1|2|3|4|4-python|4-slot-abi)
- die "${FUNCNAME[0]}: option --host-root is not supported with EAPI ${EAPI}"
- ;;
- esac
+ if ! ___eapi_best_version_and_has_version_support_--host-root; then
+ die "${FUNCNAME[0]}: option --host-root is not supported with EAPI ${EAPI}"
+ fi
root=/
fi
- case "$EAPI" in
- 0|1|2)
- [[ " ${FEATURES} " == *" force-prefix "* ]] && \
- eroot=${root%/}${EPREFIX}/ || eroot=${root}
- ;;
- *)
- eroot=${root%/}${EPREFIX}/
- ;;
- esac
+ if ___eapi_has_prefix_variables; then
+ eroot=${root%/}${EPREFIX}/
+ else
+ eroot=${root}
+ fi
if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
"$PORTAGE_BIN_PATH"/ebuild-ipc best_version "${eroot}" "${atom}"
else
__unpack_tar __unset_colors \
${QA_INTERCEPTORS}
- case "${EAPI}" in
- 0|1|2|3|4|4-python|4-slot-abi) ;;
- *) unset -f usex ;;
- esac
+ if ___eapi_has_usex; then
+ unset -f usex
+ fi
+
+ unset -f $(compgen -A function ___eapi_)
# portage config variables and variables set directly by portage
unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \