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

Diff of /eclass/subversion.eclass

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

Revision 1.17 Revision 1.31
1# Copyright 1999-2004 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.17 2005/01/20 09:51:17 hattya 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
20ECLASS="subversion"
21INHERITED="${INHERITED} ${ECLASS}"
22ESVN="subversion.eclass" 20ESVN="subversion.eclass"
23 21
24EXPORT_FUNCTIONS src_unpack 22EXPORT_FUNCTIONS src_unpack
25 23
26HOMEPAGE="http://subversion.tigris.org/" 24HOMEPAGE="http://subversion.tigris.org/"
32DEPEND="dev-util/subversion" 30DEPEND="dev-util/subversion"
33 31
34 32
35## -- ESVN_STORE_DIR: subversion sources store directory 33## -- ESVN_STORE_DIR: subversion sources store directory
36# 34#
37ESVN_STORE_DIR="${DISTDIR}/svn-src" 35ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/svn-src"
38 36
39 37
40## -- ESVN_FETCH_CMD: subversion fetch command 38## -- ESVN_FETCH_CMD: subversion fetch command
41# 39#
42# default: svn checkout 40ESVN_FETCH_CMD="svn checkout"
43#
44[ -z "${ESVN_FETCH_CMD}" ] && ESVN_FETCH_CMD="svn checkout"
45 41
46## -- ESVN_UPDATE_CMD: subversion update command 42## -- ESVN_UPDATE_CMD: subversion update command
47# 43#
48# default: svn update 44ESVN_UPDATE_CMD="svn update"
45
46
47## -- ESVN_OPTIONS:
49# 48#
50[ -z "${ESVN_UPDATE_CMD}" ] && ESVN_UPDATE_CMD="svn update" 49# the options passed to checkout or update.
50#
51[ -z "${ESVN_OPTIONS}" ] && ESVN_OPTIONS=
51 52
52 53
53## -- ESVN_REPO_URI: repository uri 54## -- ESVN_REPO_URI: repository uri
54# 55#
55# e.g. http://foo/trunk, svn://bar/trunk 56# e.g. http://foo/trunk, svn://bar/trunk
102 103
103## -- subversion_svn_fetch() ------------------------------------------------- # 104## -- subversion_svn_fetch() ------------------------------------------------- #
104 105
105function subversion_svn_fetch() { 106function subversion_svn_fetch() {
106 107
108 local ESVN_CO_DIR
109
107 # ESVN_REPO_URI is empty. 110 # ESVN_REPO_URI is empty.
108 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty." 111 [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty."
109 112
110 # check for the protocol. 113 # check for the protocol.
111 case ${ESVN_REPO_URI%%:*} in 114 case ${ESVN_REPO_URI%%:*} in
112 http) ;; 115 http|https)
113 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 ;;
114 svn) ;; 122 svn) ;;
115 *) 123 *)
116 die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." 124 die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
117 ;; 125 ;;
118 esac 126 esac
119 127
120 if [ ! -d "${ESVN_STORE_IR}" ]; then 128 if [ ! -d "${ESVN_STORE_DIR}" ]; then
121 debug-print "${FUNCNAME}: initial checkout. creating subversion directory" 129 debug-print "${FUNCNAME}: initial checkout. creating subversion directory"
122 130
123 addwrite / 131 addwrite /
124 mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." 132 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}." 133 chmod -f o+rw "${ESVN_STORE_DIR}" || die "${ESVN}: can't chmod ${ESVN_STORE_DIR}."
131 139
132 # every time 140 # every time
133 addwrite "/etc/subversion" 141 addwrite "/etc/subversion"
134 addwrite "${ESVN_STORE_DIR}" 142 addwrite "${ESVN_STORE_DIR}"
135 143
144 if ! has userpriv ${FEATURES}; then
136 # -userpriv 145 # -userpriv
137 ! 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
138 153
139 [ -z "${ESVN_REPO_URI##*/}" ] && ESVN_REPO_URI="${ESVN_REPO_URI%/}" 154 [ -z "${ESVN_REPO_URI##*/}" ] && ESVN_REPO_URI="${ESVN_REPO_URI%/}"
140 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}\""
141 158
142 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 159 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
143 # first check out 160 # first check out
144 einfo "subversion check out start -->" 161 einfo "subversion check out start -->"
145 einfo " checkout from: ${ESVN_REPO_URI}" 162 einfo " repository: ${ESVN_REPO_URI}"
146 163
147 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." 164 mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
148 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}."
149 cd "${ESVN_PROJECT}" 166 cd "${ESVN_PROJECT}"
150 ${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}."
151
152 einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
153 168
154 else 169 else
155 # update working copy 170 # update working copy
156 einfo "subversion update start -->" 171 einfo "subversion update start -->"
157 einfo " update from: ${ESVN_REPO_URI}" 172 einfo " repository: ${ESVN_REPO_URI}"
173
158 cd "${ESVN_CO_DIR}" 174 cd "${ESVN_CO_DIR}"
159
160 local NOW=$(date +%s) UPDATE=$(date -r .svn/entries +%s) INTERVAL=3600
161 if (( ${NOW} - ${UPDATE} > ${INTERVAL} )); then
162 ${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}."
163 176
164 else
165 echo "Skip updating..."
166
167 fi 177 fi
168 178
169 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 179 einfo " working copy: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
170 180
171 fi
172
173 # copy to the ${WORKDIR} 181 # export to the ${WORKDIR}
182 # "svn export" has a bug. see http://bugs.gentoo.org/119236
174 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}."
175 einfo " copied to: ${S}" 184 rsync -a --exclude=".svn/" "${ESVN_STORE_DIR}/${ESVN_CO_DIR}/" "${S}" || die "${ESVN}: can't export to ${S}."
176 echo 185 echo
177 186
178} 187}
179 188
180 189

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

  ViewVC Help
Powered by ViewVC 1.1.20