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

Contents of /eclass/subversion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Feb 27 09:00:25 2004 UTC (10 years, 7 months ago) by hattya
Branch: MAIN
Changes since 1.4: +33 -28 lines
Fixes bug #42911 and clean up.

1 # Copyright 1999-2004 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.4 2004/02/08 14:37:59 hattya Exp $
4
5 ## --------------------------------------------------------------------------- #
6 # Author: Akinori Hattori <hattya@gentoo.org>
7 #
8 # The subversion eclass is written to fetch the software sources from
9 # subversion repositories like the cvs eclass.
10 #
11 #
12 # Description:
13 # If you use this eclass, the ${S} is ${WORKDIR}/${P}.
14 # It is necessary to define the ESVN_REPOURI variable at least.
15 #
16 ## --------------------------------------------------------------------------- #
17
18
19 ECLASS="subversion"
20 INHERITED="${INHERITED} ${ECLASS}"
21
22 EXPORT_FUNCTIONS src_unpack
23
24 HOMEPAGE="http://subversion.tigris.org/"
25 DESCRIPTION="Based on the ${ECLASS} eclass"
26
27
28 ## -- add subversion in DEPEND
29 #
30 newdepend "dev-util/subversion"
31
32
33 ## -- ESVN_STORE_DIR: subversion sources store directory
34 #
35 ESVN_STORE_DIR="${DISTDIR}/svn-src"
36
37
38 ## -- ESVN_FETCH_CMD: subversion fetch command
39 #
40 # default: svn checkout
41 #
42 [ -z "${ESVN_FETCH_CMD}" ] && ESVN_FETCH_CMD="svn checkout"
43
44 ## -- ESVN_UPDATE_CMD: subversion update command
45 #
46 # default: svn update
47 #
48 [ -z "${ESVN_UPDATE_CMD}" ] && ESVN_UPDATE_CMD="svn update"
49
50
51 ## -- ESVN_REPO_URI: repository uri
52 #
53 # e.g. http://foo/trunk, svn://bar/trunk
54 # but currentry support http and https only.
55 #
56 [ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI=""
57
58
59 ## -- ESVN_PROJECT: project name of your ebuild
60 #
61 # subversion eclass will check out the subversion repository like:
62 #
63 # ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/}
64 #
65 # so if you define ESVN_REPO_URI as http://svn.collab.net/repo/svn/trunk or
66 # http://svn.collab.net/repo/svn/trunk/. and PN is subversion-svn.
67 # it will check out like:
68 #
69 # ${ESVN_STORE_DIR}/subversion/trunk
70 #
71 # default: ${PN/-svn}.
72 #
73 [ -z "${ESVN_PROJECT}" ] && ESVN_PROJECT="${PN/-svn}"
74
75
76 ## -- ESVN_BOOTSTRAP:
77 #
78 # bootstrap script. like autogen.sh or etc..
79 #
80 [ -z "${ESVN_BOOTSTRAP}" ] && ESVN_BOOTSTRAP=""
81
82
83 ## -- subversion_svn_fetch() ------------------------------------------------- #
84
85 subversion_svn_fetch() {
86
87 # ESVN_REPO_URI is empty.
88 [ -z "${ESVN_REPO_URI}" ] && die "subversion.eclass: ESVN_REPO_URI is empty."
89
90 # http and https only...
91 case ${ESVN_REPO_URI%%:*} in
92 http) ;;
93 https) ;;
94 *)
95 die "subversion.eclass: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
96 ;;
97 esac
98
99 # every time
100 addwrite "${ESVN_STORE_DIR}"
101 addwrite "/etc/subversion"
102
103 # -userpriv
104 addwrite "/root/.subversion"
105
106 if [ ! -d "${ESVN_STORE_DIR}" ]; then
107 mkdir -p "${ESVN_STORE_DIR}" || die "subversion.eclass: can't mkdir ${ESVN_STORE_DIR}."
108 einfo "created store directory: ${ESVN_STORE_DIR}"
109 einfo
110 fi
111
112 cd "${ESVN_STORE_DIR}"
113
114 if [ -z ${ESVN_REPO_URI##*/} ]; then
115 ESVN_REPO_FIX="${ESVN_REPO_URI%/}"
116 else
117 ESVN_REPO_FIX="${ESVN_REPO_URI}"
118 fi
119
120 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}"
121
122 if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
123 # first check out
124 einfo "subversion check out start -->"
125 einfo
126 einfo "check out from: ${ESVN_REPO_URI}"
127
128 mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}."
129 cd "${ESVN_PROJECT}"
130
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}"
133
134 else
135 # update working copy
136 einfo "subversion update start -->"
137 einfo
138 einfo " update from: ${ESVN_REPO_URI}"
139
140 cd "${ESVN_CO_DIR}"
141 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}."
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}."
147 fi
148
149 # copy to the ${WORKDIR}
150 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}."
151 einfo
152
153 }
154
155
156 ## -- subversion_bootstrap() ------------------------------------------------ #
157
158 subversion_bootstrap() {
159
160 if [ -n "${ESVN_BOOTSTRAP}" ]; then
161 cd "${WORKDIR}/${P}"
162
163 if [ -x "${ESVN_BOOTSTRAP}" ]; then
164 einfo "begin bootstrap -->"
165 ./${ESVN_BOOTSTRAP} || die "subversion.eclass: can't bootstrap with ${ESVN_BOOTSTRAP}."
166 fi
167
168 fi
169
170 }
171
172
173 ## -- subversion_src_unpack() ------------------------------------------------ #
174
175 subversion_src_unpack() {
176
177 subversion_svn_fetch || die "subversion.eclass: unknown problem in subversion_svn_fetch()."
178 subversion_bootstrap || die "subversion.eclass: unknown problem in subversion_bootstrap()."
179
180 }

  ViewVC Help
Powered by ViewVC 1.1.20