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

Diff of /eclass/subversion.eclass

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

Revision 1.52 Revision 1.56
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 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.52 2008/02/20 22:35:40 zlin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.56 2008/02/27 12:54:35 zlin 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>
207 debug-print "${FUNCNAME}: wc_path = \"${wc_path}\"" 207 debug-print "${FUNCNAME}: wc_path = \"${wc_path}\""
208 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" 208 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
209 debug-print "${FUNCNAME}: options = \"${options}\"" 209 debug-print "${FUNCNAME}: options = \"${options}\""
210 210
211 if [[ ! -d ${wc_path}/.svn ]]; then 211 if [[ ! -d ${wc_path}/.svn ]]; then
212 if [[ -n ${ESVN_OFFLINE} ]]; then
213 ewarn "ESVN_OFFLINE cannot be used when the there is no existing checkout."
214 fi
212 # first check out 215 # first check out
213 einfo "subversion check out start -->" 216 einfo "subversion check out start -->"
214 einfo " repository: ${repo_uri}${revision:+@}${revision}" 217 einfo " repository: ${repo_uri}${revision:+@}${revision}"
215 218
216 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" 219 debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
222 elif [[ -n ${ESVN_OFFLINE} ]]; then 225 elif [[ -n ${ESVN_OFFLINE} ]]; then
223 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." 226 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
224 if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then 227 if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then
225 die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally." 228 die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally."
226 fi 229 fi
227 einfo "Fetching disabled: Using existing repository copy" 230 einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}."
228 else 231 else
229 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." 232 subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
230 233
231 local esvn_up_freq= 234 local esvn_up_freq=
232 if [[ -n ${ESVN_UP_FREQ} ]]; then 235 if [[ -n ${ESVN_UP_FREQ} ]]; then
233 if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then 236 if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then
234 die "${ESVN}: ESVN_UP_FREQ must be an integer value corresponding to the minimum number of hours between svn up." 237 die "${ESVN}: ESVN_UP_FREQ must be an integer value corresponding to the minimum number of hours between svn up."
235 elif [[ -z $(find "${wc_path}/.svn/entries" -mmin "+$((ESVN_UP_FREQ*60))") ]]; then 238 elif [[ -z $(find "${wc_path}/.svn/entries" -mmin "+$((ESVN_UP_FREQ*60))") ]]; then
236 einfo "Fetching disabled since ${ESVN_UP_FREQ} hours hasn't passed since last update." 239 einfo "Fetching disabled since ${ESVN_UP_FREQ} hours has not passed since last update."
240 einfo "Using existing repository copy at revision ${ESVN_WC_REVISION}."
237 esvn_up_freq=no_update 241 esvn_up_freq=no_update
238 fi 242 fi
239 fi 243 fi
240 244
241 if [[ -z ${esvn_up_freq} ]]; then 245 if [[ -z ${esvn_up_freq} ]]; then
343# Get svn info for the specified repo_uri. The default repo_uri is ESVN_REPO_URI. 347# Get svn info for the specified repo_uri. The default repo_uri is ESVN_REPO_URI.
344# 348#
345# The working copy information on the specified repository URI are set to 349# The working copy information on the specified repository URI are set to
346# ESVN_WC_* variables. 350# ESVN_WC_* variables.
347subversion_wc_info() { 351subversion_wc_info() {
348 local repo_uri="$(subversion__get_repository_uri "${1}")" 352 local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")"
349 local wc_path="$(subversion__get_wc_path "${repo_uri}")" 353 local wc_path="$(subversion__get_wc_path "${repo_uri}")"
350 354
351 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" 355 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
352 debug-print "${FUNCNAME}: wc_path = ${wc_path}" 356 debug-print "${FUNCNAME}: wc_path = ${wc_path}"
353 357
378 382
379## -- subversion__get_repository_uri() --------------------------------------- # 383## -- subversion__get_repository_uri() --------------------------------------- #
380# 384#
381# param $1 - a repository URI. 385# param $1 - a repository URI.
382subversion__get_repository_uri() { 386subversion__get_repository_uri() {
383 local repo_uri="${1}" 387 local repo_uri="${1}"
384 388
385 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" 389 debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
386 390
387 if [[ -z ${repo_uri} ]]; then 391 if [[ -z ${repo_uri} ]]; then
388 die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." 392 die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty."
429 433
430 echo "${peg_rev}" 434 echo "${peg_rev}"
431} 435}
432 436
433# @FUNCTION: subversion_pkg_preinst 437# @FUNCTION: subversion_pkg_preinst
438# @USAGE: [repo_uri]
434# @DESCRIPTION: 439# @DESCRIPTION:
435# Log the svn revision of source code. Doing this in pkg_preinst because we 440# Log the svn revision of source code. Doing this in pkg_preinst because we
436# want the logs to stick around if packages are uninstalled without messing with 441# want the logs to stick around if packages are uninstalled without messing with
437# config protection. 442# config protection.
438subversion_pkg_preinst() { 443subversion_pkg_preinst() {
439 local pkgdate=$(date "+%Y%m%d %H:%M:%S") 444 local pkgdate=$(date "+%Y%m%d %H:%M:%S")
440 subversion_wc_info 445 subversion_wc_info "${1:-${ESVN_REPO_URI}}"
441 if [[ -n ${ESCM_LOGDIR} ]]; then 446 if [[ -n ${ESCM_LOGDIR} ]]; then
442 local dir="${ROOT}/${ESCM_LOGDIR}/${CATEGORY}" 447 local dir="${ROOT}/${ESCM_LOGDIR}/${CATEGORY}"
443 if [[ ! -d ${dir} ]]; then 448 if [[ ! -d ${dir} ]]; then
444 mkdir -p "${dir}" || \ 449 mkdir -p "${dir}" || \
445 eerror "Failed to create '${dir}' for logging svn revision to '${PORTDIR_SCM}'" 450 eerror "Failed to create '${dir}' for logging svn revision to '${PORTDIR_SCM}'"

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.56

  ViewVC Help
Powered by ViewVC 1.1.20