From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 12B78158086 for ; Tue, 11 Jan 2022 22:25:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 568F02BC08D; Tue, 11 Jan 2022 22:24:29 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E42452BC088 for ; Tue, 11 Jan 2022 22:24:28 +0000 (UTC) From: David Seifert To: gentoo-dev@lists.gentoo.org Cc: David Seifert Subject: [gentoo-dev] [PATCH v2 4/5] multibuild.eclass: inline cp_args Date: Tue, 11 Jan 2022 23:24:12 +0100 Message-Id: <20220111222413.5291-4-soap@gentoo.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220111222413.5291-1-soap@gentoo.org> References: <20220111222413.5291-1-soap@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 82b484e2-bd6e-4054-8c95-485a80bbdf09 X-Archives-Hash: 89a41af87834bddbe205e8ffd1eb595e Signed-off-by: David Seifert --- 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