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

Diff of /eclass/subversion.eclass

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

Revision 1.21 Revision 1.31
1# Copyright 1999-2005 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.21 2005/07/06 20:20:04 agriffis Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.31 2006/04/30 09:26:56 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:
15# 15#
16## --------------------------------------------------------------------------- # 16## --------------------------------------------------------------------------- #
17 17
18inherit eutils 18inherit eutils
19 19
20INHERITED="${INHERITED} ${ECLASS}"
21ESVN="subversion.eclass" 20ESVN="subversion.eclass"
22 21
23EXPORT_FUNCTIONS src_unpack 22EXPORT_FUNCTIONS src_unpack
24 23
25HOMEPAGE="http://subversion.tigris.org/" 24HOMEPAGE="http://subversion.tigris.org/"
31DEPEND="dev-util/subversion" 30DEPEND="dev-util/subversion"
32 31
33 32
34## -- ESVN_STORE_DIR: subversion sources store directory 33## -- ESVN_STORE_DIR: subversion sources store directory
35# 34#
36ESVN_STORE_DIR="${DISTDIR}/svn-src" 35ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/svn-src"
37 36
38 37
39## -- ESVN_FETCH_CMD: subversion fetch command 38## -- ESVN_FETCH_CMD: subversion fetch command
40# 39#
41# default: svn checkout 40ESVN_FETCH_CMD="svn checkout"
42#
43[ -z "${ESVN_FETCH_CMD}" ] && ESVN_FETCH_CMD="svn checkout"
44 41
45## -- ESVN_UPDATE_CMD: subversion update command 42## -- ESVN_UPDATE_CMD: subversion update command
46# 43#
47# default: svn update 44ESVN_UPDATE_CMD="svn update"
45
46
47## -- ESVN_OPTIONS:
48# 48#
49[ -z "${ESVN_UPDATE_CMD}" ] && ESVN_UPDATE_CMD="svn update" 49# the options passed to checkout or update.
50#
51[ -z "${ESVN_OPTIONS}" ] && ESVN_OPTIONS=
50 52
51 53
52## -- ESVN_REPO_URI: repository uri 54## -- ESVN_REPO_URI: repository uri
53# 55#
54# e.g. http://foo/trunk, svn://bar/trunk 56# e.g. http://foo/trunk, svn://bar/trunk
101 103
102## -- subversion_svn_fetch() ------------------------------------------------- # 104## -- subversion_svn_fetch() ------------------------------------------------- #
103 105
104function subversion_svn_fetch() { 106function subversion_svn_fetch() {
105 107
108 local ESVN_CO_DIR
109
106 # ESVN_REPO_URI is empty. 110 # ESVN_REPO_URI is empty.
107 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty." 111 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty."
108 112
109 # check for the protocol. 113 # check for the protocol.
110 case ${ESVN_REPO_URI%%:*} in 114 case ${ESVN_REPO_URI%%:*} in
111 http) ;; 115 http|https)
112 https) ;; 116 if built_with_use dev-util/subversion nowebdav; then
117 eerror "In order to emerge this package, you need to"
118 eerror "re-emerge subversion with USE=-nowebdav"
119 die "Please run 'USE=-nowebdav emerge subversion'"
120 fi
121 ;;
113 svn) ;; 122 svn) ;;
114 *) 123 *)
115 die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." 124 die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
116 ;; 125 ;;
117 esac 126 esac
130 139
131 # every time 140 # every time
132 addwrite "/etc/subversion" 141 addwrite "/etc/subversion"
133 addwrite "${ESVN_STORE_DIR}" 142 addwrite "${ESVN_STORE_DIR}"
134 143
144 if ! has userpriv ${FEATURES}; then
135 # -userpriv 145 # -userpriv
136 ! 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
137 153
138 [ -z "${ESVN_REPO_URI##*/}" ] && ESVN_REPO_URI="${ESVN_REPO_URI%/}" 154 [ -z "${ESVN_REPO_URI##*/}" ] && ESVN_REPO_URI="${ESVN_REPO_URI%/}"
139 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}\""
140 158
141 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 159 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
142 # first check out 160 # first check out
143 einfo "subversion check out start -->" 161 einfo "subversion check out start -->"
144 einfo " checkout from: ${ESVN_REPO_URI}" 162 einfo " repository: ${ESVN_REPO_URI}"
145 163
146 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 164 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
147 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}."
148 cd "${ESVN_PROJECT}" 166 cd "${ESVN_PROJECT}"
149 ${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}."
150
151 einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
152 168
153 else 169 else
154 # update working copy 170 # update working copy
155 einfo "subversion update start -->" 171 einfo "subversion update start -->"
156 einfo " update from: ${ESVN_REPO_URI}" 172 einfo " repository: ${ESVN_REPO_URI}"
173
157 cd "${ESVN_CO_DIR}" 174 cd "${ESVN_CO_DIR}"
158
159 local NOW=$(date +%s) UPDATE=$(date -r .svn/entries +%s) INTERVAL=3600
160 if (( ${NOW} - ${UPDATE} > ${INTERVAL} )); then
161 ${ESVN_UPDATE_CMD} || die "${ESVN}: can't update from ${ESVN_REPO_URI}." 175 ${ESVN_UPDATE_CMD} ${ESVN_OPTIONS} || die "${ESVN}: can't update from ${ESVN_REPO_URI}."
162 176
163 else
164 echo "Skip updating..."
165
166 fi 177 fi
167 178
168 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 179 einfo " working copy: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
169 180
170 fi
171
172 # copy to the ${WORKDIR} 181 # export to the ${WORKDIR}
182 # "svn export" has a bug. see http://bugs.gentoo.org/119236
173 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${S}" || die "${ESVN}: can't copy to ${S}." 183 #svn export "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${S}" || die "${ESVN}: can't export to ${S}."
174 einfo " copied to: ${S}" 184 rsync -a --exclude=".svn/" "${ESVN_STORE_DIR}/${ESVN_CO_DIR}/" "${S}" || die "${ESVN}: can't export to ${S}."
175 echo 185 echo
176 186
177} 187}
178 188
179 189
226 236
227## -- subversion_src_unpack() ------------------------------------------------ # 237## -- subversion_src_unpack() ------------------------------------------------ #
228 238
229function subversion_src_unpack() { 239function subversion_src_unpack() {
230 240
231 if [ "${A}" != "" ]; then
232 unpack ${A}
233 fi
234
235 subversion_svn_fetch || die "${ESVN}: unknown problem in subversion_svn_fetch()." 241 subversion_svn_fetch || die "${ESVN}: unknown problem in subversion_svn_fetch()."
236 subversion_bootstrap || die "${ESVN}: unknown problem in subversion_bootstrap()." 242 subversion_bootstrap || die "${ESVN}: unknown problem in subversion_bootstrap()."
237 243
238} 244}

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20