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

Diff of /eclass/subversion.eclass

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

Revision 1.60 Revision 1.63
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.60 2008/05/27 09:49:09 zlin 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>
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:
73# 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
74# to a specific revision 75# to a specific revision
75# 76#
76# Note: This should never be set in an ebuild! 77# Note: This should never be set in an ebuild!
77ESVN_REVISION="${ESVN_REVISION:-}" 78ESVN_REVISION="${ESVN_REVISION:-}"
79
80# @ECLASS-VARIABLE: ESVN_USER
81# @DESCRIPTION:
82# User name
83ESVN_USER="${ESVN_USER:-}"
84
85# @ECLASS-VARIABLE: ESVN_PASSWORD
86# @DESCRIPTION:
87# Password
88ESVN_PASSWORD="${ESVN_PASSWORD:-}"
78 89
79# @ECLASS-VARIABLE: ESVN_PROJECT 90# @ECLASS-VARIABLE: ESVN_PROJECT
80# @DESCRIPTION: 91# @DESCRIPTION:
81# project name of your ebuild (= name space) 92# project name of your ebuild (= name space)
82# 93#
168 local protocol="${repo_uri%%:*}" 179 local protocol="${repo_uri%%:*}"
169 180
170 case "${protocol}" in 181 case "${protocol}" in
171 http|https) 182 http|https)
172 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 || \
173 built_with_use --missing false dev-util/subversion nowebdav ; then 184 built_with_use --missing false dev-util/subversion nowebdav; then
174 echo 185 echo
175 eerror "In order to emerge this package, you need to" 186 eerror "In order to emerge this package, you need to"
176 eerror "reinstall Subversion with support for WebDAV." 187 eerror "reinstall Subversion with support for WebDAV."
177 eerror "Subversion requires either Neon or Serf to support WebDAV." 188 eerror "Subversion requires either Neon or Serf to support WebDAV."
178 echo 189 echo
204 if [[ "${ESVN_OPTIONS}" = *-r* ]]; then 215 if [[ "${ESVN_OPTIONS}" = *-r* ]]; then
205 ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please" 216 ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please"
206 ewarn "see \${ESVN_REPO_URI}" 217 ewarn "see \${ESVN_REPO_URI}"
207 fi 218 fi
208 219
220 if has_version ">=dev-util/subversion-1.6.0"; then
221 options="${options} --config-option=config:auth:password-stores="
222 fi
223
209 debug-print "${FUNCNAME}: wc_path = \"${wc_path}\"" 224 debug-print "${FUNCNAME}: wc_path = \"${wc_path}\""
210 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" 225 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
211 debug-print "${FUNCNAME}: options = \"${options}\"" 226 debug-print "${FUNCNAME}: options = \"${options}\""
212 227
213 if [[ ! -d ${wc_path}/.svn ]]; then 228 if [[ ! -d ${wc_path}/.svn ]]; then
214 if [[ -n ${ESVN_OFFLINE} ]]; then 229 if [[ -n ${ESVN_OFFLINE} ]]; then
215 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."
216 fi 231 fi
217 # first check out 232 # first check out
218 einfo "subversion check out start -->" 233 einfo "subversion check out start -->"
219 einfo " repository: ${repo_uri}${revision:+@}${revision}" 234 einfo " repository: ${repo_uri}${revision:+@}${revision}"
220 235
221 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" 236 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
222 237
223 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 238 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
224 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
225 ${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
226 245
227 elif [[ -n ${ESVN_OFFLINE} ]]; then 246 elif [[ -n ${ESVN_OFFLINE} ]]; then
247 svn cleanup "${wc_path}"
228 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."
229 if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then 249 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." 250 die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally."
231 fi 251 fi
232 einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}." 252 einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}."
233 else 253 else
254 svn cleanup "${wc_path}"
234 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." 255 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
235 256
236 local esvn_up_freq= 257 local esvn_up_freq=
237 if [[ -n ${ESVN_UP_FREQ} ]]; then 258 if [[ -n ${ESVN_UP_FREQ} ]]; then
238 if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then 259 if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then
251 einfo " new repository: ${repo_uri}${revision:+@}${revision}" 272 einfo " new repository: ${repo_uri}${revision:+@}${revision}"
252 273
253 debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" 274 debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}"
254 275
255 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
256 ${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
257 else 282 else
258 # update working copy 283 # update working copy
259 einfo "subversion update start -->" 284 einfo "subversion update start -->"
260 einfo " repository: ${repo_uri}${revision:+@}${revision}" 285 einfo " repository: ${repo_uri}${revision:+@}${revision}"
261 286
262 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" 287 debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
263 288
264 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
265 ${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
266 fi 295 fi
267 fi 296 fi
268 fi 297 fi
269 298
270 einfo " working copy: ${wc_path}" 299 einfo " working copy: ${wc_path}"

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.63

  ViewVC Help
Powered by ViewVC 1.1.20