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

Diff of /eclass/subversion.eclass

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

Revision 1.37 Revision 1.38
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 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.37 2006/09/06 15:22:34 joker Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.38 2006/09/27 16:20:20 hattya Exp $
4 4
5## --------------------------------------------------------------------------- # 5## --------------------------------------------------------------------------- #
6# Author: Akinori Hattori <hattya@gentoo.org> 6# Author: Akinori Hattori <hattya@gentoo.org>
7# 7#
8# The subversion eclass is written to fetch the software sources from 8# The subversion eclass is written to fetch the software sources from
122function subversion_fetch() { 122function subversion_fetch() {
123 123
124 local repo_uri=${1:-${ESVN_REPO_URI}} 124 local repo_uri=${1:-${ESVN_REPO_URI}}
125 125
126 if [[ -z "${repo_uri}" ]]; then 126 if [[ -z "${repo_uri}" ]]; then
127 die "${ESVN}: ESVN_REPO_URI is empty." 127 die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty."
128 fi 128 fi
129 129
130 # delete trailing slash 130 # delete trailing slash
131 if [[ -z "${repo_uri##*/}" ]]; then 131 if [[ -z "${repo_uri##*/}" ]]; then
132 repo_uri=${repo_uri%/} 132 repo_uri=${repo_uri%/}
150 *) 150 *)
151 die "${ESVN}: fetch from "${protocol}" is not yet implemented." 151 die "${ESVN}: fetch from "${protocol}" is not yet implemented."
152 ;; 152 ;;
153 esac 153 esac
154 154
155 # every time
156 addread "/etc/subversion"
157 addwrite "${ESVN_STORE_DIR}"
158
155 if [[ ! -d "${ESVN_STORE_DIR}" ]]; then 159 if [[ ! -d "${ESVN_STORE_DIR}" ]]; then
156 debug-print "${FUNCNAME}: initial checkout. creating subversion directory" 160 debug-print "${FUNCNAME}: initial checkout. creating subversion directory"
157 161
158 # Fix sandbox violations
159 addwrite ${ESVN_STORE_DIR%/*}
160
161 mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." 162 mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}."
162 fi 163 fi
163 164
164 cd "${ESVN_STORE_DIR}" || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}" 165 cd "${ESVN_STORE_DIR}" || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}"
165 166
166 # every time
167 addread "/etc/subversion"
168
169 ESVN_OPTIONS="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion"
170 167
171 local wc_path=${ESVN_PROJECT}/${repo_uri##*/} 168 local wc_path=${ESVN_PROJECT}/${repo_uri##*/}
169 local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion"
172 170
173 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" 171 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
174 172 debug-print "${FUNCNAME}: options = \"${options}\""
175 # Fix sandbox violations
176 addwrite "${ESVN_STORE_DIR}"
177 173
178 if [[ ! -d "${wc_path}/.svn" ]]; then 174 if [[ ! -d "${wc_path}/.svn" ]]; then
179 # first check out 175 # first check out
180 einfo "subversion check out start -->" 176 einfo "subversion check out start -->"
181 einfo " repository: ${repo_uri}" 177 einfo " repository: ${repo_uri}"
182 178
183 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 179 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
184 cd "${ESVN_PROJECT}" 180 cd "${ESVN_PROJECT}"
185 ${ESVN_FETCH_CMD} ${ESVN_OPTIONS} "${repo_uri}" || die "${ESVN}: can't fetch from ${repo_uri}." 181 ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch from ${repo_uri}."
186 182
187 else 183 else
188 subversion_wc_info || die "${ESVN}: unknown problem occurred while accessing working copy." 184 subversion_wc_info || die "${ESVN}: unknown problem occurred while accessing working copy."
189 185
190 if [[ "${ESVN_WC_URL}" != "${ESVN_REPO_URI}" ]]; then 186 if [[ "${ESVN_WC_URL}" != "${repo_uri}" ]]; then
191 die "${ESVN}: ESVN_REPO_URI and working copy's URL are not matched." 187 die "${ESVN}: ESVN_REPO_URI (or specified URI) and working copy's URL are not matched."
192 fi 188 fi
193 189
194 # update working copy 190 # update working copy
195 einfo "subversion update start -->" 191 einfo "subversion update start -->"
196 einfo " repository: ${repo_uri}" 192 einfo " repository: ${repo_uri}"
197 193
198 cd "${wc_path}" 194 cd "${wc_path}"
199 ${ESVN_UPDATE_CMD} ${ESVN_OPTIONS} || die "${ESVN}: can't update from ${repo_uri}." 195 ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}."
200 196
201 fi 197 fi
202 198
203 einfo " working copy: ${ESVN_STORE_DIR}/${wc_path}" 199 einfo " working copy: ${ESVN_STORE_DIR}/${wc_path}"
204 200
299 fi 295 fi
300 296
301 local k= 297 local k=
302 298
303 for k in url revision; do 299 for k in url revision; do
304 export ESVN_WC_$(echo "${k}" | tr [a-z] [A-Z])=$(env LANG=C svn info "${wc_path}" | grep -i "^${k}" | cut -d" " -f2) 300 export ESVN_WC_$(echo "${k}" | tr [a-z] [A-Z])=$(env LC_ALL=C svn info "${wc_path}" | grep -i "^${k}" | cut -d" " -f2)
305 done 301 done
306 302
307} 303}

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.20