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

Diff of /eclass/subversion.eclass

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

Revision 1.61 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.61 2009/03/22 01:56:34 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
253 svn cleanup "${wc_path}"
233 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."
234 if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then 255 if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then
235 die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally." 256 die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally."
236 fi 257 fi
237 einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}." 258 einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}."
238 else 259 else
260 svn cleanup "${wc_path}"
239 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." 261 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
240 262
241 local esvn_up_freq= 263 local esvn_up_freq=
242 if [[ -n ${ESVN_UP_FREQ} ]]; then 264 if [[ -n ${ESVN_UP_FREQ} ]]; then
243 if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then 265 if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then
256 einfo " new repository: ${repo_uri}${revision:+@}${revision}" 278 einfo " new repository: ${repo_uri}${revision:+@}${revision}"
257 279
258 debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" 280 debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}"
259 281
260 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
261 ${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
262 else 288 else
263 # update working copy 289 # update working copy
264 einfo "subversion update start -->" 290 einfo "subversion update start -->"
265 einfo " repository: ${repo_uri}${revision:+@}${revision}" 291 einfo " repository: ${repo_uri}${revision:+@}${revision}"
266 292
267 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" 293 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
268 294
269 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
270 ${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
271 fi 301 fi
272 fi 302 fi
273 fi 303 fi
274 304
275 einfo " working copy: ${wc_path}" 305 einfo " working copy: ${wc_path}"
340 fi 370 fi
341} 371}
342 372
343# @FUNCTION: subversion_src_unpack 373# @FUNCTION: subversion_src_unpack
344# @DESCRIPTION: 374# @DESCRIPTION:
345# default src_unpack. fetch and bootstrap. 375# Default src_unpack. Fetch and, in older EAPIs, bootstrap.
346subversion_src_unpack() { 376subversion_src_unpack() {
347 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() {
348 subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." 385 subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
349} 386}
350 387
351# @FUNCTION: subversion_wc_info 388# @FUNCTION: subversion_wc_info
352# @USAGE: [repo_uri] 389# @USAGE: [repo_uri]

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

  ViewVC Help
Powered by ViewVC 1.1.20