diff options
author | Ulrich Müller <ulm@gentoo.org> | 2009-12-18 07:08:19 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2009-12-18 07:08:19 +0000 |
commit | a486a85ba8e424fe0668791c6129dff36e2fc783 (patch) | |
tree | b220319d0bd8b8615c047d91a3e8b50b92e171db /eclass | |
parent | Version bump. Fixes security bug #297388. (diff) | |
download | historical-a486a85ba8e424fe0668791c6129dff36e2fc783.tar.gz historical-a486a85ba8e424fe0668791c6129dff36e2fc783.tar.bz2 historical-a486a85ba8e424fe0668791c6129dff36e2fc783.zip |
Use "rsync" instead of "bzr export", bug 280211.
Don't always refetch for non-lightweight checkouts, bug 296733.
Some fixes of whitespace and comments.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/bzr.eclass | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass index fb4904a9c76e..c8e4f5e052a8 100644 --- a/eclass/bzr.eclass +++ b/eclass/bzr.eclass @@ -1,18 +1,18 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v 1.6 2009/12/09 10:04:16 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v 1.7 2009/12/18 07:08:19 ulm Exp $ # # @ECLASS: bzr.eclass # @MAINTAINER: # Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>, # Ulrich Mueller <ulm@gentoo.org>, -# Christian Faulhammer <fauli@gentoo.org> +# Christian Faulhammer <fauli@gentoo.org>, # Mark Lee <bzr-gentoo-overlay@lazymalevolence.com>, # and anyone who wants to help -# @BLURB: This eclass provides support to use the Bazaar DSCM +# @BLURB: This eclass provides support to use the Bazaar VCS # @DESCRIPTION: -# The bzr.eclass provides support for apps using the bazaar DSCM -# (distributed source control management system). +# The bzr.eclass provides support for apps using the Bazaar VCS +# (distributed version control system). # The eclass was originally derived from the git eclass. # # Note: Just set EBZR_REPO_URI to the URI of the branch and the src_unpack() @@ -101,8 +101,10 @@ EBZR_PATCHES="${EBZR_PATCHES:-}" # @ECLASS-VARIABLE: EBZR_REVISION # @DESCRIPTION: -# Revision to fetch, defaults to the latest (see -# http://bazaar-vcs.org/BzrRevisionSpec or bzr help revisionspec) +# Revision to fetch, defaults to the latest +# (see http://bazaar-vcs.org/BzrRevisionSpec or bzr help revisionspec). +# If you set this to a non-empty value, then it is recommended not to +# use a lightweight checkout (see also EBZR_FETCH_CMD). EBZR_REVISION="${EBZR_REVISION:-}" # @ECLASS-VARIABLE: EBZR_CACHE_DIR @@ -156,7 +158,6 @@ bzr_update() { fi } - # @FUNCTION: bzr_fetch # @DESCRIPTION: # Wrapper function to fetch sources from a Bazaar repository via bzr @@ -189,13 +190,15 @@ bzr_fetch() { if [[ ! -d ${EBZR_STORE_DIR} ]] ; then debug-print "${FUNCNAME}: initial branch. Creating bzr directory" + local save_sandbox_write=${SANDBOX_WRITE} addwrite / mkdir -p "${EBZR_STORE_DIR}" \ || die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}." - export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}" + SANDBOX_WRITE=${save_sandbox_write} fi - pushd "${EBZR_STORE_DIR}" > /dev/null || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}" + pushd "${EBZR_STORE_DIR}" > /dev/null \ + || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}" EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}" @@ -209,7 +212,8 @@ bzr_fetch() { # an older version of bzr.eclass) if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" - elif [[ -d "${EBZR_BRANCH_DIR}"/.bzr/repository/ ]]; then + elif [[ ${EBZR_FETCH_CMD} == *lightweight* \ + && -d ${EBZR_BRANCH_DIR}/.bzr/repository ]]; then einfo "Re-fetching the branch to save space..." rm -rf "${EBZR_BRANCH_DIR}" bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" @@ -220,18 +224,18 @@ bzr_fetch() { cd "${EBZR_BRANCH_DIR}" einfo "exporting ..." - ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} "${WORKDIR}/${P}" \ - || die "${EBZR}: export failed" - local revision - if [[ -n "${EBZR_REVISION}" ]]; then - revision="${EBZR_REVISION}" + if [[ -z ${EBZR_REVISION} ]]; then + rsync -rlpgo --exclude=".bzr/" . "${WORKDIR}/${P}" \ + || die "${EBZR}: export failed" else - revision=$(${EBZR_REVNO_CMD} "${EBZR_BRANCH_DIR}") + # revisions of a lightweight checkout are only available when online + [[ -z ${EBZR_OFFLINE} || -d ${EBZR_BRANCH_DIR}/.bzr/repository ]] \ + || die "${EBZR}: No support for revisions when off-line" + ${EBZR_EXPORT_CMD} -r "${EBZR_REVISION}" "${WORKDIR}/${P}" \ + || die "${EBZR}: export failed" fi - einfo "Revision ${revision} is now in ${WORKDIR}/${P}" - popd > /dev/null } |