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

Diff of /eclass/subversion.eclass

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

Revision 1.62 Revision 1.65
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.65 2009/04/29 22:26:31 scarabeus 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>
17 17
18inherit eutils 18inherit eutils
19 19
20ESVN="${ECLASS}" 20ESVN="${ECLASS}"
21 21
22EXPORT_FUNCTIONS src_unpack pkg_preinst 22EXPORTED_FUNCTIONS="src_unpack pkg_preinst"
23case "${EAPI:-0}" in
24 2) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare" ;;
25 1|0) ;;
26 *) die "Unknown EAPI, Bug eclass maintainers." ;;
27esac
28EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
23 29
24DESCRIPTION="Based on the ${ECLASS} eclass" 30DESCRIPTION="Based on the ${ECLASS} eclass"
25 31
26DEPEND="dev-util/subversion 32DEPEND="dev-util/subversion
27 net-misc/rsync" 33 net-misc/rsync"
74# Useful for live svn or trunk svn ebuilds allowing the user to peg 80# Useful for live svn or trunk svn ebuilds allowing the user to peg
75# to a specific revision 81# to a specific revision
76# 82#
77# Note: This should never be set in an ebuild! 83# Note: This should never be set in an ebuild!
78ESVN_REVISION="${ESVN_REVISION:-}" 84ESVN_REVISION="${ESVN_REVISION:-}"
85
86# @ECLASS-VARIABLE: ESVN_USER
87# @DESCRIPTION:
88# User name
89ESVN_USER="${ESVN_USER:-}"
90
91# @ECLASS-VARIABLE: ESVN_PASSWORD
92# @DESCRIPTION:
93# Password
94ESVN_PASSWORD="${ESVN_PASSWORD:-}"
79 95
80# @ECLASS-VARIABLE: ESVN_PROJECT 96# @ECLASS-VARIABLE: ESVN_PROJECT
81# @DESCRIPTION: 97# @DESCRIPTION:
82# project name of your ebuild (= name space) 98# project name of your ebuild (= name space)
83# 99#
169 local protocol="${repo_uri%%:*}" 185 local protocol="${repo_uri%%:*}"
170 186
171 case "${protocol}" in 187 case "${protocol}" in
172 http|https) 188 http|https)
173 if ! built_with_use --missing true -o dev-util/subversion webdav-neon webdav-serf || \ 189 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 190 built_with_use --missing false dev-util/subversion nowebdav; then
175 echo 191 echo
176 eerror "In order to emerge this package, you need to" 192 eerror "In order to emerge this package, you need to"
177 eerror "reinstall Subversion with support for WebDAV." 193 eerror "reinstall Subversion with support for WebDAV."
178 eerror "Subversion requires either Neon or Serf to support WebDAV." 194 eerror "Subversion requires either Neon or Serf to support WebDAV."
179 echo 195 echo
215 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" 231 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
216 debug-print "${FUNCNAME}: options = \"${options}\"" 232 debug-print "${FUNCNAME}: options = \"${options}\""
217 233
218 if [[ ! -d ${wc_path}/.svn ]]; then 234 if [[ ! -d ${wc_path}/.svn ]]; then
219 if [[ -n ${ESVN_OFFLINE} ]]; then 235 if [[ -n ${ESVN_OFFLINE} ]]; then
220 ewarn "ESVN_OFFLINE cannot be used when the there is no existing checkout." 236 ewarn "ESVN_OFFLINE cannot be used when there is no existing checkout."
221 fi 237 fi
222 # first check out 238 # first check out
223 einfo "subversion check out start -->" 239 einfo "subversion check out start -->"
224 einfo " repository: ${repo_uri}${revision:+@}${revision}" 240 einfo " repository: ${repo_uri}${revision:+@}${revision}"
225 241
226 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" 242 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
227 243
228 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 244 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
229 cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" 245 cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}"
246 if [[ -n "${ESVN_USER}" ]]; then
247 ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}."
248 else
230 ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." 249 ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}."
250 fi
231 251
232 elif [[ -n ${ESVN_OFFLINE} ]]; then 252 elif [[ -n ${ESVN_OFFLINE} ]]; then
233 svn cleanup "${wc_path}" 253 svn cleanup "${wc_path}"
234 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." 254 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 255 if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then
258 einfo " new repository: ${repo_uri}${revision:+@}${revision}" 278 einfo " new repository: ${repo_uri}${revision:+@}${revision}"
259 279
260 debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" 280 debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}"
261 281
262 cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" 282 cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
283 if [[ -n "${ESVN_USER}" ]]; then
284 ${ESVN_SWITCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
285 else
263 ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}" 286 ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
287 fi
264 else 288 else
265 # update working copy 289 # update working copy
266 einfo "subversion update start -->" 290 einfo "subversion update start -->"
267 einfo " repository: ${repo_uri}${revision:+@}${revision}" 291 einfo " repository: ${repo_uri}${revision:+@}${revision}"
268 292
269 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" 293 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
270 294
271 cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" 295 cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
296 if [[ -n "${ESVN_USER}" ]]; then
297 ${ESVN_UPDATE_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
298 else
272 ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." 299 ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
300 fi
273 fi 301 fi
274 fi 302 fi
275 fi 303 fi
276 304
277 einfo " working copy: ${wc_path}" 305 einfo " working copy: ${wc_path}"
342 fi 370 fi
343} 371}
344 372
345# @FUNCTION: subversion_src_unpack 373# @FUNCTION: subversion_src_unpack
346# @DESCRIPTION: 374# @DESCRIPTION:
347# default src_unpack. fetch and bootstrap. 375# Default src_unpack. Fetch and, in older EAPIs, bootstrap.
348subversion_src_unpack() { 376subversion_src_unpack() {
349 subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch." 377 subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
378 has src_prepare ${EXPORTED_FUNCTIONS} || git_src_prepare
379}
380
381# @FUNCTION: subversion_src_prepare
382# @DESCRIPTION:
383# Default src_prepare. Bootstrap.
384subversion_src_prepare() {
350 subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." 385 subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
351} 386}
352 387
353# @FUNCTION: subversion_wc_info 388# @FUNCTION: subversion_wc_info
354# @USAGE: [repo_uri] 389# @USAGE: [repo_uri]

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.65

  ViewVC Help
Powered by ViewVC 1.1.20