* [gentoo-dev] [PATCH] multibuild.eclass: supporting introspecting all layers of nested multibuild
@ 2014-09-04 13:44 Michał Górny
0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2014-09-04 13:44 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
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 de5804d..c8a9591 100644
--- a/eclass/multibuild.eclass
+++ b/eclass/multibuild.eclass
@@ -48,6 +48,10 @@ inherit multiprocessing
# @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
@@ -61,6 +65,10 @@ inherit multiprocessing
#
# 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
@@ -75,6 +83,10 @@ inherit multiprocessing
# 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
@@ -110,9 +122,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
--
2.1.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-04 13:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04 13:44 [gentoo-dev] [PATCH] multibuild.eclass: supporting introspecting all layers of nested multibuild Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox