diff options
author | Bo Ørsted Andresen <zlin@gentoo.org> | 2008-02-20 20:36:30 +0000 |
---|---|---|
committer | Bo Ørsted Andresen <zlin@gentoo.org> | 2008-02-20 20:36:30 +0000 |
commit | c943738f93b46096557e6620a49d8145f7a67f95 (patch) | |
tree | 170c4edc4970389a9149bcf0721e2bde2c6aecfd /eclass | |
parent | MythTV 0.21 beta build. Remove previous trunk builds (diff) | |
download | gentoo-2-c943738f93b46096557e6620a49d8145f7a67f95.tar.gz gentoo-2-c943738f93b46096557e6620a49d8145f7a67f95.tar.bz2 gentoo-2-c943738f93b46096557e6620a49d8145f7a67f95.zip |
Add support for ESCM_LOGDIR using pkg_preinst.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/subversion.eclass | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/eclass/subversion.eclass b/eclass/subversion.eclass index 33bd9a7b75aa..abc8a057e6f3 100644 --- a/eclass/subversion.eclass +++ b/eclass/subversion.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.49 2008/02/20 20:32:00 zlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.50 2008/02/20 20:36:30 zlin Exp $ # @ECLASS: subversion.eclass # @MAINTAINER: @@ -20,7 +20,7 @@ inherit eutils ESVN="${ECLASS}" -EXPORT_FUNCTIONS src_unpack +EXPORT_FUNCTIONS src_unpack pkg_preinst DESCRIPTION="Based on the ${ECLASS} eclass" @@ -131,6 +131,14 @@ ESVN_RESTRICT="${ESVN_RESTRICT:-}" # tree by users. ESVN_OFFLINE="${ESVN_OFFLINE:-${ESCM_OFFLINE}}" +# @ECLASS-VARIABLE: ESCM_LOGDIR +# @DESCRIPTION: +# User configuration variable. If set to a path such as e.g. /var/log/scm any +# package inheriting from subversion.eclass will record svn revision to +# ${CATEGORY}/${PN}.log in that path in pkg_preinst. This is not supposed to be +# set by ebuilds/eclasses. It defaults to empty so users need to opt in. +ESCM_LOGDIR="${ESCM_LOGDIR:=}" + # @FUNCTION: subversion_fetch # @USAGE: [repo_uri] [destination] # @DESCRIPTION: @@ -401,3 +409,26 @@ subversion__get_peg_revision() { echo "${peg_rev}" } + +# @FUNCTION: subversion_pkg_preinst +# @DESCRIPTION: +# Log the svn revision of source code. Doing this in pkg_preinst because we +# want the logs to stick around if packages are uninstalled without messing with +# config protection. +subversion_pkg_preinst() { + local pkgdate=$(date "+%Y%m%d %H:%M:%S") + subversion_wc_info + if [[ -n ${ESCM_LOGDIR} ]]; then + local dir="${ROOT}/${ESCM_LOGDIR}/${CATEGORY}" + if [[ ! -d ${dir} ]]; then + mkdir -p "${dir}" || \ + eerror "Failed to create '${dir}' for logging svn revision to '${PORTDIR_SCM}'" + fi + local logmessage="svn: ${pkgdate} - ${PF}:${SLOT} was merged at revision ${ESVN_WC_REVISION}" + if [[ -d ${dir} ]]; then + echo "${logmessage}" >> "${dir}/${PN}.log" + else + eerror "Could not log the message '${logmessage}' to '${dir}/${PN}.log'" + fi + fi +}
\ No newline at end of file |