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

Diff of /eclass/subversion.eclass

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

Revision 1.49 Revision 1.50
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.49 2008/02/20 20:32:00 zlin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.50 2008/02/20 20:36:30 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>
18 18
19inherit eutils 19inherit eutils
20 20
21ESVN="${ECLASS}" 21ESVN="${ECLASS}"
22 22
23EXPORT_FUNCTIONS src_unpack 23EXPORT_FUNCTIONS src_unpack pkg_preinst
24 24
25DESCRIPTION="Based on the ${ECLASS} eclass" 25DESCRIPTION="Based on the ${ECLASS} eclass"
26 26
27DEPEND="dev-util/subversion 27DEPEND="dev-util/subversion
28 net-misc/rsync" 28 net-misc/rsync"
128# @DESCRIPTION: 128# @DESCRIPTION:
129# Set this variable to a non-empty value to disable the automatic updating of 129# Set this variable to a non-empty value to disable the automatic updating of
130# an svn source tree. This is intended to be set outside the subversion source 130# an svn source tree. This is intended to be set outside the subversion source
131# tree by users. 131# tree by users.
132ESVN_OFFLINE="${ESVN_OFFLINE:-${ESCM_OFFLINE}}" 132ESVN_OFFLINE="${ESVN_OFFLINE:-${ESCM_OFFLINE}}"
133
134# @ECLASS-VARIABLE: ESCM_LOGDIR
135# @DESCRIPTION:
136# User configuration variable. If set to a path such as e.g. /var/log/scm any
137# package inheriting from subversion.eclass will record svn revision to
138# ${CATEGORY}/${PN}.log in that path in pkg_preinst. This is not supposed to be
139# set by ebuilds/eclasses. It defaults to empty so users need to opt in.
140ESCM_LOGDIR="${ESCM_LOGDIR:=}"
133 141
134# @FUNCTION: subversion_fetch 142# @FUNCTION: subversion_fetch
135# @USAGE: [repo_uri] [destination] 143# @USAGE: [repo_uri] [destination]
136# @DESCRIPTION: 144# @DESCRIPTION:
137# Wrapper function to fetch sources from subversion via svn checkout or svn update, 145# Wrapper function to fetch sources from subversion via svn checkout or svn update,
399 407
400 debug-print "${FUNCNAME}: peg_rev = ${peg_rev}" 408 debug-print "${FUNCNAME}: peg_rev = ${peg_rev}"
401 409
402 echo "${peg_rev}" 410 echo "${peg_rev}"
403} 411}
412
413# @FUNCTION: subversion_pkg_preinst
414# @DESCRIPTION:
415# Log the svn revision of source code. Doing this in pkg_preinst because we
416# want the logs to stick around if packages are uninstalled without messing with
417# config protection.
418subversion_pkg_preinst() {
419 local pkgdate=$(date "+%Y%m%d %H:%M:%S")
420 subversion_wc_info
421 if [[ -n ${ESCM_LOGDIR} ]]; then
422 local dir="${ROOT}/${ESCM_LOGDIR}/${CATEGORY}"
423 if [[ ! -d ${dir} ]]; then
424 mkdir -p "${dir}" || \
425 eerror "Failed to create '${dir}' for logging svn revision to '${PORTDIR_SCM}'"
426 fi
427 local logmessage="svn: ${pkgdate} - ${PF}:${SLOT} was merged at revision ${ESVN_WC_REVISION}"
428 if [[ -d ${dir} ]]; then
429 echo "${logmessage}" >> "${dir}/${PN}.log"
430 else
431 eerror "Could not log the message '${logmessage}' to '${dir}/${PN}.log'"
432 fi
433 fi
434}

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.20