Contents of /smage/trunk/include/cvs.sminc
Parent Directory | Revision Log
Revision 2792 -
(show annotations)
(download)
Mon Aug 29 20:03:18 2011 UTC (13 years, 2 months ago) by niro
File size: 1378 byte(s)
Mon Aug 29 20:03:18 2011 UTC (13 years, 2 months ago) by niro
File size: 1378 byte(s)
-merged branch alx-0_6_0 into trunk
1 | # $Header: /magellan-cvs/smage/include/cvs.sminc,v 1.1 2005/12/04 12:26:50 niro Exp $ |
2 | # cvs checkout functions |
3 | |
4 | # at least only CVSROOT must be exported |
5 | |
6 | # needed vars |
7 | MY_CVS_MODULE="${PNAME}" |
8 | MY_CVS_OPTS="" |
9 | CVSROOT="" |
10 | |
11 | SDEPEND="${SDEPEND} |
12 | >= dev-util/cvs-1 |
13 | >= sys-apps/util-linux-2" # needed for mcookie |
14 | |
15 | cvs_fetch_source() |
16 | { |
17 | [[ -z ${CVSROOT} ]] && die "no CVSROOT given, cannot run a checkout." |
18 | |
19 | local temp=${BUILDDIR}/temp-$(mcookie) |
20 | |
21 | # cvs login |
22 | export CVSROOT="${CVSROOT}" |
23 | cvs login |
24 | |
25 | [ ! -d "${temp}" ] && { install -d ${temp} || die; } |
26 | |
27 | # get all our modules or update them |
28 | if [ ! -d ${temp}/${MY_CVS_MODULE}/CVS ] |
29 | then |
30 | (cd ${temp}; cvs -z3 checkout -P ${MY_CVS_OPTS} ${MY_CVS_MODULE}) |
31 | else |
32 | (cd ${temp}; cvs -z3 update -d -P ${MY_CVS_OPTS} ${MY_CVS_MODULE}) |
33 | fi |
34 | |
35 | # set correct SRCDIR |
36 | [ -d "${SRCDIR}" ] && { rm -r ${SRCDIR} || die; } |
37 | mv ${temp}/${MY_CVS_MODULE} ${SRCDIR} || die |
38 | cd ${SRCDIR} |
39 | |
40 | # prune old cruft |
41 | [ -d "${temp}" ] && { rm -r ${temp} || die; } |
42 | |
43 | # correct permissions |
44 | find ${SRCDIR} -type f -exec chmod 0644 '{}' ';' |
45 | find ${SRCDIR} -type d -exec chmod 0755 '{}' ';' |
46 | |
47 | # delete CVS directories |
48 | for file in $(find ${SRCDIR} -type d -name CVS) |
49 | do |
50 | rm -rf ${file} |
51 | done |
52 | |
53 | # clean up backup files (foo~) |
54 | find ${SRCDIR} -name *~ -exec rm '{}' ';' || die |
55 | } |
56 | |
57 | cvs_src_prepare() |
58 | { |
59 | cvs_fetch_source || die |
60 | } |
61 | |
62 | export_inherits cvs src_prepare |