diff options
Diffstat (limited to 'bin/phase-functions.sh')
-rw-r--r-- | bin/phase-functions.sh | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 97e762a39..7a0baf453 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -100,15 +100,9 @@ __filter_readonly_variables() { # 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_.*" @@ -364,7 +358,7 @@ __dyn_prepare() { 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}" @@ -395,7 +389,7 @@ __dyn_configure() { 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}" @@ -428,7 +422,7 @@ __dyn_compile() { 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}" @@ -510,16 +504,18 @@ __dyn_install() { 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}" @@ -571,15 +567,9 @@ __dyn_install() { # 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 @@ -669,14 +659,13 @@ __dyn_help() { # 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) @@ -689,11 +678,11 @@ __ebuild_arg_to_phase() { 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) @@ -853,7 +842,7 @@ __ebuild_main() { # 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 |