aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/subversion.eclass82
1 files changed, 69 insertions, 13 deletions
diff --git a/eclass/subversion.eclass b/eclass/subversion.eclass
index 2c3f0c8..a65cb86 100644
--- a/eclass/subversion.eclass
+++ b/eclass/subversion.eclass
@@ -1,11 +1,12 @@
-# Copyright 1999-2008 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.60 2008/05/27 09:49:09 zlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.68 2010/06/22 18:34:29 arfrever Exp $
# @ECLASS: subversion.eclass
# @MAINTAINER:
# Akinori Hattori <hattya@gentoo.org>
# Bo Ørsted Andresen <zlin@gentoo.org>
+# Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
#
# Original Author: Akinori Hattori <hattya@gentoo.org>
#
@@ -18,13 +19,24 @@ inherit eutils
ESVN="${ECLASS}"
-EXPORT_FUNCTIONS src_unpack pkg_preinst
+case "${EAPI:-0}" in
+ 0|1)
+ EXPORT_FUNCTIONS src_unpack pkg_preinst
+ ;;
+ *)
+ EXPORT_FUNCTIONS src_unpack src_prepare pkg_preinst
+ ;;
+esac
DESCRIPTION="Based on the ${ECLASS} eclass"
-DEPEND="dev-util/subversion
+SUBVERSION_DEPEND="dev-vcs/subversion
net-misc/rsync"
+if [[ -z "${ESVN_DISABLE_DEPENDENCIES}" ]]; then
+ DEPEND="${SUBVERSION_DEPEND}"
+fi
+
# @ECLASS-VARIABLE: ESVN_STORE_DIR
# @DESCRIPTION:
# subversion sources store directory. Users may override this in /etc/make.conf
@@ -76,6 +88,16 @@ ESVN_REPO_URI="${ESVN_REPO_URI:-}"
# Note: This should never be set in an ebuild!
ESVN_REVISION="${ESVN_REVISION:-}"
+# @ECLASS-VARIABLE: ESVN_USER
+# @DESCRIPTION:
+# User name
+ESVN_USER="${ESVN_USER:-}"
+
+# @ECLASS-VARIABLE: ESVN_PASSWORD
+# @DESCRIPTION:
+# Password
+ESVN_PASSWORD="${ESVN_PASSWORD:-}"
+
# @ECLASS-VARIABLE: ESVN_PROJECT
# @DESCRIPTION:
# project name of your ebuild (= name space)
@@ -122,6 +144,12 @@ ESVN_PATCHES="${ESVN_PATCHES:-}"
# don't export the working copy to S.
ESVN_RESTRICT="${ESVN_RESTRICT:-}"
+# @ECLASS-VARIABLE: ESVN_DISABLE_DEPENDENCIES
+# @DESCRIPTION:
+# Set this variable to a non-empty value to disable the automatic inclusion of
+# Subversion in dependencies.
+ESVN_DISABLE_DEPENDENCIES="${ESVN_DISABLE_DEPENDENCIES:-}"
+
# @ECLASS-VARIABLE: ESVN_OFFLINE
# @DESCRIPTION:
# Set this variable to a non-empty value to disable the automatic updating of
@@ -171,8 +199,7 @@ subversion_fetch() {
http|https)
# We don't need this check for cross-compilation
if [ CHOST = CBUILD ]; then
- if ! built_with_use --missing true -o dev-util/subversion webdav-neon webdav-serf || \
- built_with_use --missing false dev-util/subversion nowebdav ; then
+ if ! built_with_use -o dev-vcs/subversion webdav-neon webdav-serf; then
echo
eerror "In order to emerge this package, you need to"
eerror "reinstall Subversion with support for WebDAV."
@@ -209,31 +236,43 @@ subversion_fetch() {
ewarn "see \${ESVN_REPO_URI}"
fi
+ if has_version ">=dev-vcs/subversion-1.6.0"; then
+ options="${options} --config-option=config:auth:password-stores="
+ fi
+
debug-print "${FUNCNAME}: wc_path = \"${wc_path}\""
debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
debug-print "${FUNCNAME}: options = \"${options}\""
if [[ ! -d ${wc_path}/.svn ]]; then
if [[ -n ${ESVN_OFFLINE} ]]; then
- ewarn "ESVN_OFFLINE cannot be used when the there is no existing checkout."
+ ewarn "ESVN_OFFLINE cannot be used when there is no existing checkout."
fi
# first check out
einfo "subversion check out start -->"
einfo " repository: ${repo_uri}${revision:+@}${revision}"
-
- debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}${revision:+@}${revision}"
+
+ debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}"
- ${ESVN_FETCH_CMD} ${options} "${repo_uri}${revision:+@}${revision}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}."
+ if [[ -n "${ESVN_USER}" ]]; then
+ ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}."
+ else
+ ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}."
+ fi
elif [[ -n ${ESVN_OFFLINE} ]]; then
+ svn upgrade "${wc_path}" &>/dev/null
+ svn cleanup "${wc_path}" &>/dev/null
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then
die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally."
fi
einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}."
else
+ svn upgrade "${wc_path}" &>/dev/null
+ svn cleanup "${wc_path}" &>/dev/null
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
local esvn_up_freq=
@@ -256,7 +295,11 @@ subversion_fetch() {
debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}"
cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
- ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}"
+ if [[ -n "${ESVN_USER}" ]]; then
+ ${ESVN_SWITCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
+ else
+ ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
+ fi
else
# update working copy
einfo "subversion update start -->"
@@ -265,7 +308,11 @@ subversion_fetch() {
debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
- ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
+ if [[ -n "${ESVN_USER}" ]]; then
+ ${ESVN_UPDATE_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
+ else
+ ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}."
+ fi
fi
fi
fi
@@ -340,9 +387,18 @@ subversion_bootstrap() {
# @FUNCTION: subversion_src_unpack
# @DESCRIPTION:
-# default src_unpack. fetch and bootstrap.
+# Default src_unpack. Fetch and, in older EAPIs, bootstrap.
subversion_src_unpack() {
subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
+ if has "${EAPI:-0}" 0 1; then
+ subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
+ fi
+}
+
+# @FUNCTION: subversion_src_prepare
+# @DESCRIPTION:
+# Default src_prepare. Bootstrap.
+subversion_src_prepare() {
subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
}