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

Diff of /eclass/subversion.eclass

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

Revision 1.59 Revision 1.66
1# Copyright 1999-2008 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.59 2008/05/15 13:27:40 zlin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.66 2009/04/29 22:47:08 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>
9# Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
9# 10#
10# Original Author: Akinori Hattori <hattya@gentoo.org> 11# Original Author: Akinori Hattori <hattya@gentoo.org>
11# 12#
12# @BLURB: The subversion eclass is written to fetch software sources from subversion repositories 13# @BLURB: The subversion eclass is written to fetch software sources from subversion repositories
13# @DESCRIPTION: 14# @DESCRIPTION:
16 17
17inherit eutils 18inherit eutils
18 19
19ESVN="${ECLASS}" 20ESVN="${ECLASS}"
20 21
21EXPORT_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}
22 29
23DESCRIPTION="Based on the ${ECLASS} eclass" 30DESCRIPTION="Based on the ${ECLASS} eclass"
24 31
25DEPEND="dev-util/subversion 32DEPEND="dev-util/subversion
26 net-misc/rsync" 33 net-misc/rsync"
73# 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
74# to a specific revision 81# to a specific revision
75# 82#
76# Note: This should never be set in an ebuild! 83# Note: This should never be set in an ebuild!
77ESVN_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:-}"
78 95
79# @ECLASS-VARIABLE: ESVN_PROJECT 96# @ECLASS-VARIABLE: ESVN_PROJECT
80# @DESCRIPTION: 97# @DESCRIPTION:
81# project name of your ebuild (= name space) 98# project name of your ebuild (= name space)
82# 99#
168 local protocol="${repo_uri%%:*}" 185 local protocol="${repo_uri%%:*}"
169 186
170 case "${protocol}" in 187 case "${protocol}" in
171 http|https) 188 http|https)
172 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 || \
173 built_with_use --missing false dev-util/subversion nowebdav ; then 190 built_with_use --missing false dev-util/subversion nowebdav; then
174 echo 191 echo
175 eerror "In order to emerge this package, you need to" 192 eerror "In order to emerge this package, you need to"
176 eerror "reinstall Subversion with support for WebDAV." 193 eerror "reinstall Subversion with support for WebDAV."
177 eerror "Subversion requires either Neon or Serf to support WebDAV." 194 eerror "Subversion requires either Neon or Serf to support WebDAV."
178 echo 195 echo
204 if [[ "${ESVN_OPTIONS}" = *-r* ]]; then 221 if [[ "${ESVN_OPTIONS}" = *-r* ]]; then
205 ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please" 222 ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please"
206 ewarn "see \${ESVN_REPO_URI}" 223 ewarn "see \${ESVN_REPO_URI}"
207 fi 224 fi
208 225
226 if has_version ">=dev-util/subversion-1.6.0"; then
227 options="${options} --config-option=config:auth:password-stores="
228 fi
229
209 debug-print "${FUNCNAME}: wc_path = \"${wc_path}\"" 230 debug-print "${FUNCNAME}: wc_path = \"${wc_path}\""
210 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" 231 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
211 debug-print "${FUNCNAME}: options = \"${options}\"" 232 debug-print "${FUNCNAME}: options = \"${options}\""
212 233
213 if [[ ! -d ${wc_path}/.svn ]]; then 234 if [[ ! -d ${wc_path}/.svn ]]; then
214 if [[ -n ${ESVN_OFFLINE} ]]; then 235 if [[ -n ${ESVN_OFFLINE} ]]; then
215 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."
216 fi 237 fi
217 # first check out 238 # first check out
218 einfo "subversion check out start -->" 239 einfo "subversion check out start -->"
219 einfo " repository: ${repo_uri}${revision:+@}${revision}" 240 einfo " repository: ${repo_uri}${revision:+@}${revision}"
220 241
221 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" 242 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
222 243
223 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 244 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
224 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
225 ${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
226 251
227 elif [[ -n ${ESVN_OFFLINE} ]]; then 252 elif [[ -n ${ESVN_OFFLINE} ]]; then
253 svn cleanup "${wc_path}"
228 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."
229 if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then 255 if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then
230 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."
231 fi 257 fi
232 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}."
233 else 259 else
260 svn cleanup "${wc_path}"
234 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."
235 262
236 local esvn_up_freq= 263 local esvn_up_freq=
237 if [[ -n ${ESVN_UP_FREQ} ]]; then 264 if [[ -n ${ESVN_UP_FREQ} ]]; then
238 if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then 265 if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then
251 einfo " new repository: ${repo_uri}${revision:+@}${revision}" 278 einfo " new repository: ${repo_uri}${revision:+@}${revision}"
252 279
253 debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" 280 debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}"
254 281
255 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
256 ${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
257 else 288 else
258 # update working copy 289 # update working copy
259 einfo "subversion update start -->" 290 einfo "subversion update start -->"
260 einfo " repository: ${repo_uri}${revision:+@}${revision}" 291 einfo " repository: ${repo_uri}${revision:+@}${revision}"
261 292
262 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" 293 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
263 294
264 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
265 ${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
266 fi 301 fi
267 fi 302 fi
268 fi 303 fi
269 304
270 einfo " working copy: ${wc_path}" 305 einfo " working copy: ${wc_path}"
271 306
272 if ! has "export" ${ESVN_RESTRICT}; then 307 if ! has "export" ${ESVN_RESTRICT}; then
273 cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" 308 cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
274 309
275 local S="${S}/${S_dest}" 310 local S="${S}/${S_dest}"
311 mkdir -p "${S}"
276 312
277 # export to the ${WORKDIR} 313 # export to the ${WORKDIR}
278 #* "svn export" has a bug. see http://bugs.gentoo.org/119236 314 #* "svn export" has a bug. see http://bugs.gentoo.org/119236
279 #* svn export . "${S}" || die "${ESVN}: can't export to ${S}." 315 #* svn export . "${S}" || die "${ESVN}: can't export to ${S}."
280 rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}." 316 rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}."
334 fi 370 fi
335} 371}
336 372
337# @FUNCTION: subversion_src_unpack 373# @FUNCTION: subversion_src_unpack
338# @DESCRIPTION: 374# @DESCRIPTION:
339# default src_unpack. fetch and bootstrap. 375# Default src_unpack. Fetch and, in older EAPIs, bootstrap.
340subversion_src_unpack() { 376subversion_src_unpack() {
341 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} || subversion_src_prepare
379}
380
381# @FUNCTION: subversion_src_prepare
382# @DESCRIPTION:
383# Default src_prepare. Bootstrap.
384subversion_src_prepare() {
342 subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." 385 subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
343} 386}
344 387
345# @FUNCTION: subversion_wc_info 388# @FUNCTION: subversion_wc_info
346# @USAGE: [repo_uri] 389# @USAGE: [repo_uri]

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.66

  ViewVC Help
Powered by ViewVC 1.1.20