Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] changes to bzr.eclass
Date: Tue, 15 Dec 2009 10:10:43
Message-Id: 19239.22843.266595.905319@a1i15.kph.uni-mainz.de
1 Hi,
2
3 bzr.eclass currently uses "bzr export" for copying from
4 ${DISTDIR}/bzr-src to ${WORKDIR} in src_unpack. Unfortunately,
5 "bzr export" accesses the remote repository for lightweight checkouts
6 (which are the eclass's default), so it cannot be used off-line.
7
8 Besides, it is very slow: In my test (GNU Emacs BZR repo, 2 Mbit/s
9 connection) bzr export took 54 minutes, whereas the initial checkout
10 took only 11 minutes.
11
12 The patch included below fixes this problem by using "rsync" instead
13 of "bzr export" in most cases. Additionally, a problem with updating
14 of non-lightweight checkouts is fixed, and restoring of the
15 SANDBOX_WRITE variable is made more robust.
16
17 Please review.
18
19 Ulrich
20
21
22 --- bzr.eclass 9 Dec 2009 10:04:16 -0000 1.6
23 +++ bzr.eclass 14 Dec 2009 20:54:27 -0000
24 @@ -189,10 +189,11 @@
25
26 if [[ ! -d ${EBZR_STORE_DIR} ]] ; then
27 debug-print "${FUNCNAME}: initial branch. Creating bzr directory"
28 + local save_sandbox_write=${SANDBOX_WRITE}
29 addwrite /
30 mkdir -p "${EBZR_STORE_DIR}" \
31 || die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}."
32 - export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}"
33 + SANDBOX_WRITE=${save_sandbox_write}
34 fi
35
36 pushd "${EBZR_STORE_DIR}" > /dev/null || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}"
37 @@ -209,7 +210,8 @@
38 # an older version of bzr.eclass)
39 if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then
40 bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
41 - elif [[ -d "${EBZR_BRANCH_DIR}"/.bzr/repository/ ]]; then
42 + elif [[ ${EBZR_FETCH_CMD} == *lightweight* \
43 + && -d ${EBZR_BRANCH_DIR}/.bzr/repository ]]; then
44 einfo "Re-fetching the branch to save space..."
45 rm -rf "${EBZR_BRANCH_DIR}"
46 bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
47 @@ -220,18 +222,18 @@
48 cd "${EBZR_BRANCH_DIR}"
49
50 einfo "exporting ..."
51 - ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} "${WORKDIR}/${P}" \
52 - || die "${EBZR}: export failed"
53
54 - local revision
55 - if [[ -n "${EBZR_REVISION}" ]]; then
56 - revision="${EBZR_REVISION}"
57 - else
58 - revision=$(${EBZR_REVNO_CMD} "${EBZR_BRANCH_DIR}")
59 + if [[ -z ${EBZR_REVISION} ]]; then
60 + rsync -rlpgo --exclude=".bzr/" . "${WORKDIR}/${P}" \
61 + || die "${EBZR}: export failed"
62 + else
63 + # revisions of a lightweight checkout are only available when online
64 + [[ -z ${EBZR_OFFLINE} || -d ${EBZR_BRANCH_DIR}/.bzr/repository ]] \
65 + || die "${EBZR}: No support for revisions when off-line"
66 + ${EBZR_EXPORT_CMD} -r "${EBZR_REVISION}" "${WORKDIR}/${P}" \
67 + || die "${EBZR}: export failed"
68 fi
69
70 - einfo "Revision ${revision} is now in ${WORKDIR}/${P}"
71 -
72 popd > /dev/null
73 }

Replies

Subject Author
Re: [gentoo-dev] changes to bzr.eclass Peter Volkov <pva@g.o>
[gentoo-dev] Re: changes to bzr.eclass Ulrich Mueller <ulm@g.o>