diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-10-17 05:41:19 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-10-17 05:41:19 +0000 |
commit | 6601b0b0c1a66f61acf7d23775cfbb5acf002553 (patch) | |
tree | a99206f66ab8df5c05078066942399c853169076 | |
parent | fb15e6806685fa8937b4c99d24b48cc7fb62e852 (diff) | |
download | portage-6601b0b0c1a66f61acf7d23775cfbb5acf002553.tar.gz portage-6601b0b0c1a66f61acf7d23775cfbb5acf002553.tar.bz2 portage-6601b0b0c1a66f61acf7d23775cfbb5acf002553.zip |
Simplify the conditionals from bug #273648. Thanks to Jonathan Callen
<abcd@g.o> for this patch.
svn path=/main/trunk/; revision=14617
-rwxr-xr-x | bin/ebuild.sh | 31 | ||||
-rwxr-xr-x | bin/isolated-functions.sh | 1 |
2 files changed, 14 insertions, 18 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 1c864b04f..d6e833639 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -897,6 +897,15 @@ abort_install() { exit 1 } +has_phase_defined_up_to() { + for phase in unpack prepare configure compile install; do + has ${phase} ${DEFINED_PHASES} && return 0 + [[ ${phase} == $1 ]] && return 1 + done + # We shouldn't actually get here + return 1 +} + dyn_prepare() { if [[ -e $PORTAGE_BUILDDIR/.prepared ]] ; then @@ -909,9 +918,7 @@ dyn_prepare() { cd "${S}" elif hasq $EAPI 0 1 2; then cd "${WORKDIR}" - elif [[ -z ${A} ]] && \ - ! hasq unpack ${DEFINED_PHASES} && \ - ! hasq prepare ${DEFINED_PHASES} ; then + elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then cd "${WORKDIR}" else die "The source directory '${S}' doesn't exist" @@ -942,10 +949,7 @@ dyn_configure() { cd "${S}" elif hasq $EAPI 0 1 2; then cd "${WORKDIR}" - elif [[ -z ${A} ]] && \ - ! hasq unpack ${DEFINED_PHASES} && \ - ! hasq prepare ${DEFINED_PHASES} && \ - ! hasq configure ${DEFINED_PHASES} ; then + elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then cd "${WORKDIR}" else die "The source directory '${S}' doesn't exist" @@ -978,11 +982,7 @@ dyn_compile() { cd "${S}" elif hasq $EAPI 0 1 2; then cd "${WORKDIR}" - elif [[ -z ${A} ]] && \ - ! hasq unpack ${DEFINED_PHASES} && \ - ! hasq prepare ${DEFINED_PHASES} && \ - ! hasq configure ${DEFINED_PHASES} && \ - ! hasq compile ${DEFINED_PHASES} ; then + elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then cd "${WORKDIR}" else die "The source directory '${S}' doesn't exist" @@ -1060,12 +1060,7 @@ dyn_install() { cd "${S}" elif hasq $EAPI 0 1 2; then cd "${WORKDIR}" - elif [[ -z ${A} ]] && \ - ! hasq unpack ${DEFINED_PHASES} && \ - ! hasq prepare ${DEFINED_PHASES} && \ - ! hasq configure ${DEFINED_PHASES} && \ - ! hasq compile ${DEFINED_PHASES} && \ - ! hasq install ${DEFINED_PHASES}; then + elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then cd "${WORKDIR}" else die "The source directory '${S}' doesn't exist" diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index bbe6f045a..a3e7e3e56 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -525,6 +525,7 @@ save_ebuild_env() { unset -f dump_trace die diefunc quiet_mode vecho elog_base eqawarn elog \ 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 \ addread addwrite adddeny addpredict _sb_append_var \ lchown lchgrp esyslog use usev useq has_version portageq \ |