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

Diff of /eclass/subversion.eclass

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

Revision 1.24 Revision 1.25
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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.24 2005/09/21 23:32:21 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.25 2005/12/24 14:18:18 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
35ESVN_STORE_DIR="${DISTDIR}/svn-src" 35ESVN_STORE_DIR="${DISTDIR}/svn-src"
36 36
37 37
38## -- ESVN_FETCH_CMD: subversion fetch command 38## -- ESVN_FETCH_CMD: subversion fetch command
39# 39#
40# default: svn checkout 40ESVN_FETCH_CMD="svn checkout"
41#
42[ -z "${ESVN_FETCH_CMD}" ] && ESVN_FETCH_CMD="svn checkout"
43 41
44## -- ESVN_UPDATE_CMD: subversion update command 42## -- ESVN_UPDATE_CMD: subversion update command
45# 43#
46# default: svn update 44ESVN_UPDATE_CMD="svn update"
45
46
47## -- ESVN_OPTIONS:
47# 48#
48[ -z "${ESVN_UPDATE_CMD}" ] && ESVN_UPDATE_CMD="svn update" 49# the options passed to checkout or update.
50#
51[ -z "${ESVN_OPTIONS}" ] && ESVN_OPTIONS=
49 52
50 53
51## -- ESVN_REPO_URI: repository uri 54## -- ESVN_REPO_URI: repository uri
52# 55#
53# e.g. http://foo/trunk, svn://bar/trunk 56# e.g. http://foo/trunk, svn://bar/trunk
100 103
101## -- subversion_svn_fetch() ------------------------------------------------- # 104## -- subversion_svn_fetch() ------------------------------------------------- #
102 105
103function subversion_svn_fetch() { 106function subversion_svn_fetch() {
104 107
108 local ESVN_CO_DIR
109
105 # ESVN_REPO_URI is empty. 110 # ESVN_REPO_URI is empty.
106 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty." 111 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty."
107 112
108 # check for the protocol. 113 # check for the protocol.
109 case ${ESVN_REPO_URI%%:*} in 114 case ${ESVN_REPO_URI%%:*} in
110 http|https) 115 http|https)
111 if built_with_use dev-util/subversion nowebdav ; then 116 if built_with_use dev-util/subversion nowebdav; then
112 eerror "In order to emerge this package, you need to" 117 eerror "In order to emerge this package, you need to"
113 eerror "re-emerge subversion with USE=-nowebdav" 118 eerror "re-emerge subversion with USE=-nowebdav"
114 die "Please run 'USE=-nowebdav emerge subversion'" 119 die "Please run 'USE=-nowebdav emerge subversion'"
115 fi 120 fi
116 ;; 121 ;;
117 svn) ;; 122 svn) ;;
118 *) 123 *)
119 die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." 124 die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
120 ;; 125 ;;
121 esac 126 esac
122 127
134 139
135 # every time 140 # every time
136 addwrite "/etc/subversion" 141 addwrite "/etc/subversion"
137 addwrite "${ESVN_STORE_DIR}" 142 addwrite "${ESVN_STORE_DIR}"
138 143
144 if ! has userpriv ${FEATURES}; then
139 # -userpriv 145 # -userpriv
140 ! has userpriv ${FEATURE} && addwrite "/root/.subversion" 146 addwrite "/root/.subversion"
147
148 else
149 # +userpriv
150 ESVN_OPTIONS="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion"
151
152 fi
141 153
142 [ -z "${ESVN_REPO_URI##*/}" ] && ESVN_REPO_URI="${ESVN_REPO_URI%/}" 154 [ -z "${ESVN_REPO_URI##*/}" ] && ESVN_REPO_URI="${ESVN_REPO_URI%/}"
143 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}" 155 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}"
156
157 debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
144 158
145 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 159 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
146 # first check out 160 # first check out
147 einfo "subversion check out start -->" 161 einfo "subversion check out start -->"
148 einfo " checkout from: ${ESVN_REPO_URI}" 162 einfo " checkout from: ${ESVN_REPO_URI}"
149 163
150 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 164 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
151 chmod -f o+rw "${ESVN_PROJECT}" || die "${ESVN}: can't chmod ${ESVN_PROJECT}." 165 chmod -f o+rw "${ESVN_PROJECT}" || die "${ESVN}: can't chmod ${ESVN_PROJECT}."
152 cd "${ESVN_PROJECT}" 166 cd "${ESVN_PROJECT}"
153 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "${ESVN}: can't fetch from ${ESVN_REPO_URI}." 167 ${ESVN_FETCH_CMD} ${ESVN_OPTIONS} "${ESVN_REPO_URI}" || die "${ESVN}: can't fetch from ${ESVN_REPO_URI}."
154 168
155 einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 169 einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
156 170
157 else 171 else
158 # update working copy 172 # update working copy
159 einfo "subversion update start -->" 173 einfo "subversion update start -->"
160 einfo " update from: ${ESVN_REPO_URI}" 174 einfo " update from: ${ESVN_REPO_URI}"
175
161 cd "${ESVN_CO_DIR}" 176 cd "${ESVN_CO_DIR}"
162
163 local NOW=$(date +%s) UPDATE=$(date -r .svn/entries +%s) INTERVAL=3600
164 if (( ${NOW} - ${UPDATE} > ${INTERVAL} )); then
165 ${ESVN_UPDATE_CMD} || die "${ESVN}: can't update from ${ESVN_REPO_URI}." 177 ${ESVN_UPDATE_CMD} ${ESVN_OPTIONS} || die "${ESVN}: can't update from ${ESVN_REPO_URI}."
166
167 else
168 echo "Skip updating..."
169
170 fi
171 178
172 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 179 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
173 180
174 fi 181 fi
175 182
176 # copy to the ${WORKDIR} 183 # export to the ${WORKDIR}
177 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${S}" || die "${ESVN}: can't copy to ${S}." 184 svn export "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${S}" || die "${ESVN}: can't exportto ${S}."
178 einfo " copied to: ${S}" 185 einfo " exported to: ${S}"
179 echo 186 echo
180 187
181} 188}
182 189
183 190
230 237
231## -- subversion_src_unpack() ------------------------------------------------ # 238## -- subversion_src_unpack() ------------------------------------------------ #
232 239
233function subversion_src_unpack() { 240function subversion_src_unpack() {
234 241
235 if [[ -n ${A} ]] ; then 242 if [ -n "${A}" ]; then
236 unpack ${A} 243 unpack ${A}
237 fi 244 fi
238 245
239 subversion_svn_fetch || die "${ESVN}: unknown problem in subversion_svn_fetch()." 246 subversion_svn_fetch || die "${ESVN}: unknown problem in subversion_svn_fetch()."
240 subversion_bootstrap || die "${ESVN}: unknown problem in subversion_bootstrap()." 247 subversion_bootstrap || die "${ESVN}: unknown problem in subversion_bootstrap()."

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.20