| 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/subversion.eclass,v 1.62 2009/04/26 01:57:14 arfrever Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.63 2009/04/26 02:18:09 arfrever Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: subversion.eclass |
5 | # @ECLASS: subversion.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Akinori Hattori <hattya@gentoo.org> |
7 | # Akinori Hattori <hattya@gentoo.org> |
| 8 | # Bo Ørsted Andresen <zlin@gentoo.org> |
8 | # Bo Ørsted Andresen <zlin@gentoo.org> |
| … | |
… | |
| 74 | # Useful for live svn or trunk svn ebuilds allowing the user to peg |
74 | # Useful for live svn or trunk svn ebuilds allowing the user to peg |
| 75 | # to a specific revision |
75 | # to a specific revision |
| 76 | # |
76 | # |
| 77 | # Note: This should never be set in an ebuild! |
77 | # Note: This should never be set in an ebuild! |
| 78 | ESVN_REVISION="${ESVN_REVISION:-}" |
78 | ESVN_REVISION="${ESVN_REVISION:-}" |
|
|
79 | |
|
|
80 | # @ECLASS-VARIABLE: ESVN_USER |
|
|
81 | # @DESCRIPTION: |
|
|
82 | # User name |
|
|
83 | ESVN_USER="${ESVN_USER:-}" |
|
|
84 | |
|
|
85 | # @ECLASS-VARIABLE: ESVN_PASSWORD |
|
|
86 | # @DESCRIPTION: |
|
|
87 | # Password |
|
|
88 | ESVN_PASSWORD="${ESVN_PASSWORD:-}" |
| 79 | |
89 | |
| 80 | # @ECLASS-VARIABLE: ESVN_PROJECT |
90 | # @ECLASS-VARIABLE: ESVN_PROJECT |
| 81 | # @DESCRIPTION: |
91 | # @DESCRIPTION: |
| 82 | # project name of your ebuild (= name space) |
92 | # project name of your ebuild (= name space) |
| 83 | # |
93 | # |
| … | |
… | |
| 169 | local protocol="${repo_uri%%:*}" |
179 | local protocol="${repo_uri%%:*}" |
| 170 | |
180 | |
| 171 | case "${protocol}" in |
181 | case "${protocol}" in |
| 172 | http|https) |
182 | http|https) |
| 173 | if ! built_with_use --missing true -o dev-util/subversion webdav-neon webdav-serf || \ |
183 | if ! built_with_use --missing true -o dev-util/subversion webdav-neon webdav-serf || \ |
| 174 | built_with_use --missing false dev-util/subversion nowebdav ; then |
184 | built_with_use --missing false dev-util/subversion nowebdav; then |
| 175 | echo |
185 | echo |
| 176 | eerror "In order to emerge this package, you need to" |
186 | eerror "In order to emerge this package, you need to" |
| 177 | eerror "reinstall Subversion with support for WebDAV." |
187 | eerror "reinstall Subversion with support for WebDAV." |
| 178 | eerror "Subversion requires either Neon or Serf to support WebDAV." |
188 | eerror "Subversion requires either Neon or Serf to support WebDAV." |
| 179 | echo |
189 | echo |
| … | |
… | |
| 215 | debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" |
225 | debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" |
| 216 | debug-print "${FUNCNAME}: options = \"${options}\"" |
226 | debug-print "${FUNCNAME}: options = \"${options}\"" |
| 217 | |
227 | |
| 218 | if [[ ! -d ${wc_path}/.svn ]]; then |
228 | if [[ ! -d ${wc_path}/.svn ]]; then |
| 219 | if [[ -n ${ESVN_OFFLINE} ]]; then |
229 | if [[ -n ${ESVN_OFFLINE} ]]; then |
| 220 | ewarn "ESVN_OFFLINE cannot be used when the there is no existing checkout." |
230 | ewarn "ESVN_OFFLINE cannot be used when there is no existing checkout." |
| 221 | fi |
231 | fi |
| 222 | # first check out |
232 | # first check out |
| 223 | einfo "subversion check out start -->" |
233 | einfo "subversion check out start -->" |
| 224 | einfo " repository: ${repo_uri}${revision:+@}${revision}" |
234 | einfo " repository: ${repo_uri}${revision:+@}${revision}" |
| 225 | |
235 | |
| 226 | debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" |
236 | debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" |
| 227 | |
237 | |
| 228 | mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." |
238 | mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." |
| 229 | cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" |
239 | cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" |
|
|
240 | if [[ -n "${ESVN_USER}" ]]; then |
|
|
241 | ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." |
|
|
242 | else |
| 230 | ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." |
243 | ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." |
|
|
244 | fi |
| 231 | |
245 | |
| 232 | elif [[ -n ${ESVN_OFFLINE} ]]; then |
246 | elif [[ -n ${ESVN_OFFLINE} ]]; then |
| 233 | svn cleanup "${wc_path}" |
247 | svn cleanup "${wc_path}" |
| 234 | subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." |
248 | subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." |
| 235 | if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then |
249 | if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then |
| … | |
… | |
| 258 | einfo " new repository: ${repo_uri}${revision:+@}${revision}" |
272 | einfo " new repository: ${repo_uri}${revision:+@}${revision}" |
| 259 | |
273 | |
| 260 | debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" |
274 | debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" |
| 261 | |
275 | |
| 262 | cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" |
276 | cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" |
|
|
277 | if [[ -n "${ESVN_USER}" ]]; then |
|
|
278 | ${ESVN_SWITCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." |
|
|
279 | else |
| 263 | ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}" |
280 | ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." |
|
|
281 | fi |
| 264 | else |
282 | else |
| 265 | # update working copy |
283 | # update working copy |
| 266 | einfo "subversion update start -->" |
284 | einfo "subversion update start -->" |
| 267 | einfo " repository: ${repo_uri}${revision:+@}${revision}" |
285 | einfo " repository: ${repo_uri}${revision:+@}${revision}" |
| 268 | |
286 | |
| 269 | debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" |
287 | debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" |
| 270 | |
288 | |
| 271 | cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" |
289 | cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" |
|
|
290 | if [[ -n "${ESVN_USER}" ]]; then |
|
|
291 | ${ESVN_UPDATE_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." |
|
|
292 | else |
| 272 | ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." |
293 | ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." |
|
|
294 | fi |
| 273 | fi |
295 | fi |
| 274 | fi |
296 | fi |
| 275 | fi |
297 | fi |
| 276 | |
298 | |
| 277 | einfo " working copy: ${wc_path}" |
299 | einfo " working copy: ${wc_path}" |