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

Diff of /eclass/subversion.eclass

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

Revision 1.41 Revision 1.45
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2008 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/subversion.eclass,v 1.41 2007/04/01 14:48:37 hattya Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.45 2008/02/17 07:59:06 hattya Exp $
4 4
5## --------------------------------------------------------------------------- # 5## --------------------------------------------------------------------------- #
6# Author: Akinori Hattori <hattya@gentoo.org> 6# Author: Akinori Hattori <hattya@gentoo.org>
7# 7#
8# The subversion eclass is written to fetch the software sources from 8# The subversion eclass is written to fetch the software sources from
19 19
20ESVN="subversion.eclass" 20ESVN="subversion.eclass"
21 21
22EXPORT_FUNCTIONS src_unpack 22EXPORT_FUNCTIONS src_unpack
23 23
24HOMEPAGE="http://subversion.tigris.org/"
25DESCRIPTION="Based on the ${ECLASS} eclass" 24DESCRIPTION="Based on the ${ECLASS} eclass"
26 25
27 26
28## -- add subversion in DEPEND 27## -- add subversion in DEPEND
29# 28#
30DEPEND="dev-util/subversion" 29DEPEND="dev-util/subversion"
31 30
32 31
33## -- ESVN_STORE_DIR: subversion sources store directory 32## -- ESVN_STORE_DIR: subversion sources store directory
34# 33#
35ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/svn-src" 34[ -z "${ESVN_STORE_DIR}" ] && ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src"
36 35
37 36
38## -- ESVN_FETCH_CMD: subversion fetch command 37## -- ESVN_FETCH_CMD: subversion fetch command
39# 38#
40ESVN_FETCH_CMD="svn checkout" 39ESVN_FETCH_CMD="svn checkout"
46 45
47## -- ESVN_OPTIONS: 46## -- ESVN_OPTIONS:
48# 47#
49# the options passed to checkout or update. 48# the options passed to checkout or update.
50# 49#
51: ESVN_OPTIONS=${ESVN_OPTIONS:=} 50: ${ESVN_OPTIONS:=}
52 51
53 52
54## -- ESVN_REPO_URI: repository uri 53## -- ESVN_REPO_URI: repository uri
55# 54#
56# e.g. http://foo/trunk, svn://bar/trunk 55# e.g. http://foo/trunk, svn://bar/trunk
59# http:// 58# http://
60# https:// 59# https://
61# svn:// 60# svn://
62# svn+ssh:// 61# svn+ssh://
63# 62#
64: ESVN_REPO_URI=${ESVN_REPO_URI:=} 63: ${ESVN_REPO_URI:=}
65 64
66 65
67## -- ESVN_PROJECT: project name of your ebuild (= name space) 66## -- ESVN_PROJECT: project name of your ebuild (= name space)
68# 67#
69# subversion eclass will check out the subversion repository like: 68# subversion eclass will check out the subversion repository like:
82# # jakarta commons-loggin 81# # jakarta commons-loggin
83# ESVN_PROJECT=commons/logging 82# ESVN_PROJECT=commons/logging
84# 83#
85# default: ${PN/-svn}. 84# default: ${PN/-svn}.
86# 85#
87: ESVN_PROJECT=${ESVN_PROJECT:=${PN/-svn}} 86: ${ESVN_PROJECT:=${PN/-svn}}
88 87
89 88
90## -- ESVN_BOOTSTRAP: 89## -- ESVN_BOOTSTRAP:
91# 90#
92# bootstrap script or command like autogen.sh or etc.. 91# bootstrap script or command like autogen.sh or etc..
93# 92#
94: ESVN_BOOTSTRAP=${ESVN_BOOTSTRAP:=} 93: ${ESVN_BOOTSTRAP:=}
95 94
96 95
97## -- ESVN_PATCHES: 96## -- ESVN_PATCHES:
98# 97#
99# subversion eclass can apply pathces in subversion_bootstrap(). 98# subversion eclass can apply pathces in subversion_bootstrap().
100# you can use regexp in this valiable like *.diff or *.patch or etc. 99# you can use regexp in this variable like *.diff or *.patch or etc.
101# NOTE: this patches will apply before eval ESVN_BOOTSTRAP. 100# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed.
102# 101#
103# the process of applying the patch is: 102# the process of applying the patch is:
104# 1. just epatch it, if the patch exists in the path. 103# 1. just epatch it, if the patch exists in the path.
105# 2. scan it under FILESDIR and epatch it, if the patch exists in FILESDIR. 104# 2. scan it under FILESDIR and epatch it, if the patch exists in FILESDIR.
106# 3. die. 105# 3. die.
107# 106#
108: ESVN_PATCHES=${ESVN_PATCHES:=} 107: ${ESVN_PATCHES:=}
109 108
110 109
111## -- ESVN_RESTRICT: 110## -- ESVN_RESTRICT:
112# 111#
113# this should be a space delimited list of subversion eclass features to 112# this should be a space delimited list of subversion eclass features to
114# restrict. 113# restrict.
115# export) 114# export)
116# don't export the working copy to S. 115# don't export the working copy to S.
117# 116#
118: ESVN_RESTRICT=${ESVN_RESTRICT:=} 117: ${ESVN_RESTRICT:=}
119 118
120 119
121## -- subversion_fetch() ----------------------------------------------------- # 120## -- subversion_fetch() ----------------------------------------------------- #
122# 121#
123# @param $1 - a repository URI. default is the ESVN_REPO_URI. 122# @param $1 - a repository URI. default is the ESVN_REPO_URI.
224 cd "${S}" 223 cd "${S}"
225 224
226 if [[ -n "${ESVN_PATCHES}" ]]; then 225 if [[ -n "${ESVN_PATCHES}" ]]; then
227 einfo "apply patches -->" 226 einfo "apply patches -->"
228 227
229 local p= 228 local patch fpatch
230 229
231 for p in ${ESVN_PATCHES}; do 230 for patch in ${ESVN_PATCHES}; do
232 if [[ -f "${p}" ]]; then 231 if [[ -f "${patch}" ]]; then
233 epatch "${p}" 232 epatch "${patch}"
234 233
235 else 234 else
236 local q=
237
238 for q in ${FILESDIR}/${p}; do 235 for fpatch in ${FILESDIR}/${patch}; do
239 if [[ -f "${q}" ]]; then 236 if [[ -f "${fpatch}" ]]; then
240 epatch "${q}" 237 epatch "${fpatch}"
241 238
242 else 239 else
243 die "${ESVN}; ${p} is not found" 240 die "${ESVN}: ${patch} not found"
244 241
245 fi 242 fi
246 done 243 done
244
247 fi 245 fi
248 done 246 done
249 247
250 echo 248 echo
251
252 fi 249 fi
253 250
254 if [[ -n "${ESVN_BOOTSTRAP}" ]]; then 251 if [[ -n "${ESVN_BOOTSTRAP}" ]]; then
255 einfo "begin bootstrap -->" 252 einfo "begin bootstrap -->"
256 253
257 if [[ -f "${ESVN_BOOTSTRAP}" && -x "${ESVN_BOOTSTRAP}" ]]; then 254 if [[ -f "${ESVN_BOOTSTRAP}" && -x "${ESVN_BOOTSTRAP}" ]]; then
258 einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" 255 einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}"
259 eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." 256 eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP."
260 257
261 else 258 else
262 einfo " bootstrap with commands: ${ESVN_BOOTSTRAP}" 259 einfo " bootstrap with command: ${ESVN_BOOTSTRAP}"
263 eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP." 260 eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP."
264 261
265 fi 262 fi
266 fi 263 fi
267 264
278} 275}
279 276
280 277
281## -- subversion_wc_info() --------------------------------------------------- # 278## -- subversion_wc_info() --------------------------------------------------- #
282# 279#
280# the working copy information on the specified repository URI are set to
281# ESVN_WC_* variables.
282#
283# the available variables:
284# ESVN_WC_URL
285# ESVN_WC_REVISION
286# ESVN_WC_PATH
287#
283# @param $1 - repository URI. default is ESVN_REPO_URI. 288# @param $1 - repository URI. default is ESVN_REPO_URI.
284# 289#
285function subversion_wc_info() { 290function subversion_wc_info() {
286 291
287 local repo_uri="$(subversion__get_repository_uri "${1}")" 292 local repo_uri="$(subversion__get_repository_uri "${1}")"
288 local wc_path="$(subversion__get_wc_path "${repo_uri}")" 293 local wc_path="$(subversion__get_wc_path "${repo_uri}")"
289 294
290 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" 295 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
291 debug-print "${FUNCNAME}: wc_path = ${wc_path}" 296 debug-print "${FUNCNAME}: wc_path = ${wc_path}"
292 297
293 if [[ ! -e "${wc_path}" ]]; then 298 if [[ ! -d "${wc_path}" ]]; then
294 return 1 299 return 1
295 fi 300 fi
296 301
297 local k 302 local k
298 303
299 for k in url revision; do 304 for k in url revision; do
300 export ESVN_WC_$(subversion__to_upper_case "${k}")="$(subversion__svn_info "${wc_path}" "${k}")" 305 export ESVN_WC_$(subversion__to_upper_case "${k}")="$(subversion__svn_info "${wc_path}" "${k}")"
301 done 306 done
307
308 export ESVN_WC_PATH="${wc_path}"
302 309
303} 310}
304 311
305 312
306## -- Private Functions 313## -- Private Functions
416## -- subversion__to_upper_case() ----------------------------------------- # 423## -- subversion__to_upper_case() ----------------------------------------- #
417# 424#
418# @param $@ - the strings to upper case. 425# @param $@ - the strings to upper case.
419# 426#
420function subversion__to_upper_case() { 427function subversion__to_upper_case() {
421 echo "${@}" | tr "[a-z]" "[A-Z]" 428
429 echo "${@}" | tr "[:lower:]" "[:upper:]"
430
422} 431}

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.45

  ViewVC Help
Powered by ViewVC 1.1.20