Gentoo Archives: gentoo-dev

From: David Seifert <soap@g.o>
To: gentoo-dev@l.g.o
Cc: David Seifert <soap@g.o>
Subject: [gentoo-dev] [PATCH v2 4/5] multibuild.eclass: inline cp_args
Date: Tue, 11 Jan 2022 22:25:38
Message-Id: 20220111222413.5291-4-soap@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2 1/5] multilib-minimal.eclass: remove EAPI 5 by David Seifert
1 Signed-off-by: David Seifert <soap@g.o>
2 ---
3 eclass/multibuild.eclass | 36 +++++++-----------------------------
4 1 file changed, 7 insertions(+), 29 deletions(-)
5
6 diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
7 index cbd48b1eeb6..4699ebc43fb 100644
8 --- a/eclass/multibuild.eclass
9 +++ b/eclass/multibuild.eclass
10 @@ -192,15 +192,10 @@ multibuild_copy_sources() {
11
12 einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}"
13
14 - local cp_args=()
15 - if cp --reflink=auto --version &>/dev/null; then
16 - # enable reflinking if possible to make this faster
17 - cp_args+=( --reflink=auto )
18 - fi
19 -
20 _multibuild_create_source_copy() {
21 einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}"
22 - cp -p -R "${cp_args[@]}" \
23 + # enable reflinking if possible to make this faster
24 + cp -p -R --reflink=auto \
25 "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
26 }
27
28 @@ -234,31 +229,14 @@ run_in_build_dir() {
29 # (the real root). Both directories have to be real, absolute paths
30 # (i.e. including ${D}). Source root will be removed.
31 multibuild_merge_root() {
32 + debug-print-function ${FUNCNAME} "${@}"
33 +
34 local src=${1}
35 local dest=${2}
36
37 - local ret
38 - local cp_args=()
39 -
40 - if cp -a --version &>/dev/null; then
41 - cp_args+=( -a )
42 - else
43 - cp_args+=( -P -R -p )
44 - fi
45 -
46 - if cp --reflink=auto --version &>/dev/null; then
47 - # enable reflinking if possible to make this faster
48 - cp_args+=( --reflink=auto )
49 - fi
50 -
51 - cp "${cp_args[@]}" "${src}"/. "${dest}"/
52 - ret=${?}
53 -
54 - if [[ ${ret} -ne 0 ]]; then
55 - die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed."
56 - fi
57 -
58 - rm -rf "${src}"
59 + # enable reflinking if possible to make this faster
60 + cp -a --reflink=auto "${src}"/. "${dest}"/ || die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed"
61 + rm -rf "${src}" || die
62 }
63
64 _MULTIBUILD=1
65 --
66 2.34.1