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

Contents of /eclass/subversion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Mon Jan 26 08:46:29 2004 UTC (10 years, 11 months ago) by hattya
Branch: MAIN
Changes since 1.1: +4 -7 lines
Fixes bug #39406

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.2 # $Header: /home/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.1 2004/01/25 12:27:18 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     addwrite "/etc/subversion"
105     einfo
106    
107     if [ -z ${ESVN_REPO_URI##*/} ]; then
108     ESVN_REPO_FIX="${ESVN_REPO_FIX%/}"
109     fi
110    
111     ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_URI##*/}"
112    
113     if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
114     # first check out
115     einfo "subversion check out start -->"
116     einfo
117     einfo "check out from: ${ESVN_REPO_URI}"
118    
119     mkdir -p "${ESVN_PROJECT}"
120     cd "${ESVN_PROJECT}"
121    
122 hattya 1.2 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}"
123 hattya 1.1 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
124    
125     else
126     # update working copy
127     einfo "subversion update start -->"
128     einfo
129     einfo " update from: ${ESVN_REPO_URI}"
130    
131     cd "${ESVN_CO_DIR}"
132 hattya 1.2 ${ESVN_UPDATE_CMD}
133 hattya 1.1 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
134     fi
135    
136     # copy to the ${WORKDIR}
137     cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}"
138     einfo
139    
140     }
141    
142    
143     ## -- subversion_bootstrap() ------------------------------------------------ #
144    
145     subversion_bootstrap() {
146    
147     if [ -n "${ESVN_BOOTSTRAP}" ]; then
148     cd "${WORKDIR}/${P}"
149    
150     if [ -x "${ESVN_BOOTSTRAP}" ]; then
151     ./${ESVN_BOOTSTRAP}
152     fi
153    
154     fi
155    
156     }
157    
158    
159     ## -- subversion_src_unpack() ------------------------------------------------ #
160    
161     subversion_src_unpack() {
162    
163     subversion_svn_fetch
164     subversion_bootstrap
165    
166     }

  ViewVC Help
Powered by ViewVC 1.1.20