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

Diff of /eclass/subversion.eclass

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

Revision 1.7 Revision 1.8
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.7 2004/03/01 16:37:31 hattya Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.8 2004/04/05 14:25:28 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
13# If you use this eclass, the ${S} is ${WORKDIR}/${P}. 13# If you use this eclass, the ${S} is ${WORKDIR}/${P}.
14# It is necessary to define the ESVN_REPOURI variable at least. 14# It is necessary to define the ESVN_REPOURI variable at least.
15# 15#
16## --------------------------------------------------------------------------- # 16## --------------------------------------------------------------------------- #
17 17
18inherit eutils
18 19
19ECLASS="subversion" 20ECLASS="subversion"
20INHERITED="${INHERITED} ${ECLASS}" 21INHERITED="${INHERITED} ${ECLASS}"
22ESVN="subversion.eclass"
21 23
22EXPORT_FUNCTIONS src_unpack 24EXPORT_FUNCTIONS src_unpack
23 25
24HOMEPAGE="http://subversion.tigris.org/" 26HOMEPAGE="http://subversion.tigris.org/"
25DESCRIPTION="Based on the ${ECLASS} eclass" 27DESCRIPTION="Based on the ${ECLASS} eclass"
73[ -z "${ESVN_PROJECT}" ] && ESVN_PROJECT="${PN/-svn}" 75[ -z "${ESVN_PROJECT}" ] && ESVN_PROJECT="${PN/-svn}"
74 76
75 77
76## -- ESVN_BOOTSTRAP: 78## -- ESVN_BOOTSTRAP:
77# 79#
78# bootstrap script. like autogen.sh or etc.. 80# bootstrap script or command like autogen.sh or etc..
79# 81#
80[ -z "${ESVN_BOOTSTRAP}" ] && ESVN_BOOTSTRAP="" 82[ -z "${ESVN_BOOTSTRAP}" ] && ESVN_BOOTSTRAP=""
81 83
82 84
85## -- ESVN_PATCHES:
86#
87# subversion eclass can apply pathces in subversion_bootstrap().
88# you can use regexp in this valiable like *.diff or *.patch or etc.
89# NOTE: this patches will apply before eval ESVN_BOOTSTRAP.
90#
91# the process of applying the patch is:
92# 1. just epatch it, if the patch exists in the path.
93# 2. scan it under FILESDIR and epatch it, if the patch exists in FILESDIR.
94# 3. die.
95#
96[ -z "${ESVN_PATCHES}" ] && ESVN_PATCHES=""
97
98
83## -- subversion_svn_fetch() ------------------------------------------------- # 99## -- subversion_svn_fetch() ------------------------------------------------- #
84 100
85subversion_svn_fetch() { 101subversion_svn_fetch() {
86 102
87 # ESVN_REPO_URI is empty. 103 # ESVN_REPO_URI is empty.
88 [ -z "${ESVN_REPO_URI}" ] && die "subversion.eclass: ESVN_REPO_URI is empty." 104 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty."
89 105
90 # http and https only... 106 # http and https only...
91 case ${ESVN_REPO_URI%%:*} in 107 case ${ESVN_REPO_URI%%:*} in
92 http) ;; 108 http) ;;
93 https) ;; 109 https) ;;
94 *) 110 *)
95 die "subversion.eclass: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." 111 die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
96 ;; 112 ;;
97 esac 113 esac
98 114
99 # every time 115 # every time
100 addwrite "${ESVN_STORE_DIR}" 116 addwrite "${ESVN_STORE_DIR}"
101 addwrite "/etc/subversion" 117 addwrite "/etc/subversion"
102 118
103 # -userpriv 119 # -userpriv
104 addwrite "/root/.subversion" 120 ! has userpriv ${FEATURE} && addwrite "/root/.subversion"
105 121
106 if [ ! -d "${ESVN_STORE_DIR}" ]; then 122 if [ ! -d "${ESVN_STORE_DIR}" ]; then
107 mkdir -p "${ESVN_STORE_DIR}" || die "subversion.eclass: can't mkdir ${ESVN_STORE_DIR}." 123 mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}."
108 chmod -f o+rw "${ESVN_STORE_DIR}" || die "subversion.eclass: can't chmod ${ESVN_STORE_DIR}." 124 chmod -f o+rw "${ESVN_STORE_DIR}" || die "${ESVN}: can't chmod ${ESVN_STORE_DIR}."
109 einfo "created store directory: ${ESVN_STORE_DIR}" 125 einfo "created store directory: ${ESVN_STORE_DIR}"
110 einfo 126 einfo
111 fi 127 fi
112 128
113 cd "${ESVN_STORE_DIR}" 129 cd "${ESVN_STORE_DIR}"
121 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}" 137 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}"
122 138
123 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 139 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
124 # first check out 140 # first check out
125 einfo "subversion check out start -->" 141 einfo "subversion check out start -->"
126 einfo
127 einfo "check out from: ${ESVN_REPO_URI}" 142 einfo " checkout from: ${ESVN_REPO_URI}"
128 143
129 mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}." 144 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
130 chmod -f o+rw "${ESVN_PROJECT}" || die "subversion.eclass: can't chmod ${ESVN_PROJECT}." 145 chmod -f o+rw "${ESVN_PROJECT}" || die "${ESVN}: can't chmod ${ESVN_PROJECT}."
131 cd "${ESVN_PROJECT}" 146 cd "${ESVN_PROJECT}"
132 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "subversion.eclass: can't fetch from ${ESVN_REPO_URI}." 147 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "${ESVN}: can't fetch from ${ESVN_REPO_URI}."
133 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 148 einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
134 149
135 else 150 else
136 # update working copy 151 # update working copy
137 einfo "subversion update start -->" 152 einfo "subversion update start -->"
138 einfo
139 einfo " update from: ${ESVN_REPO_URI}" 153 einfo " update from: ${ESVN_REPO_URI}"
140
141 cd "${ESVN_CO_DIR}" 154 cd "${ESVN_CO_DIR}"
155
156 local NOW=$(date +%s) UPDATE=$(date -r .svn/entries +%s) INTERVAL=3600
157 if expr ${NOW} - ${UPDATE} \> ${INTERVAL} >/dev/null; then
142 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}." 158 ${ESVN_UPDATE_CMD} || die "${ESVN}: can't update from ${ESVN_REPO_URI}."
159 else
160 echo "Skip updating..."
161 fi
162
143 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 163 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
144 fi
145 164
146 # permission fix 165 fi
147 chmod -Rf o+rw . 2>/dev/null 166
167 # permission fix for NFS (root_squash) with -userpriv
168 find ! -perm -o+rw -exec chmod o+rw {} \; 2>/dev/null
148 169
149 # copy to the ${WORKDIR} 170 # copy to the ${WORKDIR}
150 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}." 171 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${S}" || die "${ESVN}: can't copy to ${S}."
151 einfo 172 einfo " copied to: ${S}"
173 echo
152 174
153} 175}
154 176
155 177
156## -- subversion_bootstrap() ------------------------------------------------ # 178## -- subversion_bootstrap() ------------------------------------------------ #
157 179
158subversion_bootstrap() { 180subversion_bootstrap() {
159 181
182 cd "${S}"
183
184 if [ "${ESVN_PATCHES}" ]; then
185 einfo "apply paches -->"
186 for PATCH in ${ESVN_PATCHES}; do
187 if [ -f "${PATCH}" ]; then
188 epatch ${PATCH}
189
190 else
191 for fPATCH in ${FILESDIR}/${PATCH}; do
192 if [ -f "${fPATCH}" ]; then
193 epatch ${fPATCH}
194
195 else
196 die "${ESVN}; ${PATCH} is not found"
197
198 fi
199 done
200 fi
201 done
202 echo
203 fi
204
160 if [ -n "${ESVN_BOOTSTRAP}" ]; then 205 if [ "${ESVN_BOOTSTRAP}" ]; then
161 cd "${WORKDIR}/${P}"
162
163 if [ -x "${ESVN_BOOTSTRAP}" ]; then
164 einfo "begin bootstrap -->" 206 einfo "begin bootstrap -->"
165 ./${ESVN_BOOTSTRAP} || die "subversion.eclass: can't bootstrap with ${ESVN_BOOTSTRAP}." 207 if [ -f "${ESVN_BOOTSTRAP}" -a -x "${ESVN_BOOTSTRAP}" ]; then
208 einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}"
209 eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP."
210
211 else
212 einfo " bootstrap with command: ESVN_BOOTSTRAP"
213 eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP."
214
166 fi 215 fi
167
168 fi 216 fi
169 217
170} 218}
171 219
172 220
173## -- subversion_src_unpack() ------------------------------------------------ # 221## -- subversion_src_unpack() ------------------------------------------------ #
174 222
175subversion_src_unpack() { 223subversion_src_unpack() {
176 224
177 subversion_svn_fetch || die "subversion.eclass: unknown problem in subversion_svn_fetch()." 225 subversion_svn_fetch || die "${ESVN}: unknown problem in subversion_svn_fetch()."
178 subversion_bootstrap || die "subversion.eclass: unknown problem in subversion_bootstrap()." 226 subversion_bootstrap || die "${ESVN}: unknown problem in subversion_bootstrap()."
179 227
180} 228}

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20