From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A43E1138CCF for ; Sun, 24 May 2015 16:33:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 452EFE0C58; Sun, 24 May 2015 16:33:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A2CD5E0C58 for ; Sun, 24 May 2015 16:33:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CA212340948 for ; Sun, 24 May 2015 16:33:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 098949FE for ; Sun, 24 May 2015 16:33:07 +0000 (UTC) From: "Gilles Dartiguelongue" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Gilles Dartiguelongue" Message-ID: <1432485160.a6623741bbd2f45976d9445d3c28acf26113f8e5.eva@gentoo> Subject: [gentoo-commits] proj/gnome:master commit in: eclass/ X-VCS-Repository: proj/gnome X-VCS-Files: eclass/multibuild.eclass X-VCS-Directories: eclass/ X-VCS-Committer: eva X-VCS-Committer-Name: Gilles Dartiguelongue X-VCS-Revision: a6623741bbd2f45976d9445d3c28acf26113f8e5 X-VCS-Branch: master Date: Sun, 24 May 2015 16:33:07 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 9e7cd12e-838d-40c2-a9c6-acb9780aaa31 X-Archives-Hash: 90a856e0f700129048d796e863ab1991 commit: a6623741bbd2f45976d9445d3c28acf26113f8e5 Author: Michał Górny gentoo org> AuthorDate: Thu Sep 4 13:44:03 2014 +0000 Commit: Gilles Dartiguelongue gentoo org> CommitDate: Sun May 24 16:32:40 2015 +0000 URL: https://gitweb.gentoo.org/proj/gnome.git/commit/?id=a6623741 multibuild.eclass: supporting introspecting all layers of nested multibuild Transform MULTIBUILD_VARIANT, MULTIBUILD_ID and BUILD_DIR into arrays preserving values for each nested multibuild layer. For example, if you do something like: MULTIBUILD_VARIANTS=( a b c ) multibuild_foreach_variant multilib_foreach_abi python_foreach_impl .. then the function called last would have: MULTIBUILD_VARIANT=( python2.7 abi_x86_64.amd64 a ) MULTIBUILD_ID=( a-abi_x86_64.amd64-python2.7 a-abi_x86_64.amd64 a ) and BUILD_DIR alike it. Which means that using ${MULTIBUILD_VARIANT[2]} you can get your initial 'a' without having to copy intermediate values. Of course, if you want to nest multibuild you still need to ensure to set proper MULTIBUILD_VARIANTS in the scope of multibuild_foreach* invocation. And before you start to worry, this is fully backwards-compatible. In bash, ${MULTIBUILD_VARIANT} is equivalent to ${MULTIBUILD_VARIANT[0]} in context of an array, and since index 0 stores deepmost value --- nothing changes :). Fixes: https://bugs.gentoo.org/show_bug.cgi?id=483758 eclass/multibuild.eclass | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass index d9a86e9..a236894 100644 --- a/eclass/multibuild.eclass +++ b/eclass/multibuild.eclass @@ -46,6 +46,10 @@ if [[ ! ${_MULTIBUILD} ]]; then # @DESCRIPTION: # The current variant which the function was executed for. # +# If nested multibuilds are used, this value can be an array. In that +# case, the first element will name the deepest multibuild, and the next +# elements will go outwards. +# # Example value: # @CODE # python2_6 @@ -59,6 +63,10 @@ if [[ ! ${_MULTIBUILD} ]]; then # # It can be used to create variant-unique directories and files. # +# If nested multibuilds are used, this value can be an array. In that +# case, the first element will name the deepest multibuild, and the next +# elements will go outwards. +# # Example value: # @CODE # amd64-double @@ -73,6 +81,10 @@ if [[ ! ${_MULTIBUILD} ]]; then # to variant-specific build directories based on the initial value # of BUILD_DIR. # +# If nested multibuilds are used, this value can be an array. In that +# case, the first element will name the deepest multibuild, and the next +# elements will go outwards. +# # Example value: # @CODE # ${WORKDIR}/foo-1.3-python2_6 @@ -108,9 +120,9 @@ multibuild_foreach_variant() { debug-print "${FUNCNAME}: initial build_dir = ${bdir}" for v in "${MULTIBUILD_VARIANTS[@]}"; do - local MULTIBUILD_VARIANT=${v} - local MULTIBUILD_ID=${prev_id}${v} - local BUILD_DIR=${bdir%%/}-${v} + local MULTIBUILD_VARIANT=( "${v}" "${MULTIBUILD_VARIANT[@]}" ) + local MULTIBUILD_ID=( "${prev_id}${v}" "${MULTIBUILD_ID[@]}" ) + local BUILD_DIR=( "${bdir%%/}-${v}" "${BUILD_DIR[@]}" ) _multibuild_run() { # find the first non-private command