From 11d543aacf2ee7f7f214a256aabf668ad27ca013 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 11 Sep 2011 16:15:28 -0700 Subject: [PATCH] ebuild.sh: move hasg* funcs into econf --- bin/ebuild.sh | 8 -------- bin/isolated-functions.sh | 4 ++-- bin/phase-helpers.sh | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 355a1c034..832b39dc9 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -166,14 +166,6 @@ strip_duplicate_slashes() { fi } -hasg() { - local x s=$1 - shift - for x ; do [[ ${x} == ${s} ]] && echo "${x}" && return 0 ; done - return 1 -} -hasgq() { hasg "$@" >/dev/null ; } - # debug-print() gets called from many places with verbose status information useful # for tracking down problems. The output is in $T/eclass-debug.log. # You can set ECLASS_DEBUG_OUTPUT to redirect the output somewhere else as well. diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 8e367fff1..c5adc0cc5 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -586,7 +586,7 @@ save_ebuild_env() { esyslog einfo einfon ewarn eerror ebegin _eend eend KV_major \ KV_minor KV_micro KV_to_int get_KV unset_colors set_colors has \ has_phase_defined_up_to \ - hasg hasgq hasv hasq qa_source qa_call \ + hasv hasq qa_source qa_call \ addread addwrite adddeny addpredict _sb_append_var \ use usev useq has_version portageq \ best_version use_with use_enable register_die_hook \ @@ -602,7 +602,7 @@ save_ebuild_env() { set_unless_changed unset_unless_changed source_all_bashrcs \ ebuild_main ebuild_phase ebuild_phase_with_hooks \ _ebuild_arg_to_phase _ebuild_phase_funcs default \ - _pipestatus \ + _hasg _hasgq _unpack_tar \ ${QA_INTERCEPTORS} # portage config variables and variables set directly by portage diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 1f39c7556..a033fa837 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -369,6 +369,15 @@ unpack() { econf() { local x + _hasg() { + local x s=$1 + shift + for x ; do [[ ${x} == ${s} ]] && echo "${x}" && return 0 ; done + return 1 + } + + _hasgq() { _hasg "$@" >/dev/null ; } + local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE") if [[ -n $phase_func ]] ; then if has "$EAPI" 0 1 ; then @@ -411,9 +420,9 @@ econf() { if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then CONF_LIBDIR=${!LIBDIR_VAR} fi - if [[ -n ${CONF_LIBDIR} ]] && ! hasgq --libdir=\* "$@" ; then - export CONF_PREFIX=$(hasg --exec-prefix=\* "$@") - [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(hasg --prefix=\* "$@") + if [[ -n ${CONF_LIBDIR} ]] && ! _hasgq --libdir=\* "$@" ; then + export CONF_PREFIX=$(_hasg --exec-prefix=\* "$@") + [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(_hasg --prefix=\* "$@") : ${CONF_PREFIX:=/usr} CONF_PREFIX=${CONF_PREFIX#*=} [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}" -- 2.26.2