diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-03-04 19:28:47 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-03-04 19:28:47 +0000 |
commit | 68eca18ff0884ddd5b093bcce56b3133c87c858f (patch) | |
tree | 9840e60e94804c99a657b844e5c8a9baab892ece /eclass | |
parent | Use multibuild.eclass in python-r1. (diff) | |
download | historical-68eca18ff0884ddd5b093bcce56b3133c87c858f.tar.gz historical-68eca18ff0884ddd5b093bcce56b3133c87c858f.tar.bz2 historical-68eca18ff0884ddd5b093bcce56b3133c87c858f.zip |
Introduce python_parallel_foreach_impl() and reuse it in distutils-r1.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 6 | ||||
-rw-r--r-- | eclass/distutils-r1.eclass | 63 | ||||
-rw-r--r-- | eclass/python-r1.eclass | 35 |
3 files changed, 47 insertions, 57 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 123c8febbe5f..039832d9ed90 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for eclass directory # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.709 2013/03/04 19:27:58 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.710 2013/03/04 19:28:47 mgorny Exp $ + + 04 Mar 2013; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass, + python-r1.eclass: + Introduce python_parallel_foreach_impl() and reuse it in distutils-r1. 04 Mar 2013; Michał Górny <mgorny@gentoo.org> python-r1.eclass: Use multibuild.eclass in python-r1. diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index ca525731f163..489bed6dc476 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.60 2013/03/02 07:17:50 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.61 2013/03/04 19:28:47 mgorny Exp $ # @ECLASS: distutils-r1 # @MAINTAINER: @@ -100,14 +100,6 @@ if [[ ! ${DISTUTILS_OPTIONAL} ]]; then DEPEND=${PYTHON_DEPS} fi -# @ECLASS-VARIABLE: DISTUTILS_JOBS -# @DEFAULT_UNSET -# @DESCRIPTION: -# The number of parallel jobs to run for distutils-r1 parallel builds. -# If unset, the job-count in ${MAKEOPTS} will be used. -# -# This variable is intended to be set in make.conf. - # @ECLASS-VARIABLE: PATCHES # @DEFAULT_UNSET # @DESCRIPTION: @@ -551,16 +543,7 @@ distutils-r1_run_phase() { mkdir -p "${TMPDIR}" || die - if [[ ${DISTUTILS_NO_PARALLEL_BUILD} || ${DISTUTILS_SINGLE_IMPL} ]] - then - "${@}" 2>&1 | tee -a "${T}/build-${EPYTHON}.log" - else - ( - multijob_child_init - "${@}" 2>&1 | tee -a "${T}/build-${EPYTHON}.log" - ) & - multijob_post_fork - fi + "${@}" if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]] then @@ -603,39 +586,6 @@ _distutils-r1_run_common_phase() { fi } -# @FUNCTION: _distutils-r1_multijob_init -# @INTERNAL -# @DESCRIPTION: -# Init multijob, taking the job-count from ${DISTUTILS_JOBS}. -_distutils-r1_multijob_init() { - debug-print-function ${FUNCNAME} "${@}" - - if [[ ! ${DISTUTILS_NO_PARALLEL_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]] - then - local opts - if [[ ${DISTUTILS_JOBS} ]]; then - opts=-j${DISTUTILS_JOBS} - else - opts=${MAKEOPTS} - fi - - multijob_init "${opts}" - fi -} - -# @FUNCTION: _distutils-r1_multijob_finish -# @INTERNAL -# @DESCRIPTION: -# Finish multijob if used. -_distutils-r1_multijob_finish() { - debug-print-function ${FUNCNAME} "${@}" - - if [[ ! ${DISTUTILS_NO_PARALLEL_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]] - then - multijob_finish - fi -} - # @FUNCTION: _distutils-r1_run_foreach_impl # @INTERNAL # @DESCRIPTION: @@ -647,9 +597,12 @@ _distutils-r1_run_foreach_impl() { set -- distutils-r1_run_phase "${@}" if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then - _distutils-r1_multijob_init - python_foreach_impl "${@}" - _distutils-r1_multijob_finish + if [[ ${DISTUTILS_NO_PARALLEL_BUILD} || ${DISTUTILS_SINGLE_IMPL} ]] + then + python_foreach_impl "${@}" + else + python_parallel_foreach_impl "${@}" + fi else if [[ ! ${EPYTHON} ]]; then die "EPYTHON unset, python-single-r1_pkg_setup not called?!" diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass index 5bcb8cca3fa9..934f32d5a543 100644 --- a/eclass/python-r1.eclass +++ b/eclass/python-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.46 2013/03/04 19:27:58 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.47 2013/03/04 19:28:47 mgorny Exp $ # @ECLASS: python-r1 # @MAINTAINER: @@ -173,6 +173,14 @@ _python_set_globals() { } _python_set_globals +# @ECLASS-VARIABLE: DISTUTILS_JOBS +# @DEFAULT_UNSET +# @DESCRIPTION: +# The number of parallel jobs to run for distutils-r1 parallel builds. +# If unset, the job-count in ${MAKEOPTS} will be used. +# +# This variable is intended to be set in make.conf. + # @FUNCTION: _python_validate_useflags # @INTERNAL # @DESCRIPTION: @@ -634,6 +642,31 @@ python_foreach_impl() { multibuild_foreach_variant _python_multibuild_wrapper "${@}" } +# @FUNCTION: python_parallel_foreach_impl +# @USAGE: <command> [<args>...] +# @DESCRIPTION: +# Run the given command for each of the enabled Python implementations. +# If additional parameters are passed, they will be passed through +# to the command. +# +# The function will return 0 status if all invocations succeed. +# Otherwise, the return code from first failing invocation will +# be returned. +# +# For each command being run, EPYTHON, PYTHON and BUILD_DIR are set +# locally, and the former two are exported to the command environment. +# +# Multiple invocations of the command will be run in parallel, up to +# DISTUTILS_JOBS (defaulting to '-j' option argument from MAKEOPTS). +python_parallel_foreach_impl() { + debug-print-function ${FUNCNAME} "${@}" + + local MULTIBUILD_JOBS=${MULTIBUILD_JOBS:-${DISTUTILS_JOBS}} + local MULTIBUILD_VARIANTS + _python_obtain_impls + multibuild_parallel_foreach_variant _python_multibuild_wrapper "${@}" +} + # @FUNCTION: python_export_best # @USAGE: [<variable>...] # @DESCRIPTION: |