public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: David Seifert <soap@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: David Seifert <soap@gentoo.org>
Subject: [gentoo-dev] [PATCH v2 4/5] multibuild.eclass: inline cp_args
Date: Tue, 11 Jan 2022 23:24:12 +0100	[thread overview]
Message-ID: <20220111222413.5291-4-soap@gentoo.org> (raw)
In-Reply-To: <20220111222413.5291-1-soap@gentoo.org>

Signed-off-by: David Seifert <soap@gentoo.org>
---
 eclass/multibuild.eclass | 36 +++++++-----------------------------
 1 file changed, 7 insertions(+), 29 deletions(-)

diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
index cbd48b1eeb6..4699ebc43fb 100644
--- a/eclass/multibuild.eclass
+++ b/eclass/multibuild.eclass
@@ -192,15 +192,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,31 +229,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
-	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=${?}
-
-	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
-- 
2.34.1



  parent reply	other threads:[~2022-01-11 22:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 22:24 [gentoo-dev] [PATCH v2 1/5] multilib-minimal.eclass: remove EAPI 5 David Seifert
2022-01-11 22:24 ` [gentoo-dev] [PATCH v2 2/5] multilib-build.eclass: " David Seifert
2022-01-11 22:24 ` [gentoo-dev] [PATCH v2 3/5] multibuild.eclass: remove dead userland_BSD David Seifert
2022-01-11 22:24 ` David Seifert [this message]
2022-01-11 22:24 ` [gentoo-dev] [PATCH v2 5/5] multibuild.eclass: remove EAPI 4 and 5 David Seifert
2022-01-12  8:23 ` [gentoo-dev] [PATCH v2 1/5] multilib-minimal.eclass: remove EAPI 5 Ulrich Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220111222413.5291-4-soap@gentoo.org \
    --to=soap@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox