summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2012-09-18 06:41:45 +0000
committerUlrich Müller <ulm@gentoo.org>2012-09-18 06:41:45 +0000
commit5f2a6a59e46094f50df24e787f3e3820ef4d4370 (patch)
tree31197c8c7b23eb08f3586a8e5c13021530d04071 /eclass
parentBump syb to 0.3.7 (diff)
downloadhistorical-5f2a6a59e46094f50df24e787f3e3820ef4d4370.tar.gz
historical-5f2a6a59e46094f50df24e787f3e3820ef4d4370.tar.bz2
historical-5f2a6a59e46094f50df24e787f3e3820ef4d4370.zip
Use lightweight checkout instead of export if EBZR_WORKDIR_CHECKOUT is set; bug 434746. Remove old cleanup code.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/bzr.eclass43
2 files changed, 30 insertions, 19 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 4625635d7b02..9392a724f8fd 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.404 2012/09/18 01:26:55 radhermit Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.405 2012/09/18 06:41:45 ulm Exp $
+
+ 18 Sep 2012; Ulrich Müller <ulm@gentoo.org> bzr.eclass:
+ Use lightweight checkout instead of export if EBZR_WORKDIR_CHECKOUT is set;
+ bug 434746. Remove old cleanup code.
18 Sep 2012; Tim Harder <radhermit@gentoo.org> vim.eclass:
Use has_version instead of built_with_use.
diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
index 7b0a6e6a245b..edee2d8f61c4 100644
--- a/eclass/bzr.eclass
+++ b/eclass/bzr.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v 1.18 2012/07/18 15:12:54 ulm Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v 1.19 2012/09/18 06:41:45 ulm Exp $
#
# @ECLASS: bzr.eclass
# @MAINTAINER:
@@ -61,6 +61,11 @@ esac
# The Bazaar command to export a branch.
: ${EBZR_EXPORT_CMD:="bzr export"}
+# @ECLASS-VARIABLE: EBZR_CHECKOUT_CMD
+# @DESCRIPTION:
+# The Bazaar command to checkout a branch.
+: ${EBZR_CHECKOUT_CMD:="bzr checkout --lightweight -q"}
+
# @ECLASS-VARIABLE: EBZR_REVNO_CMD
# @DESCRIPTION:
# The Bazaar command to list a revision number of the branch.
@@ -145,6 +150,12 @@ esac
# by users.
: ${EBZR_OFFLINE=${EVCS_OFFLINE}}
+# @ECLASS-VARIABLE: EBZR_WORKDIR_CHECKOUT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If this variable is set to a non-empty value, EBZR_CHECKOUT_CMD will
+# be used instead of EBZR_EXPORT_CMD to copy the sources to WORKDIR.
+
# @FUNCTION: bzr_initial_fetch
# @USAGE: <repository URI> <branch directory>
# @DESCRIPTION:
@@ -196,11 +207,11 @@ bzr_update() {
# working copy.
bzr_fetch() {
local repo_dir branch_dir
+ local save_sandbox_write=${SANDBOX_WRITE}
[[ -n ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty"
if [[ ! -d ${EBZR_STORE_DIR} ]] ; then
- local save_sandbox_write=${SANDBOX_WRITE}
addwrite /
mkdir -p "${EBZR_STORE_DIR}" \
|| die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}"
@@ -215,19 +226,6 @@ bzr_fetch() {
addwrite "${EBZR_STORE_DIR}"
- # Clean up if the existing local copy is a checkout (as was the case
- # with an older version of bzr.eclass).
- # This test can be removed after 1 Mar 2012.
- if [[ ${EBZR_FETCH_CMD} != *checkout* && -d ${repo_dir}/.bzr/checkout ]]
- then
- local tmpname=$(mktemp -u "${repo_dir}._old_.XXXXXX")
- ewarn "checkout from old version of ${EBZR} found, moving it to:"
- ewarn "${tmpname}"
- ewarn "you may manually remove it"
- mv "${repo_dir}" "${tmpname}" \
- || die "${EBZR}: can't move old checkout out of the way"
- fi
-
if [[ ! -d ${branch_dir}/.bzr ]]; then
if [[ ${repo_dir} != "${branch_dir}" && ! -d ${repo_dir}/.bzr ]]; then
einfo "creating shared bzr repository: ${repo_dir}"
@@ -252,14 +250,23 @@ bzr_fetch() {
bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
fi
+ # Restore sandbox environment
+ SANDBOX_WRITE=${save_sandbox_write}
+
cd "${branch_dir}" || die "${EBZR}: can't chdir to ${branch_dir}"
# Save revision number in environment. #311101
export EBZR_REVNO=$(${EBZR_REVNO_CMD})
- einfo "exporting ..."
- ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
- "${WORKDIR}/${P}" . || die "${EBZR}: export failed"
+ if [[ -n ${EBZR_WORKDIR_CHECKOUT} ]]; then
+ einfo "checking out ..."
+ ${EBZR_CHECKOUT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
+ . "${WORKDIR}/${P}" || die "${EBZR}: checkout failed"
+ else
+ einfo "exporting ..."
+ ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
+ "${WORKDIR}/${P}" . || die "${EBZR}: export failed"
+ fi
einfo "revision ${EBZR_REVISION:-${EBZR_REVNO}} is now in ${WORKDIR}/${P}"
popd > /dev/null