diff options
-rwxr-xr-x | bin/ebuild.sh | 127 | ||||
-rwxr-xr-x | bin/isolated-functions.sh | 4 |
2 files changed, 64 insertions, 67 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 63f8bdedb..4fa19f300 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1633,8 +1633,8 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME" # variables out and discards them. See bug #190128. filter_readonly_variables() { local x filtered_vars - local readonly_bash_vars="DIRSTACK EUID FUNCNAME GROUPS - PIPESTATUS PPID SHELLOPTS UID" + local readonly_bash_vars="BASHPID DIRSTACK EUID FUNCNAME + GROUPS PIPESTATUS PPID SHELLOPTS UID" local filtered_sandbox_vars="SANDBOX_ACTIVE SANDBOX_BASHRC SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB SANDBOX_LOG SANDBOX_ON" @@ -1817,78 +1817,75 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm depend && \ [[ -n $EAPI ]] || EAPI=0 fi -_source_ebuild() { - # The bashrcs get an opportunity here to set aliases that will be expanded - # during sourcing of ebuilds and eclasses. - source_all_bashrcs - - # *DEPEND and IUSE will be set during the sourcing of the ebuild. - # In order to ensure correct interaction between ebuilds and - # eclasses, they need to be unset before this process of - # interaction begins. - unset DEPEND RDEPEND PDEPEND IUSE - source "${EBUILD}" || die "error sourcing ebuild" - - if [ "${EBUILD_PHASE}" != "depend" ] ; then - RESTRICT=${PORTAGE_RESTRICT} - [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \ +if ! hasq "$EBUILD_PHASE" clean cleanrm ; then + if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \ + -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \ + hasq noauto $FEATURES ; then + # The bashrcs get an opportunity here to set aliases that will be expanded + # during sourcing of ebuilds and eclasses. + source_all_bashrcs + + # *DEPEND and IUSE will be set during the sourcing of the ebuild. + # In order to ensure correct interaction between ebuilds and + # eclasses, they need to be unset before this process of + # interaction begins. + unset DEPEND RDEPEND PDEPEND IUSE + source "${EBUILD}" || die "error sourcing ebuild" + + if [[ "${EBUILD_PHASE}" != "depend" ]] ; then + RESTRICT=${PORTAGE_RESTRICT} + [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \ rm "$PORTAGE_BUILDDIR/.ebuild_changed" - fi + fi - [[ -n $EAPI ]] || EAPI=0 + [[ -n $EAPI ]] || EAPI=0 - if has "$EAPI" 0 1 2 ; then - export RDEPEND=${RDEPEND-${DEPEND}} - debug-print "RDEPEND: not set... Setting to: ${DEPEND}" - fi + if has "$EAPI" 0 1 2 ; then + export RDEPEND=${RDEPEND-${DEPEND}} + debug-print "RDEPEND: not set... Setting to: ${DEPEND}" + fi - # add in dependency info from eclasses - IUSE="${IUSE} ${E_IUSE}" - DEPEND="${DEPEND} ${E_DEPEND}" - RDEPEND="${RDEPEND} ${E_RDEPEND}" - PDEPEND="${PDEPEND} ${E_PDEPEND}" + # add in dependency info from eclasses + IUSE="${IUSE} ${E_IUSE}" + DEPEND="${DEPEND} ${E_DEPEND}" + RDEPEND="${RDEPEND} ${E_RDEPEND}" + PDEPEND="${PDEPEND} ${E_PDEPEND}" - unset ECLASS E_IUSE E_DEPEND E_RDEPEND E_PDEPEND + unset ECLASS E_IUSE E_DEPEND E_RDEPEND E_PDEPEND - # alphabetically ordered by $EBUILD_PHASE value - local f valid_phases - case "$EAPI" in - 0|1) - valid_phases="src_compile pkg_config pkg_info src_install - pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm - pkg_setup src_test src_unpack" - ;; - 2) - valid_phases="src_compile pkg_config src_configure pkg_info - src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst - src_prepare pkg_prerm pkg_setup src_test src_unpack" - ;; - *) - valid_phases="src_compile pkg_config src_configure pkg_info - src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst - src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack" - ;; - esac + # alphabetically ordered by $EBUILD_PHASE value + case "$EAPI" in + 0|1) + _valid_phases="src_compile pkg_config pkg_info src_install + pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm + pkg_setup src_test src_unpack" + ;; + 2) + _valid_phases="src_compile pkg_config src_configure pkg_info + src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst + src_prepare pkg_prerm pkg_setup src_test src_unpack" + ;; + *) + _valid_phases="src_compile pkg_config src_configure pkg_info + src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst + src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack" + ;; + esac - DEFINED_PHASES= - for f in $valid_phases ; do - if declare -F $f >/dev/null ; then - f=${f#pkg_} - DEFINED_PHASES+=" ${f#src_}" - fi - done - [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=- + DEFINED_PHASES= + for _f in $_valid_phases ; do + if declare -F $_f >/dev/null ; then + f=${f#pkg_} + DEFINED_PHASES+=" ${f#src_}" + fi + done + [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=- - # This needs to be exported since prepstrip is a separate shell script. - [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED - eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && export QA_PRESTRIPPED_${ARCH/-/_}" -} + unset _f _valid_phases -if ! hasq "$EBUILD_PHASE" clean cleanrm ; then - if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \ - -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \ - hasq noauto $FEATURES ; then - _source_ebuild + # This needs to be exported since prepstrip is a separate shell script. + [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED + eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && export QA_PRESTRIPPED_${ARCH/-/_}" fi fi diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index a3e7e3e56..64f84b064 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -573,8 +573,8 @@ save_ebuild_env() { # user config variables unset DOC_SYMLINKS_DIR INSTALL_MASK PKG_INSTALL_MASK - set - export + declare -p + declare -fp ) } |