From: Fabian Groffen Date: Mon, 28 Dec 2009 09:25:24 +0000 (-0000) Subject: Merged from trunk -r15142:15151 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=2e9c9ba22159f32a5170f27269496c23a345e6ba;p=portage.git Merged from trunk -r15142:15151 | 15143 | Remove obsolete backing up of ROOTPATH via PORTAGE_ROOTPATH. | | zmedico | | | 15145 | In save_ebuild_env(), preserve all ebuild phases in any case | | zmedico | since excluding the already executed ones from | | | environment.bz2 doesn't save much space, and it's possible | | | that someone would want to look at them later. | | 15147 | Remove stray echo. | | zmedico | | | 15149 | Bug #297364 - Only set EAPI conditional PATH once after | | zmedico | sourcing the ebuild (when the EAPI is first known) rather | | | than for each phase. | svn path=/main/branches/prefix/; revision=15153 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index e8bfc5721..06132e3e9 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -17,13 +17,6 @@ for x in TEMP TMP TMPDIR ; do done unset x -# sandbox's bashrc sources /etc/profile which unsets ROOTPATH, -# so we have to back it up and restore it. -if [ -n "${PORTAGE_ROOTPATH}" ] ; then - export ROOTPATH=${PORTAGE_ROOTPATH} - unset PORTAGE_ROOTPATH -fi - ROOTPATH=${ROOTPATH##:} ROOTPATH=${ROOTPATH%%:} PREROOTPATH=${PREROOTPATH##:} @@ -1113,7 +1106,7 @@ dyn_install() { unset f save_ebuild_env --exclude-init-phases | filter_readonly_variables \ - --filter-sandbox --allow-extra-vars > environment + --filter-path --filter-sandbox --allow-extra-vars > environment bzip2 -f9 environment @@ -1647,6 +1640,11 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME" # settings should be used when loading the environment from a binary or # installed package. # +# --filter-path causes the PATH variable to be filtered. This variable +# should persist between phases, in case it is modified by the ebuild. +# However, old settings should be overridden when loading the +# environment from a binary or installed package. +# # ---allow-extra-vars causes some extra vars to be allowd through, such # as ${PORTAGE_SAVED_READONLY_VARS} and ${PORTAGE_MUTABLE_FILTERED_VARS}. # @@ -1666,7 +1664,7 @@ filter_readonly_variables() { SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB SANDBOX_LOG SANDBOX_ON" filtered_vars="$readonly_bash_vars $bash_misc_vars - $READONLY_PORTAGE_VARS PATH" + $READONLY_PORTAGE_VARS" if hasq --filter-sandbox $* ; then filtered_vars="${filtered_vars} SANDBOX_.*" else @@ -1675,6 +1673,9 @@ filter_readonly_variables() { if hasq --filter-features $* ; then filtered_vars="${filtered_vars} FEATURES" fi + if hasq --filter-path $* ; then + filtered_vars+=" PATH" + fi if hasq --filter-locale $* ; then filtered_vars+=" LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY @@ -1705,7 +1706,7 @@ preprocess_ebuild_env() { # environment may contain stale SANDBOX_{DENY,PREDICT,READ,WRITE} # and FEATURES variables that should be filtered out. Between # phases, these variables are normally preserved. - filter_opts+=" --filter-sandbox --filter-features --filter-locale" + filter_opts+=" --filter-features --filter-locale --filter-path --filter-sandbox" fi filter_readonly_variables ${filter_opts} < "${T}"/environment \ > "${T}"/environment.filtered || return $? @@ -1922,6 +1923,39 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm ; then unset _f _valid_phases + if [[ $EBUILD_PHASE != depend ]] ; then + + case "$EAPI" in + 4|4_pre1) + _ebuild_helpers_path="$PORTAGE_BIN_PATH/ebuild-helpers/4:$PORTAGE_BIN_PATH/ebuild-helpers" + ;; + *) + _ebuild_helpers_path="$PORTAGE_BIN_PATH/ebuild-helpers" + ;; + esac + + #PATH=$ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH + # PREFIX: same notes apply as at the top of this file + PATH="$ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}" + unset _ebuild_helpers_path + + if hasq distcc $FEATURES ; then + PATH="${EPREFIX}/usr/lib/distcc/bin:$PATH" + [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}" + fi + + if hasq ccache $FEATURES ; then + PATH="${EPREFIX}/usr/lib/ccache/bin:$PATH" + + if [[ -n $CCACHE_DIR ]] ; then + addread "$CCACHE_DIR" + addwrite "$CCACHE_DIR" + fi + + [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null + fi + fi + # 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/-/_}" @@ -1957,44 +1991,11 @@ fi ebuild_main() { local f x - # we may want to make this configurable somewhere else - local ebuild_helpers_path - case ${EAPI} in - 4|4_pre1) - ebuild_helpers_path="${PORTAGE_BIN_PATH}/ebuild-helpers/4:${PORTAGE_BIN_PATH}/ebuild-helpers" - ;; - *) - ebuild_helpers_path="${PORTAGE_BIN_PATH}/ebuild-helpers" - ;; - esac - - #PATH=$ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH - # PREFIX: same notes apply as at the top of this file - PATH="$ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}" - unset ebuild_helpers_path - - if ! hasq $EBUILD_SH_ARGS clean depend help info nofetch ; then - - if hasq distcc $FEATURES ; then - export PATH="${EPREFIX}/usr/lib/distcc/bin:$PATH" - [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}" - fi - - if hasq ccache $FEATURES ; then - export PATH="${EPREFIX}/usr/lib/ccache/bin:$PATH" - - addread "$CCACHE_DIR" - addwrite "$CCACHE_DIR" - - [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null - else - # Force configure scripts that automatically detect ccache to - # respect FEATURES="-ccache". - export CCACHE_DISABLE=1 - fi - fi - if [[ $EBUILD_PHASE != depend ]] ; then + # Force configure scripts that automatically detect ccache to + # respect FEATURES="-ccache". + hasq ccache $FEATURES || export CCACHE_DISABLE=1 + local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE") [[ -n $phase_func ]] && _ebuild_phase_funcs "$EAPI" "$phase_func" unset phase_func @@ -2024,7 +2025,8 @@ ebuild_main() { # Update environment.bz2 in case installation phases # need to pass some variables to uninstallation phases. save_ebuild_env --exclude-init-phases | \ - filter_readonly_variables --filter-sandbox --allow-extra-vars \ + filter_readonly_variables --filter-path \ + --filter-sandbox --allow-extra-vars \ | bzip2 -c -f9 > "$PORTAGE_UPDATE_ENV" fi ;; diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index cfb8fbddd..b268269fe 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -504,8 +504,6 @@ save_ebuild_env() { if hasq --exclude-init-phases $* ; then unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_ - unset -f pkg_nofetch src_unpack src_prepare src_configure \ - src_compile src_test src_install if [[ -n $PYTHONPATH ]] ; then export PYTHONPATH=${PYTHONPATH/${PORTAGE_PYM_PATH}:} [[ -z $PYTHONPATH ]] && unset PYTHONPATH diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 9a0fe3d03..b4a9c31ff 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3797,12 +3797,6 @@ class config(object): if eapi not in ("0", "1", "2", "3", "3_pre2"): mydict.pop("AA", None) - # sandbox's bashrc sources /etc/profile which unsets ROOTPATH, - # so we have to back it up and restore it. - rootpath = mydict.get("ROOTPATH") - if rootpath: - mydict["PORTAGE_ROOTPATH"] = rootpath - return mydict def thirdpartymirrors(self):