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

Contents of /eclass/cvs.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Jul 17 21:14:56 2002 UTC (12 years ago) by danarmak
Branch: MAIN
Changes since 1.1: +2 -1 lines
create ECVS_TOP_DIR if it doesn't exist

1 # Copyright 1999-2000 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License, v2 or later
3 # Author Dan Armak <danarmak@gentoo.org>
4 # $Header: /home/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.1 2002/07/17 20:25:16 danarmak Exp $
5 # This eclass provides the generic cvs fetching functions.
6
7 ECLASS=cvs
8 INHERITED="$INHERITED $ECLASS"
9
10 # You shouldn't change these settings yourself! The ebuild/eclass inheriting this eclass
11 # will take care of that. If you want to set the global KDE cvs ebuilds' settings,
12 # see the comments in kde-source.eclass.
13
14 # --- begin ebuild-configurable settings
15
16 # cvs command to run. you can set fex. "cvs -t" for extensive debug information
17 # on the cvs onnection. the default of "cvs -q -f -z4" means to be quiet, to disregard
18 # the ~/.cvsrc config file and to use maximum compression.
19 [ -z "$ECVS_CVS_COMMAND" ] && ECVS_CVS_COMMAND="cvs -q -f -z4"
20
21 # Where the cvs modules are stored/accessed
22 [ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="/usr/src"
23
24 # Name of cvs server, set to "" to disable fetching
25 # (i.e. to assume module is checked out already and don't update it).
26 # Format is server:/dir e.g. "anoncvs.kde.org:/home/kde". remove the other
27 # parts of the full CVSROOT (which looks like
28 # ":pserver:anonymous@anoncvs.kde.org:/home/kde"); these are added from
29 # other settings
30 [ -z "$ECVS_SERVER" ] && ECVS_SERVER=""
31
32 # Username to use
33 [ -z "$ECVS_USER" ] && ECVS_USER="anonymous"
34
35 # Password to use (NOT (YET) SUPPORTED, because cvs doesn't store passwords in plaintext in .cvspass)
36 [ -z "$ECVS_PASS" ] && ECVS_PASS=""
37
38 # Module to be fetched, must be set explicitly -
39 # I don't like the former ="$NP" default setting
40 [ -z "$ECVS_MODULE" ] && die "$ECLASS: error: ECVS_MODULE not set, cannot continue"
41
42 # Subdirectory in module to be fetched, default is root "/" = whole module (NOT YET IMPLEMENTED)
43 [ -z "$ECVS_MODULE_SUBDIR" ] && ECVS_MODULE_SUBDIR="/"
44
45 # --- end ebuild-configurable settings ---
46
47 debug-print "$ECLASS: init: ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND
48 ECVS_TOP_DIR=$ECVS_TOP_DIR
49 ECVS_SERVER=$ECVS_SERVER
50 ECVS_USER=$ECVS_USER
51 ECVS_PASS=$ECVS_PASS
52 ECS_MODULE=$ECVS_MODULE
53 ECVS_MODULE_SUBDIR=$ECVS_MODULE_SUBDIR"
54
55 # since we now longer have src_fetch as a redefinable ebuild function,
56 # we are forced to call this function from cvs_src_unpack
57 cvs_fetch() {
58
59 debug-print-function $FUNCNAME $*
60
61 # disable the sandbox for this dir
62 [ ! -d "$ECVS_TOP_DIR" ] && mkdir -p $ECVS_TOP_DIR
63 addread ${ECVS_TOP_DIR}
64 addwrite ${ECVS_TOP_DIR}
65
66 # prepare a cvspass file just for this session so that cvs thinks we're logged
67 # in at the cvs server. we don't want to mess with ~/.cvspass.
68 echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass
69 export CVS_PASSFILE="${T}/cvspass"
70
71 cd $ECVS_TOP_DIR
72
73 if [ -z "$ECVS_SERVER" ]; then
74 # we're not required to fetch anything, the module already exists and shouldn't be updated
75 if [ -d "$ECVS_MODULE" ]; then
76 debug-print "$FUNCNAME: offline mode, exiting"
77 return 0
78 else
79 einfo "ERROR: Offline mode specified, but module not found. Aborting."
80 debug-print "$FUNCNAME: offline mode specified but module not found, exiting with error"
81 return 1
82 fi
83 fi
84
85 if [ -d "${ECVS_MODULE}" ]; then
86 #update existing module
87
88 cd ${ECVS_MODULE}
89
90 # Switch servers if needed
91 # cvs keeps the server info in th CVS/Root file in every checked-out dir;
92 # we can fix those files to point to the new server
93 newserver=":pserver:anonymous@${ECVS_SERVER}"
94 oldserver="`cat CVS/Root`"
95 if [ "$newserver" != "$oldserver" ]; then
96
97 einfo "Changing CVS server from $oldserver to $newserver:"
98 debug-print "$FUNCNAME: Changing CVS server from $oldserver to $newserver:"
99
100 einfo "Searching for CVS dirs..."
101 cvsdirs="`find . -iname CVS -print`"
102 debug-print "$FUNCNAME: CVS dirs found:"
103 debug-print "$cvsdirs"
104
105 einfo "Modifying CVS dirs..."
106 for x in $cvsdirs; do
107 debug-print "In $x"
108 echo $newserver > $x/Root
109 done
110
111 fi
112
113 debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND update with $ECVS_SERVER for module $ECVS_MODULE"
114 einfo "Running $ECVS_CVS_COMMAND update with $ECVS_SERVER for module $ECVS_MODULE..."
115 $ECVS_CVS_COMMAND update -dP || die "died running cvs update"
116
117 else
118 # checkout module
119
120 export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER}
121 debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE with $CVSROOT..."
122 einfo "Running $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE with $CVSROOT..."
123 $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE || die "died running cvs checkout"
124
125 fi
126
127 }
128
129 cvs_src_unpack() {
130
131 debug-print-function $FUNCNAME $*
132 cvs_fetch || die "died running cvs_fetch"
133
134 einfo "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..."
135 debug-print "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..."
136 # the reason this lives here and not in kde-source_src_unpack
137 # is that in the future after copying the sources we might need to
138 # delete them, so this has to be self-contained
139 cp -Rf ${ECVS_TOP_DIR}/${ECVS_MODULE} $WORKDIR
140
141 # typically for kde cvs, the admin subdir lives in the kde-common module
142 # which is also needed
143 if [ ! -d "${WORKDIR}/${ECVS_MODULE}/admin" ]; then
144 ECVS_MODULE="kde-common" cvs_fetch
145 einfo "Copying admin/ subdir from module kde-common, $ECVS_TOP_DIR..."
146 debug-print "Copying admin/ subdir from module kde-common, $ECVS_TOP_DIR..."
147 cp -Rf ${ECVS_TOP_DIR}/${ECVS_MODULE} $WORKDIR
148 fi
149
150 }
151
152 EXPORT_FUNCTIONS src_unpack

  ViewVC Help
Powered by ViewVC 1.1.20