/[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.47
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.47 2008/02/20 17:55:27 cardoe Exp $
4 4
5## --------------------------------------------------------------------------- # 5# @ECLASS: subversion.eclass
6# @MAINTAINER:
7# Akinori Hattori <hattya@gentoo.org>
8# Bo ├śrsted Andresen <zlin@gentoo.org>
9#
6# Author: Akinori Hattori <hattya@gentoo.org> 10# Original Author: Akinori Hattori <hattya@gentoo.org>
7# 11#
8# The subversion eclass is written to fetch the software sources from 12# @BLURB: The subversion eclass is written to fetch software sources from subversion repositories
9# subversion repositories like the cvs eclass. 13# @DESCRIPTION:
14# The subversion eclass provides functions to fetch, patch and bootstrap
15# software sources from subversion repositories.
10# 16#
11# 17# You must define the ESVN_REPO_URI variable before inheriting this eclass.
12# Description:
13# If you use this eclass, the ${S} is ${WORKDIR}/${P}.
14# It is necessary to define the ESVN_REPO_URI variable at least.
15#
16## --------------------------------------------------------------------------- #
17 18
18inherit eutils 19inherit eutils
19 20
20ESVN="subversion.eclass" 21ESVN="${ECLASS}"
21 22
22EXPORT_FUNCTIONS src_unpack 23EXPORT_FUNCTIONS src_unpack
23 24
24HOMEPAGE="http://subversion.tigris.org/"
25DESCRIPTION="Based on the ${ECLASS} eclass" 25DESCRIPTION="Based on the ${ECLASS} eclass"
26 26
27
28## -- add subversion in DEPEND
29#
30DEPEND="dev-util/subversion" 27DEPEND="dev-util/subversion
28 net-misc/rsync"
31 29
32 30# @ECLASS-VARIABLE: ESVN_STORE_DIR
33## -- ESVN_STORE_DIR: subversion sources store directory 31# @DESCRIPTION:
34# 32# subversion sources store directory. Users may override this in /etc/make.conf
35ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/svn-src" 33[[ -z ${ESVN_STORE_DIR} ]] && ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src"
36 34
37 35# @ECLASS-VARIABLE: ESVN_FETCH_CMD
38## -- ESVN_FETCH_CMD: subversion fetch command 36# @DESCRIPTION:
39# 37# subversion checkout command
40ESVN_FETCH_CMD="svn checkout" 38ESVN_FETCH_CMD="svn checkout"
41 39
42## -- ESVN_UPDATE_CMD: subversion update command 40# @ECLASS-VARIABLE: ESVN_UPDATE_CMD
43# 41# @DESCRIPTION:
42# subversion update command
44ESVN_UPDATE_CMD="svn update" 43ESVN_UPDATE_CMD="svn update"
45 44
46 45# @ECLASS-VARIABLE: ESVN_OPTIONS
47## -- ESVN_OPTIONS: 46# @DESCRIPTION:
48# 47# the options passed to checkout or update. If you want a specific revision see
49# the options passed to checkout or update. 48# ESVN_REPO_URI instead of using -rREV.
50#
51: ESVN_OPTIONS=${ESVN_OPTIONS:=} 49ESVN_OPTIONS="${ESVN_OPTIONS:-}"
52 50
53 51# @ECLASS-VARIABLE: ESVN_REPO_URI
54## -- ESVN_REPO_URI: repository uri 52# @DESCRIPTION:
53# repository uri
55# 54#
56# e.g. http://foo/trunk, svn://bar/trunk 55# e.g. http://foo/trunk, svn://bar/trunk, svn://bar/branch/foo@1234
57# 56#
58# supported protocols: 57# supported protocols:
59# http:// 58# http://
60# https:// 59# https://
61# svn:// 60# svn://
62# svn+ssh:// 61# svn+ssh://
63# 62#
63# to peg to a specific revision, append @REV to the repo's uri
64: ESVN_REPO_URI=${ESVN_REPO_URI:=} 64ESVN_REPO_URI="${ESVN_REPO_URI:-}"
65 65
66# @ECLASS-VARIABLE: ESVN_REVISION
67# @DESCRIPTION:
68# User configurable revision checkout or update to from the repository
69#
70# Useful for live svn or trunk svn ebuilds allowing the user to peg
71# to a specific revision
72#
73# Note: This should never be set in an ebuild!
74ESVN_REVISION="${ESVN_REVISION:-}"
66 75
76# @ECLASS-VARIABLE: ESVN_PROJECT
77# @DESCRIPTION:
67## -- ESVN_PROJECT: project name of your ebuild (= name space) 78# project name of your ebuild (= name space)
68# 79#
69# subversion eclass will check out the subversion repository like: 80# subversion eclass will check out the subversion repository like:
70# 81#
71# ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/} 82# ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/}
72# 83#
81# 92#
82# # jakarta commons-loggin 93# # jakarta commons-loggin
83# ESVN_PROJECT=commons/logging 94# ESVN_PROJECT=commons/logging
84# 95#
85# default: ${PN/-svn}. 96# default: ${PN/-svn}.
86#
87: ESVN_PROJECT=${ESVN_PROJECT:=${PN/-svn}} 97ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}"
88 98
89 99# @ECLASS-VARIABLE: ESVN_BOOTSTRAP
90## -- ESVN_BOOTSTRAP: 100# @DESCRIPTION:
91#
92# bootstrap script or command like autogen.sh or etc.. 101# bootstrap script or command like autogen.sh or etc..
93#
94: ESVN_BOOTSTRAP=${ESVN_BOOTSTRAP:=} 102ESVN_BOOTSTRAP="${ESVN_BOOTSTRAP:-}"
95 103
96 104# @ECLASS-VARIABLE: ESVN_PATCHES
97## -- ESVN_PATCHES: 105# @DESCRIPTION:
98#
99# subversion eclass can apply pathces in subversion_bootstrap(). 106# subversion eclass can apply patches in subversion_bootstrap().
100# you can use regexp in this valiable like *.diff or *.patch or etc. 107# you can use regexp in this variable like *.diff or *.patch or etc.
101# NOTE: this patches will apply before eval ESVN_BOOTSTRAP. 108# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed.
102# 109#
103# the process of applying the patch is: 110# Patches are searched both in ${PWD} and ${FILESDIR}, if not found in either
104# 1. just epatch it, if the patch exists in the path. 111# location, the installation dies.
105# 2. scan it under FILESDIR and epatch it, if the patch exists in FILESDIR.
106# 3. die.
107#
108: ESVN_PATCHES=${ESVN_PATCHES:=} 112ESVN_PATCHES="${ESVN_PATCHES:-}"
109 113
110 114# @ECLASS-VARIABLE: ESVN_RESTRICT
111## -- ESVN_RESTRICT: 115# @DESCRIPTION:
112#
113# this should be a space delimited list of subversion eclass features to 116# this should be a space delimited list of subversion eclass features to
114# restrict. 117# restrict.
115# export) 118# export)
116# don't export the working copy to S. 119# don't export the working copy to S.
117#
118: ESVN_RESTRICT=${ESVN_RESTRICT:=} 120ESVN_RESTRICT="${ESVN_RESTRICT:-}"
119 121
120 122# @FUNCTION: subversion_fetch
121## -- subversion_fetch() ----------------------------------------------------- # 123# @USAGE: [repo_uri] [destination]
124# @DESCRIPTION:
125# Wrapper function to fetch sources from subversion via svn checkout or svn update,
126# depending on whether there is an existing working copy in ${ESVN_STORE_DIR}.
122# 127#
128# Can take two optional parameters:
123# @param $1 - a repository URI. default is the ESVN_REPO_URI. 129# repo_uri - a repository URI. default is ESVN_REPO_URI.
124# @param $2 - a check out path in S. 130# destination - a check out path in S.
125#
126function subversion_fetch() { 131subversion_fetch() {
127
128 local repo_uri="$(subversion__get_repository_uri "${1}")" 132 local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")"
133 local revision="$(subversion__get_peg_revision "${1:-${ESVN_REPO_URI}}")"
129 local S_dest="${2}" 134 local S_dest="${2}"
135
136 [[ -n "${ESVN_REVISION}" ]] && revision="${ESVN_REVISION}"
130 137
131 # check for the protocol 138 # check for the protocol
132 local protocol="${repo_uri%%:*}" 139 local protocol="${repo_uri%%:*}"
133 140
134 case "${protocol}" in 141 case "${protocol}" in
142 fi 149 fi
143 ;; 150 ;;
144 svn|svn+ssh) 151 svn|svn+ssh)
145 ;; 152 ;;
146 *) 153 *)
147 die "${ESVN}: fetch from "${protocol}" is not yet implemented." 154 die "${ESVN}: fetch from '${protocol}' is not yet implemented."
148 ;; 155 ;;
149 esac 156 esac
150 157
151 # every time
152 addread "/etc/subversion" 158 addread "/etc/subversion"
153 addwrite "${ESVN_STORE_DIR}" 159 addwrite "${ESVN_STORE_DIR}"
154 160
155 if [[ ! -d "${ESVN_STORE_DIR}" ]]; then 161 if [[ ! -d ${ESVN_STORE_DIR} ]]; then
156 debug-print "${FUNCNAME}: initial checkout. creating subversion directory" 162 debug-print "${FUNCNAME}: initial checkout. creating subversion directory"
157 mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." 163 mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}."
158 fi 164 fi
159 165
160 cd "${ESVN_STORE_DIR}" || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}" 166 cd "${ESVN_STORE_DIR}" || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}"
161 167
162 local wc_path="$(subversion__get_wc_path "${repo_uri}")" 168 local wc_path="$(subversion__get_wc_path "${repo_uri}")"
163 local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion" 169 local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion"
170
171 [[ -n "${revision}" ]] && options="${options} -r ${revision}"
172
173 if [[ "${ESVN_OPTIONS}" = *-r* ]]; then
174 ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please"
175 ewarn "see \${ESVN_REPO_URI}"
176 fi
164 177
165 debug-print "${FUNCNAME}: wc_path = \"${wc_path}\"" 178 debug-print "${FUNCNAME}: wc_path = \"${wc_path}\""
166 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" 179 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
167 debug-print "${FUNCNAME}: options = \"${options}\"" 180 debug-print "${FUNCNAME}: options = \"${options}\""
168 181
169 if [[ ! -d "${wc_path}/.svn" ]]; then 182 if [[ ! -d ${wc_path}/.svn ]]; then
170 # first check out 183 # first check out
171 einfo "subversion check out start -->" 184 einfo "subversion check out start -->"
172 einfo " repository: ${repo_uri}" 185 einfo " repository: ${repo_uri}${revision:+@}${revision}"
173 186
174 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" 187 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
175 188
176 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 189 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
177 cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" 190 cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}"
178 ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch from ${repo_uri}." 191 ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch from ${repo_uri}."
179 192
180 else 193 else
181 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." 194 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
182 195
183 if [ "${ESVN_WC_URL}" != "$(subversion__get_repository_uri "${repo_uri}" 1)" ]; then 196 if [[ ${ESVN_WC_URL} != $(subversion__get_repository_uri "${repo_uri}") ]]; then
184 die "${ESVN}: ESVN_REPO_URI (or specified URI) and working copy's URL are not matched." 197 die "${ESVN}: ESVN_REPO_URI (or specified URI) and working copy's URL are not matched."
185 fi 198 fi
186 199
187 # update working copy 200 # update working copy
188 einfo "subversion update start -->" 201 einfo "subversion update start -->"
189 einfo " repository: ${repo_uri}" 202 einfo " repository: ${repo_uri}${revision:+@}${revision}"
190 203
191 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" 204 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
192 205
193 cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" 206 cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
194 ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}." 207 ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}."
207 #* svn export . "${S}" || die "${ESVN}: can't export to ${S}." 220 #* svn export . "${S}" || die "${ESVN}: can't export to ${S}."
208 rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}." 221 rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}."
209 fi 222 fi
210 223
211 echo 224 echo
212
213} 225}
214 226
215 227# @FUNCTION: subversion_bootstrap
216## -- subversion_bootstrap() ------------------------------------------------ # 228# @DESCRIPTION:
217# 229# Apply patches in ${ESVN_PATCHES} and run ${ESVN_BOOTSTRAP} if specified.
218function subversion_bootstrap() { 230subversion_bootstrap() {
219
220 if has "export" ${ESVN_RESTRICT}; then 231 if has "export" ${ESVN_RESTRICT}; then
221 return 232 return
222 fi 233 fi
223 234
224 cd "${S}" 235 cd "${S}"
225 236
226 if [[ -n "${ESVN_PATCHES}" ]]; then 237 if [[ -n ${ESVN_PATCHES} ]]; then
227 einfo "apply patches -->" 238 einfo "apply patches -->"
228 239
229 local p= 240 local patch fpatch
230 241
231 for p in ${ESVN_PATCHES}; do 242 for patch in ${ESVN_PATCHES}; do
232 if [[ -f "${p}" ]]; then 243 if [[ -f ${patch} ]]; then
233 epatch "${p}" 244 epatch "${patch}"
234 245
235 else 246 else
236 local q=
237
238 for q in ${FILESDIR}/${p}; do 247 for fpatch in ${FILESDIR}/${patch}; do
239 if [[ -f "${q}" ]]; then 248 if [[ -f ${fpatch} ]]; then
240 epatch "${q}" 249 epatch "${fpatch}"
241 250
242 else 251 else
243 die "${ESVN}; ${p} is not found" 252 die "${ESVN}: ${patch} not found"
244 253
245 fi 254 fi
246 done 255 done
256
247 fi 257 fi
248 done 258 done
249 259
250 echo 260 echo
251
252 fi 261 fi
253 262
254 if [[ -n "${ESVN_BOOTSTRAP}" ]]; then 263 if [[ -n ${ESVN_BOOTSTRAP} ]]; then
255 einfo "begin bootstrap -->" 264 einfo "begin bootstrap -->"
256 265
257 if [[ -f "${ESVN_BOOTSTRAP}" && -x "${ESVN_BOOTSTRAP}" ]]; then 266 if [[ -f ${ESVN_BOOTSTRAP} && -x ${ESVN_BOOTSTRAP} ]]; then
258 einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" 267 einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}"
259 eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." 268 eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP."
260 269
261 else 270 else
262 einfo " bootstrap with commands: ${ESVN_BOOTSTRAP}" 271 einfo " bootstrap with command: ${ESVN_BOOTSTRAP}"
263 eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP." 272 eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP."
264 273
265 fi 274 fi
266 fi 275 fi
267
268} 276}
269 277
270 278# @FUNCTION: subversion_src_unpack
271## -- subversion_src_unpack() ------------------------------------------------ # 279# @DESCRIPTION:
272# 280# default src_unpack. fetch and bootstrap.
273function subversion_src_unpack() { 281subversion_src_unpack() {
274
275 subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch." 282 subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
276 subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." 283 subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
277
278} 284}
279 285
280 286# @FUNCTION: subversion_wc_info
281## -- subversion_wc_info() --------------------------------------------------- # 287# @USAGE: [repo_uri]
288# @RETURN: ESVN_WC_URL, ESVN_WC_ROOT, ESVN_WC_UUID, ESVN_WC_REVISION and ESVN_WC_PATH
289# @DESCRIPTION:
290# Get svn info for the specified repo_uri. The default repo_uri is ESVN_REPO_URI.
282# 291#
283# @param $1 - repository URI. default is ESVN_REPO_URI. 292# The working copy information on the specified repository URI are set to
284# 293# ESVN_WC_* variables.
285function subversion_wc_info() { 294subversion_wc_info() {
286
287 local repo_uri="$(subversion__get_repository_uri "${1}")" 295 local repo_uri="$(subversion__get_repository_uri "${1}")"
288 local wc_path="$(subversion__get_wc_path "${repo_uri}")" 296 local wc_path="$(subversion__get_wc_path "${repo_uri}")"
289 297
290 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" 298 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
291 debug-print "${FUNCNAME}: wc_path = ${wc_path}" 299 debug-print "${FUNCNAME}: wc_path = ${wc_path}"
292 300
293 if [[ ! -e "${wc_path}" ]]; then 301 if [[ ! -d ${wc_path} ]]; then
294 return 1 302 return 1
295 fi 303 fi
296 304
297 local k 305 export ESVN_WC_URL="$(subversion__svn_info "${wc_path}" "URL")"
298 306 export ESVN_WC_ROOT="$(subversion__svn_info "${wc_path}" "Repository Root")"
299 for k in url revision; do 307 export ESVN_WC_UUID="$(subversion__svn_info "${wc_path}" "Repository UUID")"
300 export ESVN_WC_$(subversion__to_upper_case "${k}")="$(subversion__svn_info "${wc_path}" "${k}")" 308 export ESVN_WC_REVISION="$(subversion__svn_info "${wc_path}" "Revision")"
301 done 309 export ESVN_WC_PATH="${wc_path}"
302
303} 310}
304
305 311
306## -- Private Functions 312## -- Private Functions
307 313
308
309## -- subversion__svn_info() ------------------------------------------------- # 314## -- subversion__svn_info() ------------------------------------------------- #
310# 315#
311# @param $1 - a target. 316# param $1 - a target.
312# @param $2 - a key name. 317# param $2 - a key name.
313# 318#
314function subversion__svn_info() { 319subversion__svn_info() {
315
316 local target="${1}" 320 local target="${1}"
317 local key="${2}" 321 local key="${2}"
318 322
319 env LC_ALL=C svn info "${target}" | grep -i "^${key}" | cut -d" " -f2- 323 env LC_ALL=C svn info "${target}" | grep -i "^${key}" | cut -d" " -f2-
320
321} 324}
322
323 325
324## -- subversion__get_repository_uri() --------------------------------------- # 326## -- subversion__get_repository_uri() --------------------------------------- #
325# 327#
326# @param $1 - a repository URI. 328# param $1 - a repository URI.
327# @param $2 - a peg revision is deleted from a return value if this is
328# specified.
329#
330function subversion__get_repository_uri() { 329subversion__get_repository_uri() {
331 330 local repo_uri="${1}"
332 local repo_uri="${1:-${ESVN_REPO_URI}}"
333 local remove_peg_revision="${2}"
334 331
335 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" 332 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
336 debug-print "${FUNCNAME}: remove_peg_revision = ${remove_peg_revision}"
337 333
338 if [[ -z "${repo_uri}" ]]; then 334 if [[ -z ${repo_uri} ]]; then
339 die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." 335 die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty."
340 fi 336 fi
341 337
342 # delete trailing slash 338 # delete trailing slash
343 if [[ -z "${repo_uri##*/}" ]]; then 339 if [[ -z ${repo_uri##*/} ]]; then
344 repo_uri="${repo_uri%/}" 340 repo_uri="${repo_uri%/}"
345 fi 341 fi
346 342
347 if [[ -n "${remove_peg_revision}" ]]; then
348 if subversion__has_peg_revision "${repo_uri}"; then
349 repo_uri="${repo_uri%@*}" 343 repo_uri="${repo_uri%@*}"
350
351 debug-print "${FUNCNAME}: repo_uri has a peg revision"
352 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
353 fi
354 fi
355 344
356 echo "${repo_uri}" 345 echo "${repo_uri}"
357
358} 346}
359
360 347
361## -- subversion__get_wc_path() ---------------------------------------------- # 348## -- subversion__get_wc_path() ---------------------------------------------- #
362# 349#
363# @param $1 - a repository URI. 350# param $1 - a repository URI.
364#
365function subversion__get_wc_path() { 351subversion__get_wc_path() {
366
367 local repo_uri="$(subversion__get_repository_uri "${1}" 1)" 352 local repo_uri="$(subversion__get_repository_uri "${1}")"
368 353
369 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" 354 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
370 355
371 echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}" 356 echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}"
372
373} 357}
374 358
375
376## -- subversion__has_peg_revision() ----------------------------------------- # 359## -- subversion__get_peg_revision() ----------------------------------------- #
377# 360#
378# @param $1 - a repository URI. 361# param $1 - a repository URI.
379#
380function subversion__has_peg_revision() { 362subversion__get_peg_revision() {
381
382 local repo_uri="${1}" 363 local repo_uri="${1}"
383 364
384 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" 365 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
385 366
386 # repo_uri has peg revision ? 367 # repo_uri has peg revision ?
387 if [[ "${repo_uri}" != *@* ]]; then 368 if [[ ${repo_uri} != *@* ]]; then
388 debug-print "${FUNCNAME}: repo_uri does not have a peg revision." 369 debug-print "${FUNCNAME}: repo_uri does not have a peg revision."
389 return 1
390 fi 370 fi
391 371
392 local peg_rev="${repo_uri##*@}" 372 local peg_rev=
393 373 [[ ${repo_uri} = *@* ]] && peg_rev="${repo_uri##*@}"
394 case "$(subversion__to_upper_case "${peg_rev}")" in
395 [[:digit:]]*)
396 # NUMBER
397 ;;
398 HEAD|BASE|COMMITED|PREV)
399 ;;
400 {[^}]*})
401 # DATE
402 ;;
403 *)
404 debug-print "${FUNCNAME}: repo_uri does not have a peg revision."
405 return 1
406 ;;
407 esac
408 374
409 debug-print "${FUNCNAME}: peg_rev = ${peg_rev}" 375 debug-print "${FUNCNAME}: peg_rev = ${peg_rev}"
410 376
411 return 0 377 echo "${peg_rev}"
412
413} 378}
414
415
416## -- subversion__to_upper_case() ----------------------------------------- #
417#
418# @param $@ - the strings to upper case.
419#
420function subversion__to_upper_case() {
421 echo "${@}" | tr "[a-z]" "[A-Z]"
422}

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

  ViewVC Help
Powered by ViewVC 1.1.20