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

Diff of /eclass/cvs.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.45 Revision 1.46
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.45 2003/07/20 05:23:17 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.46 2003/08/07 02:58:18 vapier Exp $
4# 4#
5# Author Dan Armak <danarmak@gentoo.org> 5# Author Dan Armak <danarmak@gentoo.org>
6# 6#
7# This eclass provides the generic cvs fetching functions. 7# This eclass provides the generic cvs fetching functions.
8# to use from an ebuild, set the 'ebuild-configurable settings' below in your ebuild before inheriting. 8# to use from an ebuild, set the 'ebuild-configurable settings' below in your ebuild before inheriting.
160 # switch servers automagically if needed 160 # switch servers automagically if needed
161 if [ "$mode" == "update" ]; then 161 if [ "$mode" == "update" ]; then
162 cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME 162 cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME
163 oldserver="`$run cat CVS/Root`" 163 oldserver="`$run cat CVS/Root`"
164 if [ "$server" != "$oldserver" ]; then 164 if [ "$server" != "$oldserver" ]; then
165
166 einfo "Changing CVS server from $oldserver to $server:" 165 einfo "Changing CVS server from $oldserver to $server:"
167 debug-print "$FUNCNAME: Changing CVS server from $oldserver to $server:" 166 debug-print "$FUNCNAME: Changing CVS server from $oldserver to $server:"
168 167
169 einfo "Searching for CVS dirs..." 168 einfo "Searching for CVS dirs ..."
170 cvsdirs="`$run find . -iname CVS -print`" 169 cvsdirs="`$run find . -iname CVS -print`"
171 debug-print "$FUNCNAME: CVS dirs found:" 170 debug-print "$FUNCNAME: CVS dirs found:"
172 debug-print "$cvsdirs" 171 debug-print "$cvsdirs"
173 172
174 einfo "Modifying CVS dirs..." 173 einfo "Modifying CVS dirs ..."
175 for x in $cvsdirs; do 174 for x in $cvsdirs; do
176 debug-print "In $x" 175 debug-print "In $x"
177 $run echo "$server" > "$x/Root" 176 $run echo "$server" > "$x/Root"
178 done 177 done
179
180 fi 178 fi
181 fi 179 fi
182 180
183 # prepare a cvspass file just for this session, we don't want to mess with ~/.cvspass 181 # prepare a cvspass file just for this session, we don't want to mess with ~/.cvspass
184 touch "${T}/cvspass" 182 touch "${T}/cvspass"
192 # ditto without the password, for checkout/update after login, so that 190 # ditto without the password, for checkout/update after login, so that
193 # the CVS/Root files don't contain the password in plaintext 191 # the CVS/Root files don't contain the password in plaintext
194 cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" 192 cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
195 193
196 # commands to run 194 # commands to run
197 cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login" 195 cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\""
196 cmdlogin_opts="login"
198 cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}" 197 cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\""
198 cmdupdate_opts="update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}"
199 cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" 199 cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\""
200 cmdcheckout_opts="checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}"
200 201
201 cd "${ECVS_TOP_DIR}" 202 cd "${ECVS_TOP_DIR}"
202 if [ "${ECVS_AUTH}" == "pserver" ]; then 203 if [ "${ECVS_AUTH}" == "pserver" ]; then
204 debug-print "$FUNCNAME: logging into cvs ${cmdlogin} ${cmdlogin_opts}"
203 einfo "Running $cmdlogin" 205 einfo "Logging in: ${cmdlogin}"
204 eval $cmdlogin || die "cvs login command failed" 206 eval ${cmdlogin} ${cmdlogin_opts} >/dev/null || die "cvs login command failed"
205 if [ "${mode}" == "update" ]; then 207 if [ "${mode}" == "update" ]; then
206 einfo "Running $cmdupdate" 208 debug-print "$FUNCNAME: updating cvs tree ${cmdupdate} ${cmdupdate_opts}"
207 eval $cmdupdate || die "cvs update command failed" 209 einfo "Updating existing source tree: ${cmdupdate_opts}"
210 eval ${cmdupdate} ${cmdupdate_opts} || die "cvs update command failed"
208 elif [ "${mode}" == "checkout" ]; then 211 elif [ "${mode}" == "checkout" ]; then
209 einfo "Running $cmdcheckout" 212 debug-print "$FUNCNAME: checking out from cvs tree ${cmdcheckout} ${cmdcheckout_opts}"
210 eval $cmdcheckout|| die "cvs checkout command failed" 213 einfo "Checking out source tree (${cmdcheckout_opts})"
214 eval ${cmdcheckout} ${cmdcheckout_opts} || die "cvs checkout command failed"
211 fi 215 fi
212# elif [ "${ECVS_AUTH}" == "ext" ]; then 216# elif [ "${ECVS_AUTH}" == "ext" ]; then
213# # for ext there's also a possible ssh prompt, code not yet written 217# # for ext there's also a possible ssh prompt, code not yet written
214# echo "${ECVS_DELAY} continue connecting&yes" >> "$instruct" 218# echo "${ECVS_DELAY} continue connecting&yes" >> "$instruct"
215# echo "${ECVS_DELAY} CVS password:&${ECVS_PASS}" >> "$instruct" 219# echo "${ECVS_DELAY} CVS password:&${ECVS_PASS}" >> "$instruct"
222 226
223 # restore ownership. not sure why this is needed, but someone added it in the orig ECVS_RUNAS stuff. 227 # restore ownership. not sure why this is needed, but someone added it in the orig ECVS_RUNAS stuff.
224 if [ -n "$ECVS_RUNAS" ]; then 228 if [ -n "$ECVS_RUNAS" ]; then
225 chown `whoami` "${T}/cvspass" 229 chown `whoami` "${T}/cvspass"
226 fi 230 fi
227
228} 231}
229 232
230 233
231cvs_src_unpack() { 234cvs_src_unpack() {
232
233 debug-print-function $FUNCNAME $* 235 debug-print-function $FUNCNAME $*
234 236
235 debug-print "$FUNCNAME: init: 237 debug-print "$FUNCNAME: init:
236ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND 238ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND
237ECVS_UP_OPTS=$ECVS_UP_OPTS 239ECVS_UP_OPTS=$ECVS_UP_OPTS
251 # more than once per ebuild (eg kdenonbeta submodules); so if we set a default value, 253 # more than once per ebuild (eg kdenonbeta submodules); so if we set a default value,
252 # we disable it again at the function's end. 254 # we disable it again at the function's end.
253 # of course, we could instead always reference it with the bash syntax for 'take default 255 # of course, we could instead always reference it with the bash syntax for 'take default
254 # value from this other variable if undefined', but i'm lazy. 256 # value from this other variable if undefined', but i'm lazy.
255 if [ -z "$ECVS_LOCALNAME" ]; then 257 if [ -z "$ECVS_LOCALNAME" ]; then
256 ECVS_LOCALNAME="$ECVS_MODULE" 258 ECVS_LOCALNAME="$ECVS_MODULE"
257 ECVS_LOCALNAME_SETDEFAULT=true 259 ECVS_LOCALNAME_SETDEFAULT=true
258 fi 260 fi
259
260 261
261 if [ "$ECVS_SERVER" == "offline" ]; then 262 if [ "$ECVS_SERVER" == "offline" ]; then
262 # we're not required to fetch anything, the module already exists and shouldn't be updated 263 # we're not required to fetch anything, the module already exists and shouldn't be updated
263 if [ -d "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" ]; then 264 if [ -d "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" ]; then
264 debug-print "$FUNCNAME: offline mode" 265 debug-print "$FUNCNAME: offline mode"
265 else 266 else
266 debug-print "$FUNCNAME: offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error" 267 debug-print "$FUNCNAME: offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error"
267 die "ERROR: Offline mode specified, but dir ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting." 268 die "ERROR: Offline mode specified, but dir ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting."
268 fi 269 fi
269 elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode 270 elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode
270 einfo "Fetching cvs module $ECVS_MODULE into $ECVS_TOP_DIR..." 271 einfo "Fetching module '$ECVS_MODULE' and saving in $ECVS_TOP_DIR ..."
271 cvs_fetch 272 cvs_fetch
272 else # ECVS_SERVER not set 273 else # ECVS_SERVER not set
273 die "ERROR: CVS server not set, cannot continue." 274 die "ERROR: CVS server not set, cannot continue."
274 fi 275 fi
275 276
276 einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR..." 277 einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR ..."
277 debug-print "Copying module $ECVS_MODULE local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR..." 278 debug-print "Copying module $ECVS_MODULE local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR ..."
278 279
279 # probably redundant, but best to make sure 280 # probably redundant, but best to make sure
280 mkdir -p "$WORKDIR/$ECVS_LOCALNAME" 281 mkdir -p "$WORKDIR/$ECVS_LOCALNAME"
281 282
282 if [ -n "$ECVS_LOCAL" ]; then 283 if [ -n "$ECVS_LOCAL" ]; then
310 if [ -n "$ECVS_LOCALNAME_SETDEFAULT" ]; then 311 if [ -n "$ECVS_LOCALNAME_SETDEFAULT" ]; then
311 unset ECVS_LOCALNAME 312 unset ECVS_LOCALNAME
312 unset ECVS_LOCALNAME_SETDEFAULT 313 unset ECVS_LOCALNAME_SETDEFAULT
313 fi 314 fi
314 315
315 einfo "Source now in ${WORKDIR}" 316 einfo "Module $ECVS_MODULE is now in ${WORKDIR}"
316} 317}
317 318
318EXPORT_FUNCTIONS src_unpack 319EXPORT_FUNCTIONS src_unpack

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

  ViewVC Help
Powered by ViewVC 1.1.20