Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sun, 16 Jan 2022 17:40:59
Message-Id: 1642354846.b0c14b01b5c076d3a87b710da94978d3ab4ace04.mgorny@gentoo
1 commit: b0c14b01b5c076d3a87b710da94978d3ab4ace04
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 12 10:06:10 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 16 17:40:46 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0c14b01
7
8 multibuild.eclass: inline cp_args
9
10 Signed-off-by: David Seifert <soap <AT> gentoo.org>
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 eclass/multibuild.eclass | 36 +++++++-----------------------------
14 1 file changed, 7 insertions(+), 29 deletions(-)
15
16 diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
17 index cbd48b1eeb6d..4699ebc43fb1 100644
18 --- a/eclass/multibuild.eclass
19 +++ b/eclass/multibuild.eclass
20 @@ -192,15 +192,10 @@ multibuild_copy_sources() {
21
22 einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}"
23
24 - local cp_args=()
25 - if cp --reflink=auto --version &>/dev/null; then
26 - # enable reflinking if possible to make this faster
27 - cp_args+=( --reflink=auto )
28 - fi
29 -
30 _multibuild_create_source_copy() {
31 einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}"
32 - cp -p -R "${cp_args[@]}" \
33 + # enable reflinking if possible to make this faster
34 + cp -p -R --reflink=auto \
35 "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
36 }
37
38 @@ -234,31 +229,14 @@ run_in_build_dir() {
39 # (the real root). Both directories have to be real, absolute paths
40 # (i.e. including ${D}). Source root will be removed.
41 multibuild_merge_root() {
42 + debug-print-function ${FUNCNAME} "${@}"
43 +
44 local src=${1}
45 local dest=${2}
46
47 - local ret
48 - local cp_args=()
49 -
50 - if cp -a --version &>/dev/null; then
51 - cp_args+=( -a )
52 - else
53 - cp_args+=( -P -R -p )
54 - fi
55 -
56 - if cp --reflink=auto --version &>/dev/null; then
57 - # enable reflinking if possible to make this faster
58 - cp_args+=( --reflink=auto )
59 - fi
60 -
61 - cp "${cp_args[@]}" "${src}"/. "${dest}"/
62 - ret=${?}
63 -
64 - if [[ ${ret} -ne 0 ]]; then
65 - die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed."
66 - fi
67 -
68 - rm -rf "${src}"
69 + # enable reflinking if possible to make this faster
70 + cp -a --reflink=auto "${src}"/. "${dest}"/ || die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed"
71 + rm -rf "${src}" || die
72 }
73
74 _MULTIBUILD=1