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

Contents of /eclass/subversion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Mon Mar 1 16:37:31 2004 UTC (10 years, 4 months ago) by hattya
Branch: MAIN
Changes since 1.6: +2 -2 lines
stderr > /dev/null

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.7 # $Header: /home/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.6 2004/03/01 16:34:42 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 hattya 1.5 DESCRIPTION="Based on the ${ECLASS} eclass"
26 hattya 1.1
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 hattya 1.5 # but currentry support http and https only.
55 hattya 1.1 #
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 hattya 1.5 # ESVN_REPO_URI is empty.
88     [ -z "${ESVN_REPO_URI}" ] && die "subversion.eclass: ESVN_REPO_URI is empty."
89 hattya 1.1
90 hattya 1.5 # http and https only...
91     case ${ESVN_REPO_URI%%:*} in
92     http) ;;
93     https) ;;
94     *)
95 hattya 1.1 die "subversion.eclass: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented."
96 hattya 1.5 ;;
97     esac
98 hattya 1.1
99 hattya 1.5 # every time
100     addwrite "${ESVN_STORE_DIR}"
101     addwrite "/etc/subversion"
102    
103     # -userpriv
104     addwrite "/root/.subversion"
105 hattya 1.1
106     if [ ! -d "${ESVN_STORE_DIR}" ]; then
107 hattya 1.4 mkdir -p "${ESVN_STORE_DIR}" || die "subversion.eclass: can't mkdir ${ESVN_STORE_DIR}."
108 hattya 1.6 chmod -f o+rw "${ESVN_STORE_DIR}" || die "subversion.eclass: can't chmod ${ESVN_STORE_DIR}."
109 hattya 1.1 einfo "created store directory: ${ESVN_STORE_DIR}"
110     einfo
111     fi
112    
113 hattya 1.5 cd "${ESVN_STORE_DIR}"
114 hattya 1.1
115     if [ -z ${ESVN_REPO_URI##*/} ]; then
116 hattya 1.5 ESVN_REPO_FIX="${ESVN_REPO_URI%/}"
117     else
118     ESVN_REPO_FIX="${ESVN_REPO_URI}"
119 hattya 1.1 fi
120    
121 hattya 1.5 ESVN_CO_DIR="${ESVN_PROJECT}/${ESVN_REPO_FIX##*/}"
122 hattya 1.1
123     if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then
124     # first check out
125     einfo "subversion check out start -->"
126     einfo
127     einfo "check out from: ${ESVN_REPO_URI}"
128    
129 hattya 1.4 mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}."
130 hattya 1.6 chmod -f o+rw "${ESVN_PROJECT}" || die "subversion.eclass: can't chmod ${ESVN_PROJECT}."
131 hattya 1.5 cd "${ESVN_PROJECT}"
132 hattya 1.4 ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "subversion.eclass: can't fetch from ${ESVN_REPO_URI}."
133 hattya 1.1 einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
134    
135     else
136     # update working copy
137     einfo "subversion update start -->"
138     einfo
139     einfo " update from: ${ESVN_REPO_URI}"
140    
141 hattya 1.5 cd "${ESVN_CO_DIR}"
142 hattya 1.4 ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}."
143 hattya 1.1 einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}"
144     fi
145    
146 hattya 1.6 # permission fix
147 hattya 1.7 chmod -Rf o+rw . 2>/dev/null
148 hattya 1.5
149 hattya 1.1 # copy to the ${WORKDIR}
150 hattya 1.4 cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}."
151 hattya 1.1 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 hattya 1.5 einfo "begin bootstrap -->"
165     ./${ESVN_BOOTSTRAP} || die "subversion.eclass: can't bootstrap with ${ESVN_BOOTSTRAP}."
166 hattya 1.1 fi
167    
168     fi
169    
170     }
171    
172    
173     ## -- subversion_src_unpack() ------------------------------------------------ #
174    
175     subversion_src_unpack() {
176    
177 hattya 1.5 subversion_svn_fetch || die "subversion.eclass: unknown problem in subversion_svn_fetch()."
178     subversion_bootstrap || die "subversion.eclass: unknown problem in subversion_bootstrap()."
179 hattya 1.1
180     }

  ViewVC Help
Powered by ViewVC 1.1.20