diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-09-11 19:55:05 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-09-11 19:55:05 +0000 |
commit | f9c86b749e505d035c1717c41d2c8d92727764d7 (patch) | |
tree | 0083163e5253973dd2cc5c6e82cd5d2f49517352 /eclass | |
parent | amd64 stable, bug #281821 (diff) | |
download | gentoo-2-f9c86b749e505d035c1717c41d2c8d92727764d7.tar.gz gentoo-2-f9c86b749e505d035c1717c41d2c8d92727764d7.tar.bz2 gentoo-2-f9c86b749e505d035c1717c41d2c8d92727764d7.zip |
Improve handling of directory stack in python_execute_function().
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/python.eclass | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/eclass/python.eclass b/eclass/python.eclass index ddde5de46dcd..dec4a141a421 100644 --- a/eclass/python.eclass +++ b/eclass/python.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.71 2009/09/09 04:16:58 arfrever Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.72 2009/09/11 19:55:05 arfrever Exp $ # @ECLASS: python.eclass # @MAINTAINER: @@ -251,7 +251,7 @@ python_set_build_dir_symlink() { # Execute specified function for each value of PYTHON_ABIS, optionally passing additional # arguments. The specified function can use PYTHON_ABI and BUILDDIR variables. python_execute_function() { - local action action_message action_message_template= default_function="0" failure_message failure_message_template= function nonfatal="0" PYTHON_ABI quiet="0" separate_build_dirs="0" + local action action_message action_message_template= default_function="0" failure_message failure_message_template= function nonfatal="0" previous_directory_stack_length PYTHON_ABI quiet="0" separate_build_dirs="0" while (($#)); do case "$1" in @@ -383,6 +383,8 @@ python_execute_function() { export BUILDDIR="${S}" fi + previous_directory_stack_length="${#DIRSTACK[@]}" + if ! has "${EAPI}" 0 1 2 && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then EPYTHON="$(PYTHON)" nonfatal "${function}" "$@" else @@ -419,6 +421,14 @@ python_execute_function() { fi fi + if [[ "${#DIRSTACK[@]}" -lt "${previous_directory_stack_length}" ]]; then + die "Directory stack decreased illegally" + fi + + while [[ "${#DIRSTACK[@]}" -gt "${previous_directory_stack_length}" ]]; do + popd > /dev/null || die "popd failed" + done + if [[ "${separate_build_dirs}" == "1" ]]; then popd > /dev/null || die "popd failed" fi |