summaryrefslogtreecommitdiff
path: root/eclass/multibuild.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-01-16 20:27:28 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-01-16 20:27:28 +0000
commit2fd57282f0262ca084e05b0f2c63fbada395d02b (patch)
tree4e0f23cea9ce9fd972e70ebc5214bf36fed465cc /eclass/multibuild.eclass
parentc3bc61051d7f12b4c682efa7a5460bbc8815649e (diff)
gentoo resync : 16.01.2021
Diffstat (limited to 'eclass/multibuild.eclass')
-rw-r--r--eclass/multibuild.eclass91
1 files changed, 15 insertions, 76 deletions
diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
index 37568ebf87cc..a0941ae02ea4 100644
--- a/eclass/multibuild.eclass
+++ b/eclass/multibuild.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: multibuild.eclass
@@ -6,25 +6,20 @@
# Michał Górny <mgorny@gentoo.org>
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7 8
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: A generic eclass for building multiple variants of packages.
# @DESCRIPTION:
# The multibuild eclass aims to provide a generic framework for building
# multiple 'variants' of a package (e.g. multilib, Python
# implementations).
-case "${EAPI:-0}" in
- [0-3])
- die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
- ;;
- [4-8])
- ;;
- *)
- die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
- ;;
+case ${EAPI} in
+ 6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
-if [[ ! ${_MULTIBUILD} ]]; then
+if [[ ! ${_MULTIBUILD_ECLASS} ]]; then
+_MULTIBUILD_ECLASS=1
# @ECLASS-VARIABLE: MULTIBUILD_VARIANTS
# @REQUIRED
@@ -137,25 +132,6 @@ multibuild_foreach_variant() {
return ${ret}
}
-# @FUNCTION: multibuild_parallel_foreach_variant
-# @USAGE: [<argv>...]
-# @DESCRIPTION:
-# Run the passed command repeatedly for each of the enabled package
-# variants. This used to run the commands in parallel but now it's
-# just a deprecated alias to multibuild_foreach_variant.
-#
-# The function returns 0 if all commands return 0, or the first non-zero
-# exit status otherwise. However, it performs all the invocations
-# nevertheless. It is preferred to call 'die' inside of the passed
-# function.
-multibuild_parallel_foreach_variant() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}"
-
- multibuild_foreach_variant "${@}"
-}
-
# @FUNCTION: multibuild_for_best_variant
# @USAGE: [<argv>...]
# @DESCRIPTION:
@@ -172,10 +148,7 @@ multibuild_for_best_variant() {
[[ ${MULTIBUILD_VARIANTS} ]] \
|| die "MULTIBUILD_VARIANTS need to be set"
- # bash-4.1 can't handle negative subscripts
- local MULTIBUILD_VARIANTS=(
- "${MULTIBUILD_VARIANTS[$(( ${#MULTIBUILD_VARIANTS[@]} - 1 ))]}"
- )
+ local MULTIBUILD_VARIANTS=( "${MULTIBUILD_VARIANTS[-1]}" )
multibuild_foreach_variant "${@}"
}
@@ -192,15 +165,10 @@ multibuild_copy_sources() {
einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}"
- local cp_args=()
- if cp --reflink=auto --version &>/dev/null; then
- # enable reflinking if possible to make this faster
- cp_args+=( --reflink=auto )
- fi
-
_multibuild_create_source_copy() {
einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}"
- cp -p -R "${cp_args[@]}" \
+ # enable reflinking if possible to make this faster
+ cp -p -R --reflink=auto \
"${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
}
@@ -234,43 +202,14 @@ run_in_build_dir() {
# (the real root). Both directories have to be real, absolute paths
# (i.e. including ${D}). Source root will be removed.
multibuild_merge_root() {
+ debug-print-function ${FUNCNAME} "${@}"
+
local src=${1}
local dest=${2}
- local ret
-
- if use userland_BSD; then
- # Most of BSD variants fail to copy broken symlinks, #447370
- # also, they do not support --version
-
- tar -C "${src}" -f - -c . \
- | tar -x -f - -C "${dest}"
- [[ ${PIPESTATUS[*]} == '0 0' ]]
- ret=${?}
- else
- local cp_args=()
-
- if cp -a --version &>/dev/null; then
- cp_args+=( -a )
- else
- cp_args+=( -P -R -p )
- fi
-
- if cp --reflink=auto --version &>/dev/null; then
- # enable reflinking if possible to make this faster
- cp_args+=( --reflink=auto )
- fi
-
- cp "${cp_args[@]}" "${src}"/. "${dest}"/
- ret=${?}
- fi
-
- if [[ ${ret} -ne 0 ]]; then
- die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed."
- fi
-
- rm -rf "${src}"
+ # enable reflinking if possible to make this faster
+ cp -a --reflink=auto "${src}"/. "${dest}"/ || die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed"
+ rm -rf "${src}" || die
}
-_MULTIBUILD=1
fi