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

Diff of /eclass/cvs.eclass

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

Revision 1.53 Revision 1.59
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.53 2004/10/19 19:51:12 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.59 2005/08/13 08:10:53 phreak 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"
31 29
32# Users shouldn't change these settings! The ebuild/eclass inheriting 30# 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 31# 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. 32# KDE cvs ebuilds' settings, see the comments in kde-source.eclass.
35 33
73# ECVS_TOP_DIR -- The directory under which CVS modules are checked 71# ECVS_TOP_DIR -- The directory under which CVS modules are checked
74# out. 72# out.
75 73
76[ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="${DISTDIR}/cvs-src" 74[ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="${DISTDIR}/cvs-src"
77 75
78# ECVS_NAME -- CVS path 76# ECVS_SERVER -- CVS path
79# 77#
80# The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde". 78# 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 79# Remove the other parts of the full CVSROOT, which might look like
82# ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated 80# ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated
83# using other settings also. 81# using other settings also.
157# --- end ebuild-configurable settings --- 155# --- end ebuild-configurable settings ---
158 156
159# add cvs to deps 157# add cvs to deps
160# ssh is used for ext auth 158# ssh is used for ext auth
161# sudo is used to run as a specified user 159# sudo is used to run as a specified user
162DEPEND="$DEPEND dev-util/cvs app-admin/sudo" 160DEPEND="dev-util/cvs app-admin/sudo"
163 161
164if [ "$ECVS_AUTH" == "ext" ]; then 162if [ "$ECVS_AUTH" == "ext" ]; then
165 #default to ssh 163 #default to ssh
166 [ -z "$CVS_RSH" ] && export SSH_RSH="ssh" 164 [ -z "$CVS_RSH" ] && export CVS_RSH="ssh"
167 if [ "$CVS_RSH" != "ssh" ]; then 165 if [ "$CVS_RSH" != "ssh" ]; then
168 die "Support for ext auth with clients other than ssh has not been implemented yet" 166 die "Support for ext auth with clients other than ssh has not been implemented yet"
169 fi 167 fi
170 DEPEND="$DEPEND net-misc/openssh" 168 DEPEND="${DEPEND} net-misc/openssh"
171fi 169fi
172 170
173# called from cvs_src_unpack 171# called from cvs_src_unpack
174cvs_fetch() { 172cvs_fetch() {
175 173
190 188
191 # Update variables that are modified by ebuild parameters, which 189 # Update variables that are modified by ebuild parameters, which
192 # should be effective every time cvs_fetch is called, and not just 190 # should be effective every time cvs_fetch is called, and not just
193 # every time cvs.eclass is inherited 191 # every time cvs.eclass is inherited
194 192
195
196 # Handle parameter for local (non-recursive) fetching 193 # Handle parameter for local (non-recursive) fetching
197 194
198 if [ -n "$ECVS_LOCAL" ]; then 195 if [ -n "$ECVS_LOCAL" ]; then
199 ECVS_UP_OPTS="$ECVS_UP_OPTS -l" 196 ECVS_UP_OPTS="$ECVS_UP_OPTS -l"
200 ECVS_CO_OPTS="$ECVS_CO_OPTS -l" 197 ECVS_CO_OPTS="$ECVS_CO_OPTS -l"
201 fi 198 fi
202 199
203 # Handle ECVS_BRANCH option 200 # Handle ECVS_BRANCH option
204 # 201 #
205 # Because CVS auto-switches branches, we just have to pass the 202 # Because CVS auto-switches branches, we just have to pass the
206 # correct -rBRANCH option when updating. 203 # correct -rBRANCH option when updating.
207 204
208 if [ -n "$ECVS_BRANCH" ]; then 205 if [ -n "$ECVS_BRANCH" ]; then
209 ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" 206 ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH"
340 eval $cmdlogin || die "cvs login command failed" 337 eval $cmdlogin || die "cvs login command failed"
341 if [ "${mode}" == "update" ]; then 338 if [ "${mode}" == "update" ]; then
342 einfo "Running $cmdupdate" 339 einfo "Running $cmdupdate"
343 eval $cmdupdate || die "cvs update command failed" 340 eval $cmdupdate || die "cvs update command failed"
344 elif [ "${mode}" == "checkout" ]; then 341 elif [ "${mode}" == "checkout" ]; then
345 einfo "Running $cmdcheckout" 342 einfo "Running $cmdcheckout"
346 eval $cmdcheckout|| die "cvs checkout command failed" 343 eval $cmdcheckout|| die "cvs checkout command failed"
347 fi 344 fi
348 elif [ "${ECVS_AUTH}" == "ext" ]; then 345 elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then
349 346
350 # Hack to support SSH password authentication 347 # Hack to support SSH password authentication
351 348
352 # Backup environment variable values 349 # Backup environment variable values
353 local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}" 350 local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}"
385except: 382except:
386 pass 383 pass
387newarglist = sys.argv[:] 384newarglist = sys.argv[:]
388EOF 385EOF
389 386
387 # disable X11 forwarding which causes .xauth access violations
388 # - 20041205 Armando Di Cianno <fafhrd@gentoo.org>
389 echo "newarglist.insert(1, '-oClearAllForwardings=yes')" \
390 >> "${CVS_RSH}"
391 echo "newarglist.insert(1, '-oForwardX11=no')" \
392 >> "${CVS_RSH}"
393
390 # Handle SSH host key checking 394 # Handle SSH host key checking
391 395
392 local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts" 396 local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts"
393 echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \ 397 echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \
394 >> "${CVS_RSH}" 398 >> "${CVS_RSH}"
396 if [ -z "${ECVS_SSH_HOST_KEY}" ]; then 400 if [ -z "${ECVS_SSH_HOST_KEY}" ]; then
397 ewarn "Warning: The SSH host key of the remote server will not be verified." 401 ewarn "Warning: The SSH host key of the remote server will not be verified."
398 einfo "A temporary known hosts list will be used." 402 einfo "A temporary known hosts list will be used."
399 local CVS_ECLASS_STRICT_HOST_CHECKING="no" 403 local CVS_ECLASS_STRICT_HOST_CHECKING="no"
400 touch "${CVS_ECLASS_KNOWN_HOSTS}" 404 touch "${CVS_ECLASS_KNOWN_HOSTS}"
401 echo "newarglist.insert(1, '-oStrictHostKeyChecking=no')" \
402 >> "${CVS_RSH}"
403 else 405 else
404 local CVS_ECLASS_STRICT_HOST_CHECKING="yes" 406 local CVS_ECLASS_STRICT_HOST_CHECKING="yes"
405 echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}" 407 echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}"
406 fi 408 fi
407 409
410 echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \ 412 echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \
411 >> "${CVS_RSH}" 413 >> "${CVS_RSH}"
412 echo "os.execv('/usr/bin/ssh', newarglist)" \ 414 echo "os.execv('/usr/bin/ssh', newarglist)" \
413 >> "${CVS_RSH}" 415 >> "${CVS_RSH}"
414 416
415 chmod a+x "${CVS_RSH}" 417 chmod a+x "${CVS_RSH}"
416 418
417 # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS 419 # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS
418 # if DISPLAY is not set) 420 # if DISPLAY is not set)
419 421
420 [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY" 422 [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY"
421 export DISPLAY 423 export DISPLAY
422 424
423 # Create a dummy executable to echo $ECVS_PASS 425 # Create a dummy executable to echo $ECVS_PASS
424 426
425 export SSH_ASKPASS="${T}/cvs_sshechopass" 427 export SSH_ASKPASS="${T}/cvs_sshechopass"
426 428 if [ "${ECVS_AUTH}" != "no" ]; then
427 echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ 429 echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \
428 > "${SSH_ASKPASS}" 430 > "${SSH_ASKPASS}"
431 else
432 echo -en "#!/bin/bash\nreturn\n" \
433 > "${SSH_ASKPASS}"
429 434
435 fi
430 chmod a+x "${SSH_ASKPASS}" 436 chmod a+x "${SSH_ASKPASS}"
431 fi 437 fi
432 438
433 if [ "${mode}" == "update" ]; then 439 if [ "${mode}" == "update" ]; then
434 einfo "Running $cmdupdate" 440 einfo "Running $cmdupdate"
435 eval $cmdupdate || die "cvs update command failed" 441 eval $cmdupdate || die "cvs update command failed"
436 elif [ "${mode}" == "checkout" ]; then 442 elif [ "${mode}" == "checkout" ]; then
437 einfo "Running $cmdcheckout" 443 einfo "Running $cmdcheckout"
438 eval $cmdcheckout|| die "cvs checkout command failed" 444 eval $cmdcheckout|| die "cvs checkout command failed"
439 fi 445 fi
440 446
441 # Restore environment variable values 447 # Restore environment variable values
442 export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}" 448 export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}"
443 if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then 449 if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then
444 export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}" 450 export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}"
445 else 451 else
448 454
449 if [ "${CVS_ECLASS_ORIG_DISPLAY+set}" == "set" ]; then 455 if [ "${CVS_ECLASS_ORIG_DISPLAY+set}" == "set" ]; then
450 export DISPLAY="${CVS_ECLASS_ORIG_DISPLAY}" 456 export DISPLAY="${CVS_ECLASS_ORIG_DISPLAY}"
451 else 457 else
452 unset DISPLAY 458 unset DISPLAY
453 fi
454 elif [ "${ECVS_AUTH}" == "no" ]; then
455 if [ "${mode}" == "update" ]; then
456 einfo "Running $cmdupdate"
457 eval $cmdupdate || die "cvs update command failed"
458 elif [ "${mode}" == "checkout" ]; then
459 einfo "Running $cmdcheckout"
460 eval $cmdcheckout|| die "cvs checkout command failed"
461 fi 459 fi
462 fi 460 fi
463 461
464 # Restore ownership. Not sure why this is needed, but someone 462 # Restore ownership. Not sure why this is needed, but someone
465 # added it in the orig ECVS_RUNAS stuff. 463 # added it in the orig ECVS_RUNAS stuff.
544 # Make sure we don't try to apply patches more than once, 542 # Make sure we don't try to apply patches more than once,
545 # since cvs_src_unpack is usually called several times from 543 # since cvs_src_unpack is usually called several times from
546 # e.g. kde-source_src_unpack 544 # e.g. kde-source_src_unpack
547 export PATCHES="" 545 export PATCHES=""
548 fi 546 fi
549 547
550 einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}" 548 einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}"
551} 549}
552 550
553EXPORT_FUNCTIONS src_unpack 551EXPORT_FUNCTIONS src_unpack

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.59

  ViewVC Help
Powered by ViewVC 1.1.20