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

Contents of /eclass/subversion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Mon Jan 26 15:06:02 2004 UTC (10 years, 5 months ago) by hattya
Branch: MAIN
Changes since 1.2: +7 -1 lines
Fixes bug #39406 this time

1 hattya 1.1 # Copyright 1999-2004 Gentoo Technologies, Inc.
2     # Distributed under the terms of the GNU General Public License v2
3 hattya 1.3 # $Header: /home/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.2 2004/01/26 08:46:29 hattya Exp $
4 hattya 1.1
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 hattya 1.2 die "subversion.eclass: ESVN_REPO_URI is empty."
90 hattya 1.1
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     mkdir -p "${ESVN_STORE_DIR}"
99     einfo "created store directory: ${ESVN_STORE_DIR}"
100     einfo
101     fi
102    
103     cd "${ESVN_STORE_DIR}"
104 hattya 1.3
105     # every time
106 hattya 1.1 addwrite "/etc/subversion"
107 hattya 1.3
108     # -userpriv
109     addwrite "/root/.subversion"
110    
111 hattya 1.1 einfo
112    
113     if [ -z ${ESVN_REPO_URI##*/} ]; then
114     ESVN_REPO_FIX="${ESVN_REPO_FIX%/}"
115     fi
116    
117     ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}"
118    
119     if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
120     # first check out
121     einfo "subversion check out start -->"
122     einfo
123     einfo "check out from: ${ESVN_REPO_URI}"
124    
125     mkdir -p "${ESVN_PROJECT}"
126     cd "${ESVN_PROJECT}"
127    
128 hattya 1.2 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}"
129 hattya 1.1 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
130    
131     else
132     # update working copy
133     einfo "subversion update start -->"
134     einfo
135     einfo " update from: ${ESVN_REPO_URI}"
136    
137     cd "${ESVN_CO_DIR}"
138 hattya 1.2 ${ESVN_UPDATE_CMD}
139 hattya 1.1 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
140     fi
141    
142     # copy to the ${WORKDIR}
143     cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}"
144     einfo
145    
146     }
147    
148    
149     ## -- subversion_bootstrap() ------------------------------------------------ #
150    
151     subversion_bootstrap() {
152    
153     if [ -n "${ESVN_BOOTSTRAP}" ]; then
154     cd "${WORKDIR}/${P}"
155    
156     if [ -x "${ESVN_BOOTSTRAP}" ]; then
157     ./${ESVN_BOOTSTRAP}
158     fi
159    
160     fi
161    
162     }
163    
164    
165     ## -- subversion_src_unpack() ------------------------------------------------ #
166    
167     subversion_src_unpack() {
168    
169     subversion_svn_fetch
170     subversion_bootstrap
171    
172     }

  ViewVC Help
Powered by ViewVC 1.1.20