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

Diff of /eclass/cvs.eclass

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

Revision 1.51 Revision 1.56
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
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.51 2004/06/25 00:39:48 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.56 2005/07/06 20:20:03 agriffis Exp $
4 4
5# Current Maintainer: Tal Peer <coredumb@gentoo.org> 5# Current Maintainer: Tal Peer <coredumb@gentoo.org>
6# Original Author: Dan Armak <danarmak@gentoo.org> 6# Original Author: Dan Armak <danarmak@gentoo.org>
7 7
8# SSH auth code by Danny <danny.milo@gmx.net> 8# SSH auth code by Danny <danny.milo@gmx.net>
24 24
25# Support additional remote shells with `ext' authentication (does 25# Support additional remote shells with `ext' authentication (does
26# anyone actually need to use it with anything other than SSH?) 26# anyone actually need to use it with anything other than SSH?)
27 27
28 28
29ECLASS=cvs
30INHERITED="$INHERITED $ECLASS" 29INHERITED="$INHERITED $ECLASS"
31 30
32# Users shouldn't change these settings! The ebuild/eclass inheriting 31# Users shouldn't change these settings! The ebuild/eclass inheriting
33# this eclass will take care of that. If you want to set the global 32# this eclass will take care of that. If you want to set the global
34# KDE cvs ebuilds' settings, see the comments in kde-source.eclass. 33# KDE cvs ebuilds' settings, see the comments in kde-source.eclass.
73# ECVS_TOP_DIR -- The directory under which CVS modules are checked 72# ECVS_TOP_DIR -- The directory under which CVS modules are checked
74# out. 73# out.
75 74
76[ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="${DISTDIR}/cvs-src" 75[ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="${DISTDIR}/cvs-src"
77 76
78# ECVS_NAME -- CVS path 77# ECVS_SERVER -- CVS path
79# 78#
80# The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde". 79# The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde".
81# Remove the other parts of the full CVSROOT, which might look like 80# Remove the other parts of the full CVSROOT, which might look like
82# ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated 81# ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated
83# using other settings also. 82# using other settings also.
108# 107#
109# Possible values are "pserver" and "ext". If `ext' authentication is 108# Possible values are "pserver" and "ext". If `ext' authentication is
110# used, the remote shell to use can be specified in CVS_RSH (SSH is 109# used, the remote shell to use can be specified in CVS_RSH (SSH is
111# used by default). Currently, the only supported remote shell for 110# used by default). Currently, the only supported remote shell for
112# `ext' authentication is SSH. 111# `ext' authentication is SSH.
112#
113# Armando Di Cianno <fafhrd@gentoo.org> 2004/09/27
114# - Added "no" as a server type, which uses no AUTH method, nor
115# does it login
116# e.g.
117# "cvs -danoncvs@savannah.gnu.org:/cvsroot/backbone co System"
118# ( from gnustep-apps/textedit )
113[ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" 119[ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver"
114 120
115# ECVS_USER -- Username to use for authentication on the remote server 121# ECVS_USER -- Username to use for authentication on the remote server
116[ -z "$ECVS_USER" ] && ECVS_USER="anonymous" 122[ -z "$ECVS_USER" ] && ECVS_USER="anonymous"
117 123
268 fi 274 fi
269 275
270 276
271 # Our server string (i.e. CVSROOT) without the password so it can 277 # Our server string (i.e. CVSROOT) without the password so it can
272 # be put in Root 278 # be put in Root
279 if [ "$ECVS_AUTH" == "no" ]
280 then
281 local server="${ECVS_USER}@${ECVS_SERVER}"
282 else
273 local server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" 283 local server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
284 fi
274 285
275 # Switch servers automagically if needed 286 # Switch servers automagically if needed
276 if [ "$mode" == "update" ]; then 287 if [ "$mode" == "update" ]; then
277 cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME 288 cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME
278 local oldserver="`$run cat CVS/Root`" 289 local oldserver="`$run cat CVS/Root`"
279 if [ "$server" != "$oldserver" ]; then 290 if [ "$server" != "$oldserver" ]; then
280 291
281 einfo "Changing the CVS server from $oldserver to $server:" 292 einfo "Changing the CVS server from $oldserver to $server:"
282 debug-print "$FUNCNAME: Changing the CVS server from $oldserver to $server:" 293 debug-print "$FUNCNAME: Changing the CVS server from $oldserver to $server:"
283 294
284 einfo "Searching for CVS directories..." 295 einfo "Searching for CVS directories ..."
285 local cvsdirs="`$run find . -iname CVS -print`" 296 local cvsdirs="`$run find . -iname CVS -print`"
286 debug-print "$FUNCNAME: CVS directories found:" 297 debug-print "$FUNCNAME: CVS directories found:"
287 debug-print "$cvsdirs" 298 debug-print "$cvsdirs"
288 299
289 einfo "Modifying CVS directories..." 300 einfo "Modifying CVS directories ..."
290 for x in $cvsdirs; do 301 for x in $cvsdirs; do
291 debug-print "In $x" 302 debug-print "In $x"
292 $run echo "$server" > "$x/Root" 303 $run echo "$server" > "$x/Root"
293 done 304 done
294 305
306 # The server string with the password in it, for login 317 # The server string with the password in it, for login
307 cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}" 318 cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
308 319
309 # Ditto without the password, for checkout/update after login, so 320 # Ditto without the password, for checkout/update after login, so
310 # that the CVS/Root files don't contain the password in plaintext 321 # that the CVS/Root files don't contain the password in plaintext
322 if [ "$ECVS_AUTH" == "no" ]
323 then
324 cvsroot_nopass="${ECVS_USER}@${ECVS_SERVER}"
325 else
311 cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" 326 cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
327 fi
312 328
313 # Commands to run 329 # Commands to run
314 cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login" 330 cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login"
315 cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}" 331 cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}"
316 cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" 332 cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}"
326 eval $cmdupdate || die "cvs update command failed" 342 eval $cmdupdate || die "cvs update command failed"
327 elif [ "${mode}" == "checkout" ]; then 343 elif [ "${mode}" == "checkout" ]; then
328 einfo "Running $cmdcheckout" 344 einfo "Running $cmdcheckout"
329 eval $cmdcheckout|| die "cvs checkout command failed" 345 eval $cmdcheckout|| die "cvs checkout command failed"
330 fi 346 fi
331 elif [ "${ECVS_AUTH}" == "ext" ]; then 347 elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then
332 348
333 # Hack to support SSH password authentication 349 # Hack to support SSH password authentication
334 350
335 # Backup environment variable values 351 # Backup environment variable values
336 local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}" 352 local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}"
368except: 384except:
369 pass 385 pass
370newarglist = sys.argv[:] 386newarglist = sys.argv[:]
371EOF 387EOF
372 388
389 # disable X11 forwarding which causes .xauth access violations
390 # - 20041205 Armando Di Cianno <fafhrd@gentoo.org>
391 echo "newarglist.insert(1, '-oClearAllForwardings=yes')" \
392 >> "${CVS_RSH}"
393 echo "newarglist.insert(1, '-oForwardX11=no')" \
394 >> "${CVS_RSH}"
395
373 # Handle SSH host key checking 396 # Handle SSH host key checking
374 397
375 local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts" 398 local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts"
376 echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \ 399 echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \
377 >> "${CVS_RSH}" 400 >> "${CVS_RSH}"
379 if [ -z "${ECVS_SSH_HOST_KEY}" ]; then 402 if [ -z "${ECVS_SSH_HOST_KEY}" ]; then
380 ewarn "Warning: The SSH host key of the remote server will not be verified." 403 ewarn "Warning: The SSH host key of the remote server will not be verified."
381 einfo "A temporary known hosts list will be used." 404 einfo "A temporary known hosts list will be used."
382 local CVS_ECLASS_STRICT_HOST_CHECKING="no" 405 local CVS_ECLASS_STRICT_HOST_CHECKING="no"
383 touch "${CVS_ECLASS_KNOWN_HOSTS}" 406 touch "${CVS_ECLASS_KNOWN_HOSTS}"
384 echo "newarglist.insert(1, '-oStrictHostKeyChecking=no')" \
385 >> "${CVS_RSH}"
386 else 407 else
387 local CVS_ECLASS_STRICT_HOST_CHECKING="yes" 408 local CVS_ECLASS_STRICT_HOST_CHECKING="yes"
388 echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}" 409 echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}"
389 fi 410 fi
390 411
404 export DISPLAY 425 export DISPLAY
405 426
406 # Create a dummy executable to echo $ECVS_PASS 427 # Create a dummy executable to echo $ECVS_PASS
407 428
408 export SSH_ASKPASS="${T}/cvs_sshechopass" 429 export SSH_ASKPASS="${T}/cvs_sshechopass"
409 430 if [ "${ECVS_AUTH}" != "no" ]; then
410 echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ 431 echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \
411 > "${SSH_ASKPASS}" 432 > "${SSH_ASKPASS}"
433 else
434 echo -en "#!/bin/bash\nreturn\n" \
435 > "${SSH_ASKPASS}"
412 436
437 fi
413 chmod a+x "${SSH_ASKPASS}" 438 chmod a+x "${SSH_ASKPASS}"
414 fi 439 fi
415 440
416 if [ "${mode}" == "update" ]; then 441 if [ "${mode}" == "update" ]; then
417 einfo "Running $cmdupdate" 442 einfo "Running $cmdupdate"
478 else 503 else
479 debug-print "$FUNCNAME: Offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error" 504 debug-print "$FUNCNAME: Offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error"
480 die "ERROR: Offline mode specified, but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting." 505 die "ERROR: Offline mode specified, but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting."
481 fi 506 fi
482 elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode 507 elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode
483 einfo "Fetching CVS module $ECVS_MODULE into $ECVS_TOP_DIR..." 508 einfo "Fetching CVS module $ECVS_MODULE into $ECVS_TOP_DIR ..."
484 cvs_fetch 509 cvs_fetch
485 else # ECVS_SERVER not set 510 else # ECVS_SERVER not set
486 die "ERROR: CVS server not specified, cannot continue." 511 die "ERROR: CVS server not specified, cannot continue."
487 fi 512 fi
488 513
489 einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR..." 514 einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR ..."
490 debug-print "Copying module $ECVS_MODULE local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR..." 515 debug-print "Copying module $ECVS_MODULE local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR ..."
491 516
492 # This is probably redundant, but best to make sure. 517 # This is probably redundant, but best to make sure.
493 mkdir -p "$WORKDIR/$ECVS_LOCALNAME" 518 mkdir -p "$WORKDIR/$ECVS_LOCALNAME"
494 519
495 if [ -n "$ECVS_LOCAL" ]; then 520 if [ -n "$ECVS_LOCAL" ]; then

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.56

  ViewVC Help
Powered by ViewVC 1.1.20