| 1 | # Copyright 1999-2006 Gentoo Foundation |
1 | # Copyright 1999-2007 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.31 2006/04/30 09:26:56 hattya Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.39 2007/01/19 10:39:51 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 |
| … | |
… | |
| 46 | |
46 | |
| 47 | ## -- ESVN_OPTIONS: |
47 | ## -- ESVN_OPTIONS: |
| 48 | # |
48 | # |
| 49 | # the options passed to checkout or update. |
49 | # the options passed to checkout or update. |
| 50 | # |
50 | # |
| 51 | [ -z "${ESVN_OPTIONS}" ] && ESVN_OPTIONS= |
51 | : ESVN_OPTIONS=${ESVN_OPTIONS:=} |
| 52 | |
52 | |
| 53 | |
53 | |
| 54 | ## -- ESVN_REPO_URI: repository uri |
54 | ## -- ESVN_REPO_URI: repository uri |
| 55 | # |
55 | # |
| 56 | # e.g. http://foo/trunk, svn://bar/trunk |
56 | # e.g. http://foo/trunk, svn://bar/trunk |
| 57 | # |
57 | # |
| 58 | # supported protocols: |
58 | # supported protocols: |
| 59 | # http:// |
59 | # http:// |
| 60 | # https:// |
60 | # https:// |
| 61 | # svn:// |
61 | # svn:// |
|
|
62 | # svn+ssh:// |
| 62 | # |
63 | # |
| 63 | [ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI="" |
64 | : ESVN_REPO_URI=${ESVN_REPO_URI:=} |
| 64 | |
65 | |
| 65 | |
66 | |
| 66 | ## -- ESVN_PROJECT: project name of your ebuild |
67 | ## -- ESVN_PROJECT: project name of your ebuild (= name space) |
| 67 | # |
68 | # |
| 68 | # subversion eclass will check out the subversion repository like: |
69 | # subversion eclass will check out the subversion repository like: |
| 69 | # |
70 | # |
| 70 | # ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/} |
71 | # ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/} |
| 71 | # |
72 | # |
| … | |
… | |
| 73 | # http://svn.collab.net/repo/svn/trunk/. and PN is subversion-svn. |
74 | # http://svn.collab.net/repo/svn/trunk/. and PN is subversion-svn. |
| 74 | # it will check out like: |
75 | # it will check out like: |
| 75 | # |
76 | # |
| 76 | # ${ESVN_STORE_DIR}/subversion/trunk |
77 | # ${ESVN_STORE_DIR}/subversion/trunk |
| 77 | # |
78 | # |
|
|
79 | # this is not used in order to declare the name of the upstream project. |
|
|
80 | # so that you can declare this like: |
|
|
81 | # |
|
|
82 | # # jakarta commons-loggin |
|
|
83 | # ESVN_PROJECT=commons/logging |
|
|
84 | # |
| 78 | # default: ${PN/-svn}. |
85 | # default: ${PN/-svn}. |
| 79 | # |
86 | # |
| 80 | [ -z "${ESVN_PROJECT}" ] && ESVN_PROJECT="${PN/-svn}" |
87 | : ESVN_PROJECT=${ESVN_PROJECT:=${PN/-svn}} |
| 81 | |
88 | |
| 82 | |
89 | |
| 83 | ## -- ESVN_BOOTSTRAP: |
90 | ## -- ESVN_BOOTSTRAP: |
| 84 | # |
91 | # |
| 85 | # bootstrap script or command like autogen.sh or etc.. |
92 | # bootstrap script or command like autogen.sh or etc.. |
| 86 | # |
93 | # |
| 87 | [ -z "${ESVN_BOOTSTRAP}" ] && ESVN_BOOTSTRAP="" |
94 | : ESVN_BOOTSTRAP=${ESVN_BOOTSTRAP:=} |
| 88 | |
95 | |
| 89 | |
96 | |
| 90 | ## -- ESVN_PATCHES: |
97 | ## -- ESVN_PATCHES: |
| 91 | # |
98 | # |
| 92 | # subversion eclass can apply pathces in subversion_bootstrap(). |
99 | # subversion eclass can apply pathces in subversion_bootstrap(). |
| … | |
… | |
| 96 | # the process of applying the patch is: |
103 | # the process of applying the patch is: |
| 97 | # 1. just epatch it, if the patch exists in the path. |
104 | # 1. just epatch it, if the patch exists in the path. |
| 98 | # 2. scan it under FILESDIR and epatch it, if the patch exists in FILESDIR. |
105 | # 2. scan it under FILESDIR and epatch it, if the patch exists in FILESDIR. |
| 99 | # 3. die. |
106 | # 3. die. |
| 100 | # |
107 | # |
| 101 | [ -z "${ESVN_PATCHES}" ] && ESVN_PATCHES="" |
108 | : ESVN_PATCHES=${ESVN_PATCHES:=} |
| 102 | |
109 | |
| 103 | |
110 | |
|
|
111 | ## -- ESVN_RESTRICT: |
|
|
112 | # |
|
|
113 | # this should be a space delimited list of subversion eclass features to |
|
|
114 | # restrict. |
|
|
115 | # export) |
|
|
116 | # don't export the working copy to S. |
|
|
117 | # |
|
|
118 | : ESVN_RESTRICT=${ESVN_RESTRICT:=} |
|
|
119 | |
|
|
120 | |
| 104 | ## -- subversion_svn_fetch() ------------------------------------------------- # |
121 | ## -- subversion_fetch() ----------------------------------------------------- # |
| 105 | |
122 | # |
|
|
123 | # @param $1 - a repository URI. default is the ESVN_REPO_URI. |
|
|
124 | # |
| 106 | function subversion_svn_fetch() { |
125 | function subversion_fetch() { |
| 107 | |
126 | |
| 108 | local ESVN_CO_DIR |
127 | local repo_uri="$(subversion__get_repository_uri "${1}")" |
|
|
128 | local S_dest="${2}" |
| 109 | |
129 | |
| 110 | # ESVN_REPO_URI is empty. |
|
|
| 111 | [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty." |
|
|
| 112 | |
|
|
| 113 | # check for the protocol. |
130 | # check for the protocol |
| 114 | case ${ESVN_REPO_URI%%:*} in |
131 | local protocol="${repo_uri%%:*}" |
|
|
132 | |
|
|
133 | case "${protocol}" in |
| 115 | http|https) |
134 | http|https) |
| 116 | if built_with_use dev-util/subversion nowebdav; then |
135 | if built_with_use dev-util/subversion nowebdav; then |
|
|
136 | echo |
| 117 | eerror "In order to emerge this package, you need to" |
137 | eerror "In order to emerge this package, you need to" |
| 118 | eerror "re-emerge subversion with USE=-nowebdav" |
138 | eerror "re-emerge subversion with USE=-nowebdav" |
|
|
139 | echo |
| 119 | die "Please run 'USE=-nowebdav emerge subversion'" |
140 | die "${ESVN}: please run 'USE=-nowebdav emerge subversion'" |
| 120 | fi |
141 | fi |
| 121 | ;; |
142 | ;; |
| 122 | svn) ;; |
143 | svn|svn+ssh) |
|
|
144 | ;; |
| 123 | *) |
145 | *) |
| 124 | die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." |
146 | die "${ESVN}: fetch from "${protocol}" is not yet implemented." |
| 125 | ;; |
147 | ;; |
| 126 | esac |
148 | esac |
| 127 | |
149 | |
|
|
150 | # every time |
|
|
151 | addread "/etc/subversion" |
|
|
152 | addwrite "${ESVN_STORE_DIR}" |
|
|
153 | |
| 128 | if [ ! -d "${ESVN_STORE_DIR}" ]; then |
154 | if [[ ! -d "${ESVN_STORE_DIR}" ]]; then |
| 129 | debug-print "${FUNCNAME}: initial checkout. creating subversion directory" |
155 | debug-print "${FUNCNAME}: initial checkout. creating subversion directory" |
| 130 | |
|
|
| 131 | addwrite / |
|
|
| 132 | mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." |
156 | mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." |
| 133 | chmod -f o+rw "${ESVN_STORE_DIR}" || die "${ESVN}: can't chmod ${ESVN_STORE_DIR}." |
|
|
| 134 | export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}" |
|
|
| 135 | fi |
157 | fi |
| 136 | |
158 | |
| 137 | cd -P "${ESVN_STORE_DIR}" || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}" |
159 | cd "${ESVN_STORE_DIR}" || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}" |
| 138 | ESVN_STORE_DIR=${PWD} |
|
|
| 139 | |
160 | |
| 140 | # every time |
161 | local wc_path="$(subversion__get_wc_path "${repo_uri}")" |
| 141 | addwrite "/etc/subversion" |
|
|
| 142 | addwrite "${ESVN_STORE_DIR}" |
|
|
| 143 | |
|
|
| 144 | if ! has userpriv ${FEATURES}; then |
|
|
| 145 | # -userpriv |
|
|
| 146 | addwrite "/root/.subversion" |
|
|
| 147 | |
|
|
| 148 | else |
|
|
| 149 | # +userpriv |
|
|
| 150 | ESVN_OPTIONS="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion" |
162 | local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion" |
| 151 | |
163 | |
| 152 | fi |
164 | debug-print "${FUNCNAME}: wc_path = \"${wc_path}\"" |
| 153 | |
|
|
| 154 | [ -z "${ESVN_REPO_URI##*/}" ] && ESVN_REPO_URI="${ESVN_REPO_URI%/}" |
|
|
| 155 | ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}" |
|
|
| 156 | |
|
|
| 157 | debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" |
165 | debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" |
|
|
166 | debug-print "${FUNCNAME}: options = \"${options}\"" |
| 158 | |
167 | |
| 159 | if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then |
168 | if [[ ! -d "${wc_path}/.svn" ]]; then |
| 160 | # first check out |
169 | # first check out |
| 161 | einfo "subversion check out start -->" |
170 | einfo "subversion check out start -->" |
| 162 | einfo " repository: ${ESVN_REPO_URI}" |
171 | einfo " repository: ${repo_uri}" |
| 163 | |
172 | |
|
|
173 | debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" |
|
|
174 | |
| 164 | mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." |
175 | mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." |
| 165 | chmod -f o+rw "${ESVN_PROJECT}" || die "${ESVN}: can't chmod ${ESVN_PROJECT}." |
176 | cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" |
| 166 | cd "${ESVN_PROJECT}" |
177 | ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch from ${repo_uri}." |
| 167 | ${ESVN_FETCH_CMD} ${ESVN_OPTIONS} "${ESVN_REPO_URI}" || die "${ESVN}: can't fetch from ${ESVN_REPO_URI}." |
|
|
| 168 | |
178 | |
| 169 | else |
179 | else |
|
|
180 | subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." |
|
|
181 | |
|
|
182 | if [ "${ESVN_WC_URL}" != "$(subversion__get_repository_uri "${repo_uri}" 1)" ]; then |
|
|
183 | die "${ESVN}: ESVN_REPO_URI (or specified URI) and working copy's URL are not matched." |
|
|
184 | fi |
|
|
185 | |
| 170 | # update working copy |
186 | # update working copy |
| 171 | einfo "subversion update start -->" |
187 | einfo "subversion update start -->" |
| 172 | einfo " repository: ${ESVN_REPO_URI}" |
188 | einfo " repository: ${repo_uri}" |
| 173 | |
189 | |
| 174 | cd "${ESVN_CO_DIR}" |
190 | debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" |
|
|
191 | |
|
|
192 | cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" |
| 175 | ${ESVN_UPDATE_CMD} ${ESVN_OPTIONS} || die "${ESVN}: can't update from ${ESVN_REPO_URI}." |
193 | ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}." |
| 176 | |
194 | |
| 177 | fi |
195 | fi |
| 178 | |
196 | |
| 179 | einfo " working copy: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" |
197 | einfo " working copy: ${wc_path}" |
| 180 | |
198 | |
|
|
199 | if ! has "export" ${ESVN_RESTRICT}; then |
|
|
200 | cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" |
|
|
201 | |
|
|
202 | local S="${S}/${S_dest}" |
|
|
203 | |
| 181 | # export to the ${WORKDIR} |
204 | # export to the ${WORKDIR} |
| 182 | # "svn export" has a bug. see http://bugs.gentoo.org/119236 |
205 | #* "svn export" has a bug. see http://bugs.gentoo.org/119236 |
| 183 | #svn export "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${S}" || die "${ESVN}: can't export to ${S}." |
206 | #* svn export . "${S}" || die "${ESVN}: can't export to ${S}." |
| 184 | rsync -a --exclude=".svn/" "${ESVN_STORE_DIR}/${ESVN_CO_DIR}/" "${S}" || die "${ESVN}: can't export to ${S}." |
207 | rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}." |
|
|
208 | fi |
|
|
209 | |
| 185 | echo |
210 | echo |
| 186 | |
211 | |
| 187 | } |
212 | } |
| 188 | |
213 | |
| 189 | |
214 | |
| 190 | ## -- subversion_bootstrap() ------------------------------------------------ # |
215 | ## -- subversion_bootstrap() ------------------------------------------------ # |
| 191 | |
216 | # |
| 192 | function subversion_bootstrap() { |
217 | function subversion_bootstrap() { |
| 193 | |
218 | |
| 194 | local patch lpatch |
219 | if has "export" ${ESVN_RESTRICT}; then |
|
|
220 | return |
|
|
221 | fi |
| 195 | |
222 | |
| 196 | cd "${S}" |
223 | cd "${S}" |
| 197 | |
224 | |
| 198 | if [ "${ESVN_PATCHES}" ]; then |
225 | if [[ -n "${ESVN_PATCHES}" ]]; then |
| 199 | einfo "apply patches -->" |
226 | einfo "apply patches -->" |
| 200 | |
227 | |
|
|
228 | local p= |
|
|
229 | |
| 201 | for patch in ${ESVN_PATCHES}; do |
230 | for p in ${ESVN_PATCHES}; do |
| 202 | if [ -f "${patch}" ]; then |
231 | if [[ -f "${p}" ]]; then |
| 203 | epatch ${patch} |
232 | epatch "${p}" |
| 204 | |
233 | |
| 205 | else |
234 | else |
|
|
235 | local q= |
|
|
236 | |
| 206 | for lpatch in ${FILESDIR}/${patch}; do |
237 | for q in ${FILESDIR}/${p}; do |
| 207 | if [ -f "${lpatch}" ]; then |
238 | if [[ -f "${q}" ]]; then |
| 208 | epatch ${lpatch} |
239 | epatch "${q}" |
| 209 | |
240 | |
| 210 | else |
241 | else |
| 211 | die "${ESVN}; ${patch} is not found" |
242 | die "${ESVN}; ${p} is not found" |
| 212 | |
243 | |
| 213 | fi |
244 | fi |
| 214 | done |
245 | done |
| 215 | fi |
246 | fi |
| 216 | done |
247 | done |
|
|
248 | |
| 217 | echo |
249 | echo |
| 218 | fi |
|
|
| 219 | |
250 | |
|
|
251 | fi |
|
|
252 | |
| 220 | if [ "${ESVN_BOOTSTRAP}" ]; then |
253 | if [[ -n "${ESVN_BOOTSTRAP}" ]]; then |
| 221 | einfo "begin bootstrap -->" |
254 | einfo "begin bootstrap -->" |
| 222 | |
255 | |
| 223 | if [ -f "${ESVN_BOOTSTRAP}" -a -x "${ESVN_BOOTSTRAP}" ]; then |
256 | if [[ -f "${ESVN_BOOTSTRAP}" && -x "${ESVN_BOOTSTRAP}" ]]; then |
| 224 | einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" |
257 | einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" |
| 225 | eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." |
258 | eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." |
| 226 | |
259 | |
| 227 | else |
260 | else |
| 228 | einfo " bootstrap with commands: ${ESVN_BOOTSTRAP}" |
261 | einfo " bootstrap with commands: ${ESVN_BOOTSTRAP}" |
| … | |
… | |
| 233 | |
266 | |
| 234 | } |
267 | } |
| 235 | |
268 | |
| 236 | |
269 | |
| 237 | ## -- subversion_src_unpack() ------------------------------------------------ # |
270 | ## -- subversion_src_unpack() ------------------------------------------------ # |
| 238 | |
271 | # |
| 239 | function subversion_src_unpack() { |
272 | function subversion_src_unpack() { |
| 240 | |
273 | |
| 241 | subversion_svn_fetch || die "${ESVN}: unknown problem in subversion_svn_fetch()." |
274 | subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch." |
| 242 | subversion_bootstrap || die "${ESVN}: unknown problem in subversion_bootstrap()." |
275 | subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." |
| 243 | |
276 | |
| 244 | } |
277 | } |
|
|
278 | |
|
|
279 | |
|
|
280 | ## -- subversion_wc_info() --------------------------------------------------- # |
|
|
281 | # |
|
|
282 | # @param $1 - repository URI. default is ESVN_REPO_URI. |
|
|
283 | # |
|
|
284 | function subversion_wc_info() { |
|
|
285 | |
|
|
286 | local repo_uri="$(subversion__get_repository_uri "${1}")" |
|
|
287 | local wc_path="$(subversion__get_wc_path "${repo_uri}")" |
|
|
288 | |
|
|
289 | debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" |
|
|
290 | debug-print "${FUNCNAME}: wc_path = ${wc_path}" |
|
|
291 | |
|
|
292 | if [[ ! -e "${wc_path}" ]]; then |
|
|
293 | return 1 |
|
|
294 | fi |
|
|
295 | |
|
|
296 | local k |
|
|
297 | |
|
|
298 | for k in url revision; do |
|
|
299 | export ESVN_WC_$(echo "${k}" | tr "[a-z]" "[A-Z]")="$(subversion__svn_info "${wc_path}" "${k}")" |
|
|
300 | done |
|
|
301 | |
|
|
302 | } |
|
|
303 | |
|
|
304 | |
|
|
305 | ## -- Private Functions |
|
|
306 | |
|
|
307 | |
|
|
308 | ## -- subversion__svn_info() ------------------------------------------------- # |
|
|
309 | # |
|
|
310 | # @param $1 - a target. |
|
|
311 | # @param $2 - a key name. |
|
|
312 | # |
|
|
313 | function subversion__svn_info() { |
|
|
314 | |
|
|
315 | local target="${1}" |
|
|
316 | local key="${2}" |
|
|
317 | |
|
|
318 | env LC_ALL=C svn info "${target}" | grep -i "^${key}" | cut -d" " -f2- |
|
|
319 | |
|
|
320 | } |
|
|
321 | |
|
|
322 | |
|
|
323 | ## -- subversion__get_repository_uri() --------------------------------------- # |
|
|
324 | # |
|
|
325 | # @param $1 - a repository URI. |
|
|
326 | # @param $2 - a peg revision is deleted from a return value if this is |
|
|
327 | # specified. |
|
|
328 | # |
|
|
329 | function subversion__get_repository_uri() { |
|
|
330 | |
|
|
331 | local repo_uri="${1:-${ESVN_REPO_URI}}" |
|
|
332 | local remove_peg_revision="${2}" |
|
|
333 | |
|
|
334 | debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" |
|
|
335 | debug-print "${FUNCNAME}: remove_peg_revision = ${remove_peg_revision}" |
|
|
336 | |
|
|
337 | if [[ -z "${repo_uri}" ]]; then |
|
|
338 | die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." |
|
|
339 | fi |
|
|
340 | |
|
|
341 | # delete trailing slash |
|
|
342 | if [[ -z "${repo_uri##*/}" ]]; then |
|
|
343 | repo_uri="${repo_uri%/}" |
|
|
344 | fi |
|
|
345 | |
|
|
346 | if [[ -n "${remove_peg_revision}" ]]; then |
|
|
347 | if subversion__has_peg_revision "${repo_uri}"; then |
|
|
348 | repo_uri="${repo_uri%@*}" |
|
|
349 | |
|
|
350 | debug-print "${FUNCNAME}: repo_uri has a peg revision" |
|
|
351 | debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" |
|
|
352 | fi |
|
|
353 | fi |
|
|
354 | |
|
|
355 | echo "${repo_uri}" |
|
|
356 | |
|
|
357 | } |
|
|
358 | |
|
|
359 | |
|
|
360 | ## -- subversion__get_wc_path() ---------------------------------------------- # |
|
|
361 | # |
|
|
362 | # @param $1 - a repository URI. |
|
|
363 | # |
|
|
364 | function subversion__get_wc_path() { |
|
|
365 | |
|
|
366 | local repo_uri="$(subversion__get_repository_uri "${1}" 1)" |
|
|
367 | |
|
|
368 | debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" |
|
|
369 | |
|
|
370 | echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}" |
|
|
371 | |
|
|
372 | } |
|
|
373 | |
|
|
374 | |
|
|
375 | ## -- subversion__has_peg_revision() ----------------------------------------- # |
|
|
376 | # |
|
|
377 | # @param $1 - a repository URI. |
|
|
378 | # |
|
|
379 | function subversion__has_peg_revision() { |
|
|
380 | |
|
|
381 | local repo_uri="${1}" |
|
|
382 | |
|
|
383 | debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" |
|
|
384 | |
|
|
385 | # repo_uri has peg revision ? |
|
|
386 | if [[ "${repo_uri}" != *@* ]]; then |
|
|
387 | debug-print "${FUNCNAME}: repo_uri does not have a peg revision." |
|
|
388 | return 1 |
|
|
389 | fi |
|
|
390 | |
|
|
391 | local peg_rev="${repo_uri##*@}" |
|
|
392 | local rev=$(subversion__svn_info "${repo_uri}" "revision") |
|
|
393 | |
|
|
394 | debug-print "${FUNCNAME}: peg_rev = ${peg_rev}" |
|
|
395 | debug-print "${FUNCNAME}: rev = ${rev} " |
|
|
396 | |
|
|
397 | if [[ "${peg_rev}" -eq "${rev}" ]]; then |
|
|
398 | return 0 |
|
|
399 | fi |
|
|
400 | |
|
|
401 | return 1 |
|
|
402 | |
|
|
403 | } |