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

Diff of /eclass/subversion.eclass

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

Revision 1.11 Revision 1.12
1# Copyright 1999-2004 Gentoo Technologies, Inc. 1# Copyright 1999-2004 Gentoo Technologies, Inc.
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.11 2004/06/06 10:03:11 hattya Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.12 2004/06/13 12:58:03 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
51 51
52 52
53## -- ESVN_REPO_URI: repository uri 53## -- ESVN_REPO_URI: repository uri
54# 54#
55# e.g. http://foo/trunk, svn://bar/trunk 55# e.g. http://foo/trunk, svn://bar/trunk
56# but currentry support http and https only. 56#
57# supported protocols:
58# http://
59# https://
60# svn://
57# 61#
58[ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI="" 62[ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI=""
59 63
60 64
61## -- ESVN_PROJECT: project name of your ebuild 65## -- ESVN_PROJECT: project name of your ebuild
101subversion_svn_fetch() { 105subversion_svn_fetch() {
102 106
103 # ESVN_REPO_URI is empty. 107 # ESVN_REPO_URI is empty.
104 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty." 108 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty."
105 109
106 # http and https only... 110 # check for the protocol.
107 case ${ESVN_REPO_URI%%:*} in 111 case ${ESVN_REPO_URI%%:*} in
108 http) ;; 112 http) ;;
109 https) ;; 113 https) ;;
110 svn) ;; 114 svn) ;;
111 *) 115 *)
119 123
120 # -userpriv 124 # -userpriv
121 ! has userpriv ${FEATURE} && addwrite "/root/.subversion" 125 ! has userpriv ${FEATURE} && addwrite "/root/.subversion"
122 126
123 if [ ! -d "${ESVN_STORE_DIR}" ]; then 127 if [ ! -d "${ESVN_STORE_DIR}" ]; then
124 mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." 128 mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}."
125 chmod -f o+rw "${ESVN_STORE_DIR}" || die "${ESVN}: can't chmod ${ESVN_STORE_DIR}." 129 chmod -f o+rw "${ESVN_STORE_DIR}" || die "${ESVN}: can't chmod ${ESVN_STORE_DIR}."
130
126 einfo "created store directory: ${ESVN_STORE_DIR}" 131 einfo "created store directory: ${ESVN_STORE_DIR}"
127 einfo 132 einfo
128 fi 133 fi
129 134
130 cd "${ESVN_STORE_DIR}" 135 cd "${ESVN_STORE_DIR}"
131 136
132 if [ -z ${ESVN_REPO_URI##*/} ]; then 137 if [ -z "${ESVN_REPO_URI##*/}" ]; then
133 ESVN_REPO_FIX="${ESVN_REPO_URI%/}" 138 ESVN_REPO_FIX="${ESVN_REPO_URI%/}"
139
134 else 140 else
135 ESVN_REPO_FIX="${ESVN_REPO_URI}" 141 ESVN_REPO_FIX="${ESVN_REPO_URI}"
142
136 fi 143 fi
137 144
138 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}" 145 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}"
139 146
140 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 147 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
141 # first check out 148 # first check out
142 einfo "subversion check out start -->" 149 einfo "subversion check out start -->"
143 einfo " checkout from: ${ESVN_REPO_URI}" 150 einfo " checkout from: ${ESVN_REPO_URI}"
144 151
145 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 152 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
146 chmod -f o+rw "${ESVN_PROJECT}" || die "${ESVN}: can't chmod ${ESVN_PROJECT}." 153 chmod -f o+rw "${ESVN_PROJECT}" || die "${ESVN}: can't chmod ${ESVN_PROJECT}."
147 cd "${ESVN_PROJECT}" 154 cd "${ESVN_PROJECT}"
148 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "${ESVN}: can't fetch from ${ESVN_REPO_URI}." 155 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "${ESVN}: can't fetch from ${ESVN_REPO_URI}."
156
149 einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 157 einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
150 158
151 else 159 else
152 # update working copy 160 # update working copy
153 einfo "subversion update start -->" 161 einfo "subversion update start -->"
155 cd "${ESVN_CO_DIR}" 163 cd "${ESVN_CO_DIR}"
156 164
157 local NOW=$(date +%s) UPDATE=$(date -r .svn/entries +%s) INTERVAL=3600 165 local NOW=$(date +%s) UPDATE=$(date -r .svn/entries +%s) INTERVAL=3600
158 if expr ${NOW} - ${UPDATE} \> ${INTERVAL} >/dev/null; then 166 if expr ${NOW} - ${UPDATE} \> ${INTERVAL} >/dev/null; then
159 ${ESVN_UPDATE_CMD} || die "${ESVN}: can't update from ${ESVN_REPO_URI}." 167 ${ESVN_UPDATE_CMD} || die "${ESVN}: can't update from ${ESVN_REPO_URI}."
168
160 else 169 else
161 echo "Skip updating..." 170 echo "Skip updating..."
171
162 fi 172 fi
163 173
164 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 174 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
165 175
166 fi 176 fi
182 192
183 cd "${S}" 193 cd "${S}"
184 194
185 if [ "${ESVN_PATCHES}" ]; then 195 if [ "${ESVN_PATCHES}" ]; then
186 einfo "apply paches -->" 196 einfo "apply paches -->"
197
187 for PATCH in ${ESVN_PATCHES}; do 198 for PATCH in ${ESVN_PATCHES}; do
188 if [ -f "${PATCH}" ]; then 199 if [ -f "${PATCH}" ]; then
189 epatch ${PATCH} 200 epatch ${PATCH}
190 201
191 else 202 else
203 echo 214 echo
204 fi 215 fi
205 216
206 if [ "${ESVN_BOOTSTRAP}" ]; then 217 if [ "${ESVN_BOOTSTRAP}" ]; then
207 einfo "begin bootstrap -->" 218 einfo "begin bootstrap -->"
219
208 if [ -f "${ESVN_BOOTSTRAP}" -a -x "${ESVN_BOOTSTRAP}" ]; then 220 if [ -f "${ESVN_BOOTSTRAP}" -a -x "${ESVN_BOOTSTRAP}" ]; then
209 einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" 221 einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}"
210 eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." 222 eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP."
211 223
212 else 224 else

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20