summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/subversion.eclass')
-rw-r--r--eclass/subversion.eclass77
1 files changed, 22 insertions, 55 deletions
diff --git a/eclass/subversion.eclass b/eclass/subversion.eclass
index e04181561258..b9a97a015ae7 100644
--- a/eclass/subversion.eclass
+++ b/eclass/subversion.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.42 2007/04/23 18:55:15 cardoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.43 2007/07/01 23:19:42 peper Exp $
## --------------------------------------------------------------------------- #
# Author: Akinori Hattori <hattya@gentoo.org>
@@ -47,7 +47,7 @@ ESVN_UPDATE_CMD="svn update"
#
# the options passed to checkout or update.
#
-: ESVN_OPTIONS=${ESVN_OPTIONS:=}
+: ${ESVN_OPTIONS=}
## -- ESVN_REPO_URI: repository uri
@@ -60,7 +60,7 @@ ESVN_UPDATE_CMD="svn update"
# svn://
# svn+ssh://
#
-: ESVN_REPO_URI=${ESVN_REPO_URI:=}
+: ${ESVN_REPO_URI=}
## -- ESVN_PROJECT: project name of your ebuild (= name space)
@@ -83,28 +83,26 @@ ESVN_UPDATE_CMD="svn update"
#
# default: ${PN/-svn}.
#
-: ESVN_PROJECT=${ESVN_PROJECT:=${PN/-svn}}
+: ${ESVN_PROJECT:=${PN/-svn}}
## -- ESVN_BOOTSTRAP:
#
# bootstrap script or command like autogen.sh or etc..
#
-: ESVN_BOOTSTRAP=${ESVN_BOOTSTRAP:=}
+: ${ESVN_BOOTSTRAP=}
## -- ESVN_PATCHES:
#
# subversion eclass can apply pathces in subversion_bootstrap().
-# you can use regexp in this valiable like *.diff or *.patch or etc.
-# NOTE: this patches will apply before eval ESVN_BOOTSTRAP.
+# you can use regexp in this variable like *.diff or *.patch or etc.
+# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed.
#
-# the process of applying the patch is:
-# 1. just epatch it, if the patch exists in the path.
-# 2. scan it under FILESDIR and epatch it, if the patch exists in FILESDIR.
-# 3. die.
+# Patches are searched both in / and ${FILESDIR}, if not found in both locations,
+# the installation dies.
#
-: ESVN_PATCHES=${ESVN_PATCHES:=}
+: ${ESVN_PATCHES=}
## -- ESVN_RESTRICT:
@@ -114,7 +112,7 @@ ESVN_UPDATE_CMD="svn update"
# export)
# don't export the working copy to S.
#
-: ESVN_RESTRICT=${ESVN_RESTRICT:=}
+: ${ESVN_RESTRICT=}
## -- subversion_fetch() ----------------------------------------------------- #
@@ -123,7 +121,6 @@ ESVN_UPDATE_CMD="svn update"
# @param $2 - a check out path in S.
#
function subversion_fetch() {
-
local repo_uri="$(subversion__get_repository_uri "${1}")"
local S_dest="${2}"
@@ -147,7 +144,6 @@ function subversion_fetch() {
;;
esac
- # every time
addread "/etc/subversion"
addwrite "${ESVN_STORE_DIR}"
@@ -177,8 +173,6 @@ function subversion_fetch() {
${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch from ${repo_uri}."
else
- subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
-
if [ "${ESVN_WC_URL}" != "$(subversion__get_repository_uri "${repo_uri}" 1)" ]; then
die "${ESVN}: ESVN_REPO_URI (or specified URI) and working copy's URL are not matched."
fi
@@ -191,9 +185,10 @@ function subversion_fetch() {
cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}."
-
fi
+ subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
+
einfo " working copy: ${wc_path}"
if ! has "export" ${ESVN_RESTRICT}; then
@@ -208,14 +203,12 @@ function subversion_fetch() {
fi
echo
-
}
## -- subversion_bootstrap() ------------------------------------------------ #
#
function subversion_bootstrap() {
-
if has "export" ${ESVN_RESTRICT}; then
return
fi
@@ -225,29 +218,21 @@ function subversion_bootstrap() {
if [[ -n "${ESVN_PATCHES}" ]]; then
einfo "apply patches -->"
- local p=
-
- for p in ${ESVN_PATCHES}; do
- if [[ -f "${p}" ]]; then
- epatch "${p}"
-
+ local patch fpatch
+ for patch in ${ESVN_PATCHES}; do
+ if [[ -f "${patch}" ]]; then
+ epatch "${patch}"
else
- local q=
-
- for q in ${FILESDIR}/${p}; do
- if [[ -f "${q}" ]]; then
- epatch "${q}"
-
+ for fpatch in ${FILESDIR}/${patch}; do
+ if [[ -f "${fpatch}" ]]; then
+ epatch "${fpatch}"
else
- die "${ESVN}; ${p} is not found"
-
+ die "${ESVN}: ${patch} not found"
fi
done
fi
done
-
echo
-
fi
if [[ -n "${ESVN_BOOTSTRAP}" ]]; then
@@ -256,24 +241,18 @@ function subversion_bootstrap() {
if [[ -f "${ESVN_BOOTSTRAP}" && -x "${ESVN_BOOTSTRAP}" ]]; then
einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}"
eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP."
-
else
- einfo " bootstrap with commands: ${ESVN_BOOTSTRAP}"
+ einfo " bootstrap with command: ${ESVN_BOOTSTRAP}"
eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP."
-
fi
fi
-
}
-
## -- subversion_src_unpack() ------------------------------------------------ #
#
function subversion_src_unpack() {
-
subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
-
}
@@ -282,7 +261,6 @@ function subversion_src_unpack() {
# @param $1 - repository URI. default is ESVN_REPO_URI.
#
function subversion_wc_info() {
-
local repo_uri="$(subversion__get_repository_uri "${1}")"
local wc_path="$(subversion__get_wc_path "${repo_uri}")"
@@ -294,14 +272,11 @@ function subversion_wc_info() {
fi
local k
-
for k in url revision; do
export ESVN_WC_$(subversion__to_upper_case "${k}")="$(subversion__svn_info "${wc_path}" "${k}")"
done
-
}
-
## -- Private Functions
@@ -311,12 +286,10 @@ function subversion_wc_info() {
# @param $2 - a key name.
#
function subversion__svn_info() {
-
local target="${1}"
local key="${2}"
env LC_ALL=C svn info "${target}" | grep -i "^${key}" | cut -d" " -f2-
-
}
@@ -327,7 +300,6 @@ function subversion__svn_info() {
# specified.
#
function subversion__get_repository_uri() {
-
local repo_uri="${1:-${ESVN_REPO_URI}}"
local remove_peg_revision="${2}"
@@ -353,7 +325,6 @@ function subversion__get_repository_uri() {
fi
echo "${repo_uri}"
-
}
@@ -362,13 +333,11 @@ function subversion__get_repository_uri() {
# @param $1 - a repository URI.
#
function subversion__get_wc_path() {
-
local repo_uri="$(subversion__get_repository_uri "${1}" 1)"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}"
-
}
@@ -377,7 +346,6 @@ function subversion__get_wc_path() {
# @param $1 - a repository URI.
#
function subversion__has_peg_revision() {
-
local repo_uri="${1}"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
@@ -408,7 +376,6 @@ function subversion__has_peg_revision() {
debug-print "${FUNCNAME}: peg_rev = ${peg_rev}"
return 0
-
}