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

Diff of /eclass/subversion.eclass

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

Revision 1.3 Revision 1.6
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.3 2004/01/26 15:06:02 hattya Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.6 2004/03/01 16:34:42 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
20INHERITED="${INHERITED} ${ECLASS}" 20INHERITED="${INHERITED} ${ECLASS}"
21 21
22EXPORT_FUNCTIONS src_unpack 22EXPORT_FUNCTIONS src_unpack
23 23
24HOMEPAGE="http://subversion.tigris.org/" 24HOMEPAGE="http://subversion.tigris.org/"
25DESCRIPTION="Based on the ${ECLASS} eclass"
25 26
26 27
27## -- add subversion in DEPEND 28## -- add subversion in DEPEND
28# 29#
29newdepend "dev-util/subversion" 30newdepend "dev-util/subversion"
48 49
49 50
50## -- ESVN_REPO_URI: repository uri 51## -- ESVN_REPO_URI: repository uri
51# 52#
52# e.g. http://foo/trunk, svn://bar/trunk 53# e.g. http://foo/trunk, svn://bar/trunk
53# but currentry support http only. 54# but currentry support http and https only.
54# 55#
55[ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI="" 56[ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI=""
56 57
57 58
58## -- ESVN_PROJECT: project name of your ebuild 59## -- ESVN_PROJECT: project name of your ebuild
81 82
82## -- subversion_svn_fetch() ------------------------------------------------- # 83## -- subversion_svn_fetch() ------------------------------------------------- #
83 84
84subversion_svn_fetch() { 85subversion_svn_fetch() {
85 86
86 # http only... 87 # ESVN_REPO_URI is empty.
87 if [ "${ESVN_REPO_URI%%:*}" != "http" ]; then
88 if [ -z "${ESVN_REPO_URI}" ]; then
89 die "subversion.eclass: ESVN_REPO_URI is empty." 88 [ -z "${ESVN_REPO_URI}" ] && die "subversion.eclass: ESVN_REPO_URI is empty."
90 89
91 else 90 # http and https only...
91 case ${ESVN_REPO_URI%%:*} in
92 http) ;;
93 https) ;;
94 *)
92 die "subversion.eclass: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." 95 die "subversion.eclass: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
96 ;;
97 esac
93 98
94 fi 99 # every time
95 fi 100 addwrite "${ESVN_STORE_DIR}"
101 addwrite "/etc/subversion"
102
103 # -userpriv
104 addwrite "/root/.subversion"
96 105
97 if [ ! -d "${ESVN_STORE_DIR}" ]; then 106 if [ ! -d "${ESVN_STORE_DIR}" ]; then
98 mkdir -p "${ESVN_STORE_DIR}" 107 mkdir -p "${ESVN_STORE_DIR}" || die "subversion.eclass: can't mkdir ${ESVN_STORE_DIR}."
108 chmod -f o+rw "${ESVN_STORE_DIR}" || die "subversion.eclass: can't chmod ${ESVN_STORE_DIR}."
99 einfo "created store directory: ${ESVN_STORE_DIR}" 109 einfo "created store directory: ${ESVN_STORE_DIR}"
100 einfo 110 einfo
101 fi 111 fi
102 112
103 cd "${ESVN_STORE_DIR}" 113 cd "${ESVN_STORE_DIR}"
104 114
105 # every time
106 addwrite "/etc/subversion"
107
108 # -userpriv
109 addwrite "/root/.subversion"
110
111 einfo
112
113 if [ -z ${ESVN_REPO_URI##*/} ]; then 115 if [ -z ${ESVN_REPO_URI##*/} ]; then
114 ESVN_REPO_FIX="${ESVN_REPO_FIX%/}" 116 ESVN_REPO_FIX="${ESVN_REPO_URI%/}"
117 else
118 ESVN_REPO_FIX="${ESVN_REPO_URI}"
115 fi 119 fi
116 120
117 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}" 121 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}"
118 122
119 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 123 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
120 # first check out 124 # first check out
121 einfo "subversion check out start -->" 125 einfo "subversion check out start -->"
122 einfo 126 einfo
123 einfo "check out from: ${ESVN_REPO_URI}" 127 einfo "check out from: ${ESVN_REPO_URI}"
124 128
125 mkdir -p "${ESVN_PROJECT}" 129 mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}."
130 chmod -f o+rw "${ESVN_PROJECT}" || die "subversion.eclass: can't chmod ${ESVN_PROJECT}."
126 cd "${ESVN_PROJECT}" 131 cd "${ESVN_PROJECT}"
127 132 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "subversion.eclass: can't fetch from ${ESVN_REPO_URI}."
128 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}"
129 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 133 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
130 134
131 else 135 else
132 # update working copy 136 # update working copy
133 einfo "subversion update start -->" 137 einfo "subversion update start -->"
134 einfo 138 einfo
135 einfo " update from: ${ESVN_REPO_URI}" 139 einfo " update from: ${ESVN_REPO_URI}"
136 140
137 cd "${ESVN_CO_DIR}" 141 cd "${ESVN_CO_DIR}"
138 ${ESVN_UPDATE_CMD} 142 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}."
139 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 143 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
140 fi 144 fi
141 145
146 # permission fix
147 chmod -Rf o+rw .
148
142 # copy to the ${WORKDIR} 149 # copy to the ${WORKDIR}
143 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" 150 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}."
144 einfo 151 einfo
145 152
146} 153}
147 154
148 155
152 159
153 if [ -n "${ESVN_BOOTSTRAP}" ]; then 160 if [ -n "${ESVN_BOOTSTRAP}" ]; then
154 cd "${WORKDIR}/${P}" 161 cd "${WORKDIR}/${P}"
155 162
156 if [ -x "${ESVN_BOOTSTRAP}" ]; then 163 if [ -x "${ESVN_BOOTSTRAP}" ]; then
157 ./${ESVN_BOOTSTRAP} 164 einfo "begin bootstrap -->"
165 ./${ESVN_BOOTSTRAP} || die "subversion.eclass: can't bootstrap with ${ESVN_BOOTSTRAP}."
158 fi 166 fi
159 167
160 fi 168 fi
161 169
162} 170}
164 172
165## -- subversion_src_unpack() ------------------------------------------------ # 173## -- subversion_src_unpack() ------------------------------------------------ #
166 174
167subversion_src_unpack() { 175subversion_src_unpack() {
168 176
169 subversion_svn_fetch 177 subversion_svn_fetch || die "subversion.eclass: unknown problem in subversion_svn_fetch()."
170 subversion_bootstrap 178 subversion_bootstrap || die "subversion.eclass: unknown problem in subversion_bootstrap()."
171 179
172} 180}

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

  ViewVC Help
Powered by ViewVC 1.1.20