/[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.5
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.5 2004/02/27 09:00:25 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 # 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}." 107 mkdir -p "${ESVN_STORE_DIR}" || die "subversion.eclass: can't mkdir ${ESVN_STORE_DIR}."
102 einfo "created store directory: ${ESVN_STORE_DIR}" 108 einfo "created store directory: ${ESVN_STORE_DIR}"
103 einfo 109 einfo
104 fi 110 fi
105 111
106 cd "${ESVN_STORE_DIR}" || die "subversion.eclass: can't cd to ${ESVN_STORE_DIR}." 112 cd "${ESVN_STORE_DIR}"
107
108 # every time
109 addwrite "/etc/subversion"
110
111 # -userpriv
112 addwrite "/root/.subversion"
113
114 einfo
115 113
116 if [ -z ${ESVN_REPO_URI##*/} ]; then 114 if [ -z ${ESVN_REPO_URI##*/} ]; then
117 ESVN_REPO_FIX="${ESVN_REPO_FIX%/}" 115 ESVN_REPO_FIX="${ESVN_REPO_URI%/}"
116 else
117 ESVN_REPO_FIX="${ESVN_REPO_URI}"
118 fi 118 fi
119 119
120 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}" 120 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}"
121 121
122 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then 122 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
123 # first check out 123 # first check out
124 einfo "subversion check out start -->" 124 einfo "subversion check out start -->"
125 einfo 125 einfo
126 einfo "check out from: ${ESVN_REPO_URI}" 126 einfo "check out from: ${ESVN_REPO_URI}"
127 127
128 mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}." 128 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}." 129 cd "${ESVN_PROJECT}"
130 130
131 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "subversion.eclass: can't fetch from ${ESVN_REPO_URI}." 131 ${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}" 132 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
133 133
134 else 134 else
135 # update working copy 135 # update working copy
136 einfo "subversion update start -->" 136 einfo "subversion update start -->"
137 einfo 137 einfo
138 einfo " update from: ${ESVN_REPO_URI}" 138 einfo " update from: ${ESVN_REPO_URI}"
139 139
140 cd "${ESVN_CO_DIR}" || die "subversion.eclass: can't cd to ${ESVN_CO_DIR}." 140 cd "${ESVN_CO_DIR}"
141 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}." 141 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}."
142 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" 142 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
143 fi
144
145 if [ $(whoami) != "portage" ]; then
146 chmod -R o+rw ${ESVN_STORE_DIR} || die "subversion.eclass: can't chmod ${ESVN_STORE_DIR}."
143 fi 147 fi
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
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.5

  ViewVC Help
Powered by ViewVC 1.1.20