From 8d2db38d565f852537211c80153f56a251b84f3a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 11 Sep 2011 17:01:50 -0700 Subject: Move preprocess_ebuild_env to phase-functions.sh. --- bin/ebuild.sh | 188 ------------------------------------------------- bin/phase-functions.sh | 184 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 188 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index a781c2e05..d722ccc7a 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -371,201 +371,13 @@ source_all_bashrcs() { [ ! -z "${OCXX}" ] && export CXX="${OCXX}" } -# Hardcoded bash lists are needed for backward compatibility with -# > "$T/environment.filtered" || return $? - unset _portage_filter_opts - mv "${T}"/environment.filtered "${T}"/environment || return $? - rm -f "${T}/environment.success" || return $? - # WARNING: Code inside this subshell should avoid making assumptions - # about variables or functions after source "${T}"/environment has been - # called. Any variables that need to be relied upon should already be - # filtered out above. - ( - export SANDBOX_ON=1 - source "${T}/environment" || exit $? - # We have to temporarily disable sandbox since the - # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded - # may be unusable (triggering in spurious sandbox violations) - # until we've merged them with our current values. - export SANDBOX_ON=0 - - # It's remotely possible that save_ebuild_env() has been overridden - # by the above source command. To protect ourselves, we override it - # here with our own version. ${PORTAGE_BIN_PATH} is safe to use here - # because it's already filtered above. - source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit $? - - # Rely on save_ebuild_env() to filter out any remaining variables - # and functions that could interfere with the current environment. - save_ebuild_env || exit $? - >> "$T/environment.success" || exit $? - ) > "${T}/environment.filtered" - local retval - if [ -e "${T}/environment.success" ] ; then - filter_readonly_variables --filter-features < \ - "${T}/environment.filtered" > "${T}/environment" - retval=$? - else - retval=1 - fi - rm -f "${T}"/environment.{filtered,raw,success} - return ${retval} -} - # === === === === === === === === === === === === === === === === === === # === === === === === functions end, main part begins === === === === === -# === === === === === functions end, main part begins === === === === === -# === === === === === functions end, main part begins === === === === === # === === === === === === === === === === === === === === === === === === export SANDBOX_ON="1" export S=${WORKDIR}/${P} -unset E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND - # Turn of extended glob matching so that g++ doesn't get incorrectly matched. shopt -u extglob diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 383253d5a..f1db257f5 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -2,6 +2,190 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +# Hardcoded bash lists are needed for backward compatibility with +# > "$T/environment.filtered" || return $? + unset _portage_filter_opts + mv "${T}"/environment.filtered "${T}"/environment || return $? + rm -f "${T}/environment.success" || return $? + # WARNING: Code inside this subshell should avoid making assumptions + # about variables or functions after source "${T}"/environment has been + # called. Any variables that need to be relied upon should already be + # filtered out above. + ( + export SANDBOX_ON=1 + source "${T}/environment" || exit $? + # We have to temporarily disable sandbox since the + # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded + # may be unusable (triggering in spurious sandbox violations) + # until we've merged them with our current values. + export SANDBOX_ON=0 + + # It's remotely possible that save_ebuild_env() has been overridden + # by the above source command. To protect ourselves, we override it + # here with our own version. ${PORTAGE_BIN_PATH} is safe to use here + # because it's already filtered above. + source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit $? + + # Rely on save_ebuild_env() to filter out any remaining variables + # and functions that could interfere with the current environment. + save_ebuild_env || exit $? + >> "$T/environment.success" || exit $? + ) > "${T}/environment.filtered" + local retval + if [ -e "${T}/environment.success" ] ; then + filter_readonly_variables --filter-features < \ + "${T}/environment.filtered" > "${T}/environment" + retval=$? + else + retval=1 + fi + rm -f "${T}"/environment.{filtered,raw,success} + return ${retval} +} + ebuild_phase() { declare -F "$1" >/dev/null && qa_call $1 } -- cgit v1.2.3-1-g7c22