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

Diff of /eclass/subversion.eclass

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

Revision 1.4 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.4 2004/02/08 14:37:59 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."
93 96 ;;
94 fi 97 esac
95 fi
96
97 if [ ! -d "${ESVN_STORE_DIR}" ]; then
98 # I don't know why this causes access violation.
99 addwrite "${ESVN_STORE_DIR}"
100
101 mkdir -p "${ESVN_STORE_DIR}" || die "subversion.eclass: can't mkdir ${ESVN_STORE_DIR}."
102 einfo "created store directory: ${ESVN_STORE_DIR}"
103 einfo
104 fi
105
106 cd "${ESVN_STORE_DIR}" || die "subversion.eclass: can't cd to ${ESVN_STORE_DIR}."
107 98
108 # every time 99 # every time
100 addwrite "${ESVN_STORE_DIR}"
109 addwrite "/etc/subversion" 101 addwrite "/etc/subversion"
110 102
111 # -userpriv 103 # -userpriv
112 addwrite "/root/.subversion" 104 addwrite "/root/.subversion"
113 105
106 if [ ! -d "${ESVN_STORE_DIR}" ]; then
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}."
109 einfo "created store directory: ${ESVN_STORE_DIR}"
114 einfo 110 einfo
111 fi
112
113 cd "${ESVN_STORE_DIR}"
115 114
116 if [ -z ${ESVN_REPO_URI##*/} ]; then 115 if [ -z ${ESVN_REPO_URI##*/} ]; then
117 ESVN_REPO_FIX="${ESVN_REPO_FIX%/}" 116 ESVN_REPO_FIX="${ESVN_REPO_URI%/}"
117 else
118 ESVN_REPO_FIX="${ESVN_REPO_URI}"
118 fi 119 fi
119 120
120 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}" 121 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}"
121 122
122 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 123 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
123 # first check out 124 # first check out
124 einfo "subversion check out start -->" 125 einfo "subversion check out start -->"
125 einfo 126 einfo
126 einfo "check out from: ${ESVN_REPO_URI}" 127 einfo "check out from: ${ESVN_REPO_URI}"
127 128
128 mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}." 129 mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}."
129 cd "${ESVN_PROJECT}" || die "subversion.eclass: can't cd to ${ESVN_PROJECT}." 130 chmod -f o+rw "${ESVN_PROJECT}" || die "subversion.eclass: can't chmod ${ESVN_PROJECT}."
130 131 cd "${ESVN_PROJECT}"
131 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "subversion.eclass: can't fetch from ${ESVN_REPO_URI}." 132 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "subversion.eclass: can't fetch from ${ESVN_REPO_URI}."
132 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 133 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
133 134
134 else 135 else
135 # update working copy 136 # update working copy
136 einfo "subversion update start -->" 137 einfo "subversion update start -->"
137 einfo 138 einfo
138 einfo " update from: ${ESVN_REPO_URI}" 139 einfo " update from: ${ESVN_REPO_URI}"
139 140
140 cd "${ESVN_CO_DIR}" || die "subversion.eclass: can't cd to ${ESVN_CO_DIR}." 141 cd "${ESVN_CO_DIR}"
141 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}." 142 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}."
142 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 143 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
143 fi 144 fi
145
146 # permission fix
147 chmod -Rf o+rw .
144 148
145 # copy to the ${WORKDIR} 149 # copy to the ${WORKDIR}
146 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}." 150 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}."
147 einfo 151 einfo
148 152
155 159
156 if [ -n "${ESVN_BOOTSTRAP}" ]; then 160 if [ -n "${ESVN_BOOTSTRAP}" ]; then
157 cd "${WORKDIR}/${P}" 161 cd "${WORKDIR}/${P}"
158 162
159 if [ -x "${ESVN_BOOTSTRAP}" ]; then 163 if [ -x "${ESVN_BOOTSTRAP}" ]; then
160 ./${ESVN_BOOTSTRAP} 164 einfo "begin bootstrap -->"
165 ./${ESVN_BOOTSTRAP} || die "subversion.eclass: can't bootstrap with ${ESVN_BOOTSTRAP}."
161 fi 166 fi
162 167
163 fi 168 fi
164 169
165} 170}
167 172
168## -- subversion_src_unpack() ------------------------------------------------ # 173## -- subversion_src_unpack() ------------------------------------------------ #
169 174
170subversion_src_unpack() { 175subversion_src_unpack() {
171 176
172 subversion_svn_fetch 177 subversion_svn_fetch || die "subversion.eclass: unknown problem in subversion_svn_fetch()."
173 subversion_bootstrap 178 subversion_bootstrap || die "subversion.eclass: unknown problem in subversion_bootstrap()."
174 179
175} 180}

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

  ViewVC Help
Powered by ViewVC 1.1.20