From: Fabian Groffen Date: Sat, 25 Apr 2009 08:38:51 +0000 (-0000) Subject: Merged from trunk -r13383:13387 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=697e0e92f3fd9a8e39cedae5882dbc652da6ac6c;p=portage.git Merged from trunk -r13383:13387 | 13384 | Use declare -F to check existence of function definitions, | | zmedico | instead of type -t, in order to avoid use of subshells. | | 13385 | Remove ccache and distcc remove_path_entry code since PATH | | zmedico | is always initialized from scratch so there's no danger of | | | accumulation. | | 13386 | Fix breakage in PREROOTPATH logic from the EAPI 3 code. | | zmedico | | | 13387 | Automatically define errno.ESTALE if it doesn't exist (like | | zmedico | on interix). Thanks to Markus Duft for | | | reporting. | svn path=/main/branches/prefix/; revision=13394 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index a333f0d0c..275e27578 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -638,7 +638,7 @@ src_install() { } ebuild_phase() { - [ "$(type -t ${1})" == "function" ] && qa_call ${1} + declare -F "$1" >/dev/null && qa_call $1 } ebuild_phase_with_hooks() { @@ -1271,7 +1271,7 @@ inherit() { if [[ -n ${!__export_funcs_var} ]] ; then for x in ${!__export_funcs_var} ; do debug-print "EXPORT_FUNCTIONS: $x -> ${ECLASS}_$x" - [[ $(type -t ${ECLASS}_$x) = function ]] || \ + declare -F "${ECLASS}_$x" >/dev/null || \ die "EXPORT_FUNCTIONS: ${ECLASS}_$x is not defined" eval "$x() { ${ECLASS}_$x \"\$@\" ; }" > /dev/null done @@ -1450,7 +1450,7 @@ _ebuild_phase_funcs() { local x y default_func="" for x in pkg_nofetch src_unpack src_test ; do - [[ $(type -t $x) = function ]] || \ + declare -F $x >/dev/null || \ eval "$x() { _eapi0_$x \"\$@\" ; }" done @@ -1458,7 +1458,7 @@ _ebuild_phase_funcs() { 0|1) - if [[ $(type -t src_compile) != function ]] ; then + if ! declare -F src_compile >/dev/null ; then case $eapi in 0) src_compile() { _eapi0_src_compile "$@" ; } @@ -1483,10 +1483,10 @@ _ebuild_phase_funcs() { *) - [[ $(type -t src_configure) = function ]] || \ + declare -F src_configure >/dev/null || \ src_configure() { _eapi2_src_configure "$@" ; } - [[ $(type -t src_compile) = function ]] || \ + declare -F src_compile >/dev/null || \ src_compile() { _eapi2_src_compile "$@" ; } if hasq $phase_func $default_phases ; then @@ -1848,7 +1848,7 @@ _source_ebuild() { [[ -n $EAPI ]] || EAPI=0 # alphabetically ordered by $EBUILD_PHASE value - local valid_phases + local f valid_phases case "$EAPI" in 0|1) valid_phases="src_compile pkg_config pkg_info src_install @@ -1864,7 +1864,7 @@ _source_ebuild() { DEFINED_PHASES= for f in $valid_phases ; do - if [[ $(type -t $f) = function ]] ; then + if declare -F $f >/dev/null ; then f=${f#pkg_} DEFINED_PHASES+=" ${f#src_}" fi @@ -1924,19 +1924,17 @@ ebuild_main() { esac export PATH="/usr/local/sbin:/sbin:/usr/sbin:${ebuild_helpers_path}:/usr/local/bin:/bin:/usr/bin:${ROOTPATH}" + [[ -n $PREROOTPATH ]] && export PATH="${PREROOTPATH%%:}:$PATH" unset ebuild_helpers_path if ! hasq $EBUILD_SH_ARGS clean depend help info nofetch ; then if hasq distcc $FEATURES ; then - [[ -z ${PATH/*distcc*/} ]] && remove_path_entry distcc export PATH="${EPREFIX}/usr/lib/distcc/bin:$PATH" [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}" fi if hasq ccache $FEATURES ; then - [[ -z ${PATH/*ccache*/} ]] && remove_path_entry ccache - export PATH="${EPREFIX}/usr/lib/ccache/bin:$PATH" addread "$CCACHE_DIR" @@ -1964,8 +1962,8 @@ ebuild_main() { exit 1 ;; prerm|postrm|postinst|config|info) - if hasq ${EBUILD_SH_ARGS} config info && \ - [ "$(type -t pkg_${EBUILD_SH_ARGS})" != "function" ]; then + if hasq "$EBUILD_SH_ARGS" config info && \ + ! declare -F "pkg_$EBUILD_SH_ARGS" >/dev/null ; then ewarn "pkg_${EBUILD_SH_ARGS}() is not defined: '${EBUILD##*/}'" fi export SANDBOX_ON="0" diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 1a2f2879a..379eef5ca 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -15,6 +15,9 @@ try: import codecs import copy import errno + if not hasattr(errno, 'ESTALE'): + # ESTALE may not be defined on some systems, such as interix. + errno.ESTALE = -1 import logging import os import re