From 536eead0b367f9365d1d1574aff3a37a56b96d47 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 8 Aug 2008 06:49:34 +0000 Subject: * Fix the default() implementation so that it maps the ebuild argument to the correct phase function. * Add --exclude-init-phases option to save_ebuild_env() for filtering out unnecessary functions and variables when creating environment.bz2. * Add support for default() and default_* functions that die in all ebuild phases so that improper use of these functions is quickly discovered. svn path=/main/trunk/; revision=11346 --- bin/isolated-functions.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'bin/isolated-functions.sh') diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 364df5bbb..378e03f91 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -507,9 +507,24 @@ hasq() { # @FUNCTION: save_ebuild_env # @DESCRIPTION: # echo the current environment to stdout, filtering out redundant info. +# +# --exclude-init-phases causes pkg_nofetch and src_* phase functions to +# be excluded from the output. These function are not needed for installation +# or removal of the packages, and can therefore be safely excluded. +# save_ebuild_env() { ( + if hasq --exclude-init-phases $* ; then + unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_ + unset -f pkg_nofetch src_unpack src_configure \ + src_compile src_test src_install + if [[ -n $PYTHONPATH ]] ; then + export PYTHONPATH=${PYTHONPATH/${PORTAGE_PYM_PATH}:} + [[ -z $PYTHONPATH ]] && unset PYTHONPATH + fi + fi + # misc variables set by bash unset BASH HOSTTYPE IFS MACHTYPE OLDPWD \ OPTERR OPTIND OSTYPE PS4 PWD SHELL SHLVL @@ -528,6 +543,13 @@ save_ebuild_env() { # There's no need to bloat environment.bz2 with internally defined # functions and variables, so filter them out if possible. + for x in pkg_setup pkg_nofetch src_unpack src_configure \ + src_compile src_test src_install pkg_preinst pkg_postinst \ + pkg_prerm pkg_postrm ; do + unset -f {,_}default_$x + done + unset x + 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 \ @@ -546,6 +568,7 @@ save_ebuild_env() { save_ebuild_env filter_readonly_variables preprocess_ebuild_env \ source_all_bashrcs ebuild_main \ ebuild_phase ebuild_phase_with_hooks \ + _ebuild_arg_to_phase _ebuild_phase_funcs default \ ${QA_INTERCEPTORS} # portage config variables and variables set directly by portage -- cgit v1.2.3-1-g7c22