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

Diff of /eclass/subversion.eclass

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

Revision 1.6 Revision 1.11
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.6 2004/03/01 16:34:42 hattya Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.11 2004/06/06 10:03:11 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
9# subversion repositories like the cvs eclass. 9# subversion repositories like the cvs eclass.
10# 10#
11# 11#
12# Description: 12# Description:
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_REPO_URI 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"
26 28
27 29
28## -- add subversion in DEPEND 30## -- add subversion in DEPEND
29# 31#
30newdepend "dev-util/subversion" 32DEPEND="dev-util/subversion"
31 33
32 34
33## -- ESVN_STORE_DIR: subversion sources store directory 35## -- ESVN_STORE_DIR: subversion sources store directory
34# 36#
35ESVN_STORE_DIR="${DISTDIR}/svn-src" 37ESVN_STORE_DIR="${DISTDIR}/svn-src"
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) ;;
110 svn) ;;
94 *) 111 *)
95 die "subversion.eclass: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." 112 die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
96 ;; 113 ;;
97 esac 114 esac
98 115
99 # every time 116 # every time
100 addwrite "${ESVN_STORE_DIR}" 117 addwrite "${ESVN_STORE_DIR}"
101 addwrite "/etc/subversion" 118 addwrite "/etc/subversion"
102 119
103 # -userpriv 120 # -userpriv
104 addwrite "/root/.subversion" 121 ! has userpriv ${FEATURE} && addwrite "/root/.subversion"
105 122
106 if [ ! -d "${ESVN_STORE_DIR}" ]; then 123 if [ ! -d "${ESVN_STORE_DIR}" ]; then
107 mkdir -p "${ESVN_STORE_DIR}" || die "subversion.eclass: can't mkdir ${ESVN_STORE_DIR}." 124 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}." 125 chmod -f o+rw "${ESVN_STORE_DIR}" || die "${ESVN}: can't chmod ${ESVN_STORE_DIR}."
109 einfo "created store directory: ${ESVN_STORE_DIR}" 126 einfo "created store directory: ${ESVN_STORE_DIR}"
110 einfo 127 einfo
111 fi 128 fi
112 129
113 cd "${ESVN_STORE_DIR}" 130 cd "${ESVN_STORE_DIR}"
121 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}" 138 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}"
122 139
123 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 140 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
124 # first check out 141 # first check out
125 einfo "subversion check out start -->" 142 einfo "subversion check out start -->"
126 einfo
127 einfo "check out from: ${ESVN_REPO_URI}" 143 einfo " checkout from: ${ESVN_REPO_URI}"
128 144
129 mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}." 145 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}." 146 chmod -f o+rw "${ESVN_PROJECT}" || die "${ESVN}: can't chmod ${ESVN_PROJECT}."
131 cd "${ESVN_PROJECT}" 147 cd "${ESVN_PROJECT}"
132 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "subversion.eclass: can't fetch from ${ESVN_REPO_URI}." 148 ${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}" 149 einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
134 150
135 else 151 else
136 # update working copy 152 # update working copy
137 einfo "subversion update start -->" 153 einfo "subversion update start -->"
138 einfo
139 einfo " update from: ${ESVN_REPO_URI}" 154 einfo " update from: ${ESVN_REPO_URI}"
140
141 cd "${ESVN_CO_DIR}" 155 cd "${ESVN_CO_DIR}"
156
157 local NOW=$(date +%s) UPDATE=$(date -r .svn/entries +%s) INTERVAL=3600
158 if expr ${NOW} - ${UPDATE} \> ${INTERVAL} >/dev/null; then
142 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}." 159 ${ESVN_UPDATE_CMD} || die "${ESVN}: can't update from ${ESVN_REPO_URI}."
160 else
161 echo "Skip updating..."
162 fi
163
143 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 164 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
144 fi
145 165
146 # permission fix 166 fi
147 chmod -Rf o+rw . 167
168 # permission fix for NFS (root_squash) with -userpriv
169 find ! -perm -o+rw -exec chmod o+rw {} \; 2>/dev/null
148 170
149 # copy to the ${WORKDIR} 171 # copy to the ${WORKDIR}
150 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}." 172 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${S}" || die "${ESVN}: can't copy to ${S}."
151 einfo 173 einfo " copied to: ${S}"
174 echo
152 175
153} 176}
154 177
155 178
156## -- subversion_bootstrap() ------------------------------------------------ # 179## -- subversion_bootstrap() ------------------------------------------------ #
157 180
158subversion_bootstrap() { 181subversion_bootstrap() {
159 182
183 cd "${S}"
184
185 if [ "${ESVN_PATCHES}" ]; then
186 einfo "apply paches -->"
187 for PATCH in ${ESVN_PATCHES}; do
188 if [ -f "${PATCH}" ]; then
189 epatch ${PATCH}
190
191 else
192 for fPATCH in ${FILESDIR}/${PATCH}; do
193 if [ -f "${fPATCH}" ]; then
194 epatch ${fPATCH}
195
196 else
197 die "${ESVN}; ${PATCH} is not found"
198
199 fi
200 done
201 fi
202 done
203 echo
204 fi
205
160 if [ -n "${ESVN_BOOTSTRAP}" ]; then 206 if [ "${ESVN_BOOTSTRAP}" ]; then
161 cd "${WORKDIR}/${P}"
162
163 if [ -x "${ESVN_BOOTSTRAP}" ]; then
164 einfo "begin bootstrap -->" 207 einfo "begin bootstrap -->"
165 ./${ESVN_BOOTSTRAP} || die "subversion.eclass: can't bootstrap with ${ESVN_BOOTSTRAP}." 208 if [ -f "${ESVN_BOOTSTRAP}" -a -x "${ESVN_BOOTSTRAP}" ]; then
209 einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}"
210 eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP."
211
212 else
213 einfo " bootstrap with command: ESVN_BOOTSTRAP"
214 eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP."
215
166 fi 216 fi
167
168 fi 217 fi
169 218
170} 219}
171 220
172 221
173## -- subversion_src_unpack() ------------------------------------------------ # 222## -- subversion_src_unpack() ------------------------------------------------ #
174 223
175subversion_src_unpack() { 224subversion_src_unpack() {
176 225
177 subversion_svn_fetch || die "subversion.eclass: unknown problem in subversion_svn_fetch()." 226 subversion_svn_fetch || die "${ESVN}: unknown problem in subversion_svn_fetch()."
178 subversion_bootstrap || die "subversion.eclass: unknown problem in subversion_bootstrap()." 227 subversion_bootstrap || die "${ESVN}: unknown problem in subversion_bootstrap()."
179 228
180} 229}

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

  ViewVC Help
Powered by ViewVC 1.1.20