/[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.9
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.9 2010/07/01 09:23:37 fauli 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
28esac 28esac
29 29
30HOMEPAGE="http://bazaar-vcs.org/" 30HOMEPAGE="http://bazaar-vcs.org/"
31DESCRIPTION="Based on the ${EBZR} eclass" 31DESCRIPTION="Based on the ${EBZR} eclass"
32 32
33DEPEND=">=dev-util/bzr-1.5" 33DEPEND=">=dev-vcs/bzr-1.5"
34 34
35# @ECLASS-VARIABLE: EBZR_STORE_DIR 35# @ECLASS-VARIABLE: EBZR_STORE_DIR
36# @DESCRIPTION: 36# @DESCRIPTION:
37# The directory to store all fetched Bazaar live sources. 37# The directory to store all fetched Bazaar live sources.
38: ${EBZR_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/bzr-src} 38: ${EBZR_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/bzr-src}
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
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 160
159
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
164# working copy in ${EBZR_BRANCH_DIR}. 165# working copy in ${EBZR_BRANCH_DIR}.
173 case ${EBZR_REPO_URI%%:*} in 174 case ${EBZR_REPO_URI%%:*} in
174 # lp: seems to be an alias to https://launchpad.net 175 # lp: seems to be an alias to https://launchpad.net
175 http|https|rsync|lp) 176 http|https|rsync|lp)
176 ;; 177 ;;
177 sftp) 178 sftp)
178 if ! built_with_use --missing true dev-util/bzr sftp; then 179 if ! built_with_use --missing true dev-vcs/bzr sftp; then
179 eerror "To fetch sources from ${EBZR_REPO_URI} you need SFTP" 180 eerror "To fetch sources from ${EBZR_REPO_URI} you need SFTP"
180 eerror "support in dev-util/bzr." 181 eerror "support in dev-vcs/bzr."
181 die "Please, rebuild dev-util/bzr with the sftp USE flag enabled." 182 die "Please, rebuild dev-vcs/bzr with the sftp USE flag enabled."
182 fi 183 fi
183 ;; 184 ;;
184 *) 185 *)
185 die "${EBZR}: fetch from ${EBZR_REPO_URI%:*} is not yet implemented." 186 die "${EBZR}: fetch from ${EBZR_REPO_URI%:*} is not yet implemented."
186 ;; 187 ;;
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}"
212 elif [[ -d "${EBZR_BRANCH_DIR}"/.bzr/repository/ ]]; then
213 einfo "Re-fetching the branch to save space..."
214 rm -rf "${EBZR_BRANCH_DIR}"
215 bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
216 else 215 else
217 bzr_update "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" 216 bzr_update "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
218 fi 217 fi
219 218
220 cd "${EBZR_BRANCH_DIR}" 219 cd "${EBZR_BRANCH_DIR}"
221 220
222 einfo "exporting ..." 221 einfo "exporting ..."
223 ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} "${WORKDIR}/${P}" \ 222
223 if [[ -z ${EBZR_REVISION} ]]; then
224 rsync -rlpgo --exclude=".bzr/" . "${WORKDIR}/${P}" \
224 || die "${EBZR}: export failed" 225 || die "${EBZR}: export failed"
225
226 local revision
227 if [[ -n "${EBZR_REVISION}" ]]; then
228 revision="${EBZR_REVISION}"
229 else 226 else
230 revision=$(${EBZR_REVNO_CMD} "${EBZR_BRANCH_DIR}") 227 # revisions of a lightweight checkout are only available when online
228 [[ -z ${EBZR_OFFLINE} || -d ${EBZR_BRANCH_DIR}/.bzr/repository ]] \
229 || die "${EBZR}: No support for revisions when off-line"
230 ${EBZR_EXPORT_CMD} -r "${EBZR_REVISION}" "${WORKDIR}/${P}" \
231 || die "${EBZR}: export failed"
231 fi 232 fi
232
233 einfo "Revision ${revision} is now in ${WORKDIR}/${P}"
234 233
235 popd > /dev/null 234 popd > /dev/null
236} 235}
237 236
238# @FUNCTION: bzr_bootstrap 237# @FUNCTION: bzr_bootstrap

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

  ViewVC Help
Powered by ViewVC 1.1.20