diff options
author | Gregory M. Tuner <gmt@be-evil.net> | 2014-06-05 03:30:53 -0700 |
---|---|---|
committer | Gregory M. Tuner <gmt@be-evil.net> | 2014-06-05 03:30:53 -0700 |
commit | 2f20c32faac7e95a16ec184c1bd6813bba101df1 (patch) | |
tree | 5872c760f207169cf2507d7b4279c7b97dad5b48 /eclass/multibuild.eclass | |
parent | eclass/kde4-base-multilib: EAPI enforcement and add multilib usedeps (diff) | |
download | gmt-2f20c32faac7e95a16ec184c1bd6813bba101df1.tar.gz gmt-2f20c32faac7e95a16ec184c1bd6813bba101df1.tar.bz2 gmt-2f20c32faac7e95a16ec184c1bd6813bba101df1.zip |
eclass/multibuild: sync with upstream
Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass/multibuild.eclass')
-rw-r--r-- | eclass/multibuild.eclass | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass index d355448..84eded9 100644 --- a/eclass/multibuild.eclass +++ b/eclass/multibuild.eclass @@ -1,6 +1,6 @@ -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/multibuild.eclass,v 1.14 2013/09/18 08:49:33 mgorny Exp $ +# $Header: $ # @ECLASS: multibuild # @MAINTAINER: @@ -28,8 +28,6 @@ if [[ ! ${_MULTIBUILD} ]]; then inherit multiprocessing -DEPEND="userland_GNU? ( >=sys-apps/coreutils-8.5 )" - # @ECLASS-VARIABLE: MULTIBUILD_VARIANTS # @DESCRIPTION: # An array specifying all enabled variants which multibuild_foreach* @@ -233,9 +231,16 @@ 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 -pr "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die + cp -pr "${cp_args[@]}" \ + "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die } multibuild_foreach_variant _multibuild_create_source_copy @@ -277,8 +282,6 @@ multibuild_merge_root() { local lockfile_l=${lockfile}.${BASHPID} local ret - [[ ${dest} != /* ]] && die "Relative paths are not supported by multibuild_merge_root" - # Lock the install tree for merge. The touch+ln method ensures race # condition-free locking with maximum portability. touch "${lockfile_l}" || die @@ -287,29 +290,28 @@ multibuild_merge_root() { done rm "${lockfile_l}" || die - if [[ ! -d "${dest}" ]] ; then - dest=$(readlink -m "${dest}") - if [[ ! -d "${dest}" ]] ; then - [[ -e "${dest}" ]] && die "file \"${dest}\" already exists but is not a directory." - mkdir -p "${dest}" || die "couldn't create directory \"${dest}\"." - fi - fi if use userland_BSD; then - # 'cp -a -n' is broken: - # http://www.freebsd.org/cgi/query-pr.cgi?pr=174489 - # using tar instead which is universal but terribly slow. + # 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=${?} - elif use userland_GNU; then - # cp works with '-a -n'. + else + local cp_args=() + + if cp -a --version &>/dev/null; then + cp_args+=( -a ) + else + cp_args+=( -P -R -p ) + fi - cp -a -l -n "${src}"/. "${dest}"/ + if cp --reflink=auto --version &>/dev/null; then + # enable reflinking if possible to make this faster + cp_args+=( --reflink=auto ) + fi ret=${?} - else - die "Unsupported userland (${USERLAND}), please report." fi # Remove the lock. |