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

Contents of /eclass/subversion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Sun Feb 8 14:37:59 2004 UTC (10 years, 2 months ago) by hattya
Branch: MAIN
Changes since 1.3: +12 -9 lines
added addwrite "${ESVN_STORE_DIR}" and many die.

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.3 2004/01/26 15:06:02 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
26
27 ## -- add subversion in DEPEND
28 #
29 newdepend "dev-util/subversion"
30
31
32 ## -- ESVN_STORE_DIR: subversion sources store directory
33 #
34 ESVN_STORE_DIR="${DISTDIR}/svn-src"
35
36
37 ## -- ESVN_FETCH_CMD: subversion fetch command
38 #
39 # default: svn checkout
40 #
41 [ -z "${ESVN_FETCH_CMD}" ] && ESVN_FETCH_CMD="svn checkout"
42
43 ## -- ESVN_UPDATE_CMD: subversion update command
44 #
45 # default: svn update
46 #
47 [ -z "${ESVN_UPDATE_CMD}" ] && ESVN_UPDATE_CMD="svn update"
48
49
50 ## -- ESVN_REPO_URI: repository uri
51 #
52 # e.g. http://foo/trunk, svn://bar/trunk
53 # but currentry support http only.
54 #
55 [ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI=""
56
57
58 ## -- ESVN_PROJECT: project name of your ebuild
59 #
60 # subversion eclass will check out the subversion repository like:
61 #
62 # ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/}
63 #
64 # so if you define ESVN_REPO_URI as http://svn.collab.net/repo/svn/trunk or
65 # http://svn.collab.net/repo/svn/trunk/. and PN is subversion-svn.
66 # it will check out like:
67 #
68 # ${ESVN_STORE_DIR}/subversion/trunk
69 #
70 # default: ${PN/-svn}.
71 #
72 [ -z "${ESVN_PROJECT}" ] && ESVN_PROJECT="${PN/-svn}"
73
74
75 ## -- ESVN_BOOTSTRAP:
76 #
77 # bootstrap script. like autogen.sh or etc..
78 #
79 [ -z "${ESVN_BOOTSTRAP}" ] && ESVN_BOOTSTRAP=""
80
81
82 ## -- subversion_svn_fetch() ------------------------------------------------- #
83
84 subversion_svn_fetch() {
85
86 # http only...
87 if [ "${ESVN_REPO_URI%%:*}" != "http" ]; then
88 if [ -z "${ESVN_REPO_URI}" ]; then
89 die "subversion.eclass: ESVN_REPO_URI is empty."
90
91 else
92 die "subversion.eclass: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
93
94 fi
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
108 # every time
109 addwrite "/etc/subversion"
110
111 # -userpriv
112 addwrite "/root/.subversion"
113
114 einfo
115
116 if [ -z ${ESVN_REPO_URI##*/} ]; then
117 ESVN_REPO_FIX="${ESVN_REPO_FIX%/}"
118 fi
119
120 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}"
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}" || die "subversion.eclass: can't cd to ${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}" || die "subversion.eclass: can't cd to ${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 # copy to the ${WORKDIR}
146 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}."
147 einfo
148
149 }
150
151
152 ## -- subversion_bootstrap() ------------------------------------------------ #
153
154 subversion_bootstrap() {
155
156 if [ -n "${ESVN_BOOTSTRAP}" ]; then
157 cd "${WORKDIR}/${P}"
158
159 if [ -x "${ESVN_BOOTSTRAP}" ]; then
160 ./${ESVN_BOOTSTRAP}
161 fi
162
163 fi
164
165 }
166
167
168 ## -- subversion_src_unpack() ------------------------------------------------ #
169
170 subversion_src_unpack() {
171
172 subversion_svn_fetch
173 subversion_bootstrap
174
175 }

  ViewVC Help
Powered by ViewVC 1.1.20