/[gentoo-x86]/eclass/bzr.eclass
Gentoo

Diff of /eclass/bzr.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.6 Revision 1.7
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v 1.6 2009/12/09 10:04:16 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v 1.7 2009/12/18 07:08:19 ulm Exp $
4# 4#
5# @ECLASS: bzr.eclass 5# @ECLASS: bzr.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>, 7# Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>,
8# Ulrich Mueller <ulm@gentoo.org>, 8# Ulrich Mueller <ulm@gentoo.org>,
9# Christian Faulhammer <fauli@gentoo.org> 9# Christian Faulhammer <fauli@gentoo.org>,
10# Mark Lee <bzr-gentoo-overlay@lazymalevolence.com>, 10# Mark Lee <bzr-gentoo-overlay@lazymalevolence.com>,
11# and anyone who wants to help 11# and anyone who wants to help
12# @BLURB: This eclass provides support to use the Bazaar DSCM 12# @BLURB: This eclass provides support to use the Bazaar VCS
13# @DESCRIPTION: 13# @DESCRIPTION:
14# The bzr.eclass provides support for apps using the bazaar DSCM 14# The bzr.eclass provides support for apps using the Bazaar VCS
15# (distributed source control management system). 15# (distributed version control system).
16# The eclass was originally derived from the git eclass. 16# The eclass was originally derived from the git eclass.
17# 17#
18# Note: Just set EBZR_REPO_URI to the URI of the branch and the src_unpack() 18# Note: Just set EBZR_REPO_URI to the URI of the branch and the src_unpack()
19# of this eclass will put an export of the branch in ${WORKDIR}/${PN}. 19# of this eclass will put an export of the branch in ${WORKDIR}/${PN}.
20 20
99# location, the installation dies. 99# location, the installation dies.
100EBZR_PATCHES="${EBZR_PATCHES:-}" 100EBZR_PATCHES="${EBZR_PATCHES:-}"
101 101
102# @ECLASS-VARIABLE: EBZR_REVISION 102# @ECLASS-VARIABLE: EBZR_REVISION
103# @DESCRIPTION: 103# @DESCRIPTION:
104# Revision to fetch, defaults to the latest (see 104# Revision to fetch, defaults to the latest
105# http://bazaar-vcs.org/BzrRevisionSpec or bzr help revisionspec) 105# (see http://bazaar-vcs.org/BzrRevisionSpec or bzr help revisionspec).
106# If you set this to a non-empty value, then it is recommended not to
107# use a lightweight checkout (see also EBZR_FETCH_CMD).
106EBZR_REVISION="${EBZR_REVISION:-}" 108EBZR_REVISION="${EBZR_REVISION:-}"
107 109
108# @ECLASS-VARIABLE: EBZR_CACHE_DIR 110# @ECLASS-VARIABLE: EBZR_CACHE_DIR
109# @DESCRIPTION: 111# @DESCRIPTION:
110# The directory to store the source for the package, relative to 112# The directory to store the source for the package, relative to
153 ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} \ 155 ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} \
154 || die "${EBZR}: can't update from ${repository}." 156 || die "${EBZR}: can't update from ${repository}."
155 popd > /dev/null 157 popd > /dev/null
156 fi 158 fi
157} 159}
158
159 160
160# @FUNCTION: bzr_fetch 161# @FUNCTION: bzr_fetch
161# @DESCRIPTION: 162# @DESCRIPTION:
162# Wrapper function to fetch sources from a Bazaar repository via bzr 163# Wrapper function to fetch sources from a Bazaar repository via bzr
163# fetch or bzr update, depending on whether there is an existing 164# fetch or bzr update, depending on whether there is an existing
187 esac 188 esac
188 fi 189 fi
189 190
190 if [[ ! -d ${EBZR_STORE_DIR} ]] ; then 191 if [[ ! -d ${EBZR_STORE_DIR} ]] ; then
191 debug-print "${FUNCNAME}: initial branch. Creating bzr directory" 192 debug-print "${FUNCNAME}: initial branch. Creating bzr directory"
193 local save_sandbox_write=${SANDBOX_WRITE}
192 addwrite / 194 addwrite /
193 mkdir -p "${EBZR_STORE_DIR}" \ 195 mkdir -p "${EBZR_STORE_DIR}" \
194 || die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}." 196 || die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}."
195 export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}" 197 SANDBOX_WRITE=${save_sandbox_write}
196 fi 198 fi
197 199
198 pushd "${EBZR_STORE_DIR}" > /dev/null || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}" 200 pushd "${EBZR_STORE_DIR}" > /dev/null \
201 || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}"
199 202
200 EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}" 203 EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}"
201 204
202 addwrite "${EBZR_STORE_DIR}" 205 addwrite "${EBZR_STORE_DIR}"
203 addwrite "${EBZR_BRANCH_DIR}" 206 addwrite "${EBZR_BRANCH_DIR}"
207 # Run bzr_initial_fetch() only if the branch has not been pulled 210 # Run bzr_initial_fetch() only if the branch has not been pulled
208 # before or if the existing local copy is a full checkout (as did 211 # before or if the existing local copy is a full checkout (as did
209 # an older version of bzr.eclass) 212 # an older version of bzr.eclass)
210 if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then 213 if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then
211 bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" 214 bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
215 elif [[ ${EBZR_FETCH_CMD} == *lightweight* \
212 elif [[ -d "${EBZR_BRANCH_DIR}"/.bzr/repository/ ]]; then 216 && -d ${EBZR_BRANCH_DIR}/.bzr/repository ]]; then
213 einfo "Re-fetching the branch to save space..." 217 einfo "Re-fetching the branch to save space..."
214 rm -rf "${EBZR_BRANCH_DIR}" 218 rm -rf "${EBZR_BRANCH_DIR}"
215 bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" 219 bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
216 else 220 else
217 bzr_update "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" 221 bzr_update "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
218 fi 222 fi
219 223
220 cd "${EBZR_BRANCH_DIR}" 224 cd "${EBZR_BRANCH_DIR}"
221 225
222 einfo "exporting ..." 226 einfo "exporting ..."
223 ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} "${WORKDIR}/${P}" \ 227
228 if [[ -z ${EBZR_REVISION} ]]; then
229 rsync -rlpgo --exclude=".bzr/" . "${WORKDIR}/${P}" \
224 || die "${EBZR}: export failed" 230 || die "${EBZR}: export failed"
225
226 local revision
227 if [[ -n "${EBZR_REVISION}" ]]; then
228 revision="${EBZR_REVISION}"
229 else 231 else
230 revision=$(${EBZR_REVNO_CMD} "${EBZR_BRANCH_DIR}") 232 # revisions of a lightweight checkout are only available when online
233 [[ -z ${EBZR_OFFLINE} || -d ${EBZR_BRANCH_DIR}/.bzr/repository ]] \
234 || die "${EBZR}: No support for revisions when off-line"
235 ${EBZR_EXPORT_CMD} -r "${EBZR_REVISION}" "${WORKDIR}/${P}" \
236 || die "${EBZR}: export failed"
231 fi 237 fi
232
233 einfo "Revision ${revision} is now in ${WORKDIR}/${P}"
234 238
235 popd > /dev/null 239 popd > /dev/null
236} 240}
237 241
238# @FUNCTION: bzr_bootstrap 242# @FUNCTION: bzr_bootstrap

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20