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

Diff of /eclass/cvs.eclass

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

Revision 1.55 Revision 1.61
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.55 2005/01/13 04:57:35 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.61 2005/09/21 23:22:56 vapier Exp $
4 4
5# Current Maintainer: Tal Peer <coredumb@gentoo.org> 5inherit eutils
6# Original Author: Dan Armak <danarmak@gentoo.org>
7
8# SSH auth code by Danny <danny.milo@gmx.net>
9
10# SSH password authentication support and host key verification
11# support by Jeremy Maitin-Shepard <jbms@gentoo.org>
12
13 6
14# This eclass provides the generic cvs fetching functions. To use 7# This eclass provides the generic cvs fetching functions. To use
15# this from an ebuild, set the `ebuild-configurable settings' as 8# this from an ebuild, set the `ebuild-configurable settings' as
16# specified below in your ebuild before inheriting. Then either leave 9# specified below in your ebuild before inheriting. Then either leave
17# the default src_unpack or extend over cvs_src_unpack. If you find 10# the default src_unpack or extend over cvs_src_unpack. If you find
24 17
25# Support additional remote shells with `ext' authentication (does 18# Support additional remote shells with `ext' authentication (does
26# anyone actually need to use it with anything other than SSH?) 19# anyone actually need to use it with anything other than SSH?)
27 20
28 21
29ECLASS=cvs
30INHERITED="$INHERITED $ECLASS"
31 22
32# Users shouldn't change these settings! The ebuild/eclass inheriting 23# 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 24# 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. 25# KDE cvs ebuilds' settings, see the comments in kde-source.eclass.
35 26
157# --- end ebuild-configurable settings --- 148# --- end ebuild-configurable settings ---
158 149
159# add cvs to deps 150# add cvs to deps
160# ssh is used for ext auth 151# ssh is used for ext auth
161# sudo is used to run as a specified user 152# sudo is used to run as a specified user
162DEPEND="$DEPEND dev-util/cvs app-admin/sudo" 153DEPEND="dev-util/cvs"
154
155[ -n "$ECVS_RUNAS" ] && DEPEND="$DEPEND app-admin/sudo"
163 156
164if [ "$ECVS_AUTH" == "ext" ]; then 157if [ "$ECVS_AUTH" == "ext" ]; then
165 #default to ssh 158 #default to ssh
166 [ -z "$CVS_RSH" ] && export SSH_RSH="ssh" 159 [ -z "$CVS_RSH" ] && export CVS_RSH="ssh"
167 if [ "$CVS_RSH" != "ssh" ]; then 160 if [ "$CVS_RSH" != "ssh" ]; then
168 die "Support for ext auth with clients other than ssh has not been implemented yet" 161 die "Support for ext auth with clients other than ssh has not been implemented yet"
169 fi 162 fi
170 DEPEND="$DEPEND net-misc/openssh" 163 DEPEND="${DEPEND} net-misc/openssh"
171fi 164fi
172 165
173# called from cvs_src_unpack 166# called from cvs_src_unpack
174cvs_fetch() { 167cvs_fetch() {
175 168
190 183
191 # Update variables that are modified by ebuild parameters, which 184 # Update variables that are modified by ebuild parameters, which
192 # should be effective every time cvs_fetch is called, and not just 185 # should be effective every time cvs_fetch is called, and not just
193 # every time cvs.eclass is inherited 186 # every time cvs.eclass is inherited
194 187
195
196 # Handle parameter for local (non-recursive) fetching 188 # Handle parameter for local (non-recursive) fetching
197 189
198 if [ -n "$ECVS_LOCAL" ]; then 190 if [ -n "$ECVS_LOCAL" ]; then
199 ECVS_UP_OPTS="$ECVS_UP_OPTS -l" 191 ECVS_UP_OPTS="$ECVS_UP_OPTS -l"
200 ECVS_CO_OPTS="$ECVS_CO_OPTS -l" 192 ECVS_CO_OPTS="$ECVS_CO_OPTS -l"
201 fi 193 fi
202 194
203 # Handle ECVS_BRANCH option 195 # Handle ECVS_BRANCH option
204 # 196 #
205 # Because CVS auto-switches branches, we just have to pass the 197 # Because CVS auto-switches branches, we just have to pass the
206 # correct -rBRANCH option when updating. 198 # correct -rBRANCH option when updating.
207 199
208 if [ -n "$ECVS_BRANCH" ]; then 200 if [ -n "$ECVS_BRANCH" ]; then
209 ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" 201 ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH"
340 eval $cmdlogin || die "cvs login command failed" 332 eval $cmdlogin || die "cvs login command failed"
341 if [ "${mode}" == "update" ]; then 333 if [ "${mode}" == "update" ]; then
342 einfo "Running $cmdupdate" 334 einfo "Running $cmdupdate"
343 eval $cmdupdate || die "cvs update command failed" 335 eval $cmdupdate || die "cvs update command failed"
344 elif [ "${mode}" == "checkout" ]; then 336 elif [ "${mode}" == "checkout" ]; then
345 einfo "Running $cmdcheckout" 337 einfo "Running $cmdcheckout"
346 eval $cmdcheckout|| die "cvs checkout command failed" 338 eval $cmdcheckout|| die "cvs checkout command failed"
347 fi 339 fi
348 elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then 340 elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then
349 341
350 # Hack to support SSH password authentication 342 # Hack to support SSH password authentication
415 echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \ 407 echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \
416 >> "${CVS_RSH}" 408 >> "${CVS_RSH}"
417 echo "os.execv('/usr/bin/ssh', newarglist)" \ 409 echo "os.execv('/usr/bin/ssh', newarglist)" \
418 >> "${CVS_RSH}" 410 >> "${CVS_RSH}"
419 411
420 chmod a+x "${CVS_RSH}" 412 chmod a+x "${CVS_RSH}"
421 413
422 # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS 414 # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS
423 # if DISPLAY is not set) 415 # if DISPLAY is not set)
424 416
425 [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY" 417 [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY"
426 export DISPLAY 418 export DISPLAY
427 419
428 # Create a dummy executable to echo $ECVS_PASS 420 # Create a dummy executable to echo $ECVS_PASS
429 421
430 export SSH_ASKPASS="${T}/cvs_sshechopass" 422 export SSH_ASKPASS="${T}/cvs_sshechopass"
431 if [ "${ECVS_AUTH}" != "no" ]; then 423 if [ "${ECVS_AUTH}" != "no" ]; then
432 echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ 424 echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \
433 > "${SSH_ASKPASS}" 425 > "${SSH_ASKPASS}"
434 else 426 else
435 echo -en "#!/bin/bash\nreturn\n" \ 427 echo -en "#!/bin/bash\nreturn\n" \
436 > "${SSH_ASKPASS}" 428 > "${SSH_ASKPASS}"
437 429
438 fi 430 fi
439 chmod a+x "${SSH_ASKPASS}" 431 chmod a+x "${SSH_ASKPASS}"
440 fi 432 fi
441 433
442 if [ "${mode}" == "update" ]; then 434 if [ "${mode}" == "update" ]; then
443 einfo "Running $cmdupdate" 435 einfo "Running $cmdupdate"
444 eval $cmdupdate || die "cvs update command failed" 436 eval $cmdupdate || die "cvs update command failed"
445 elif [ "${mode}" == "checkout" ]; then 437 elif [ "${mode}" == "checkout" ]; then
446 einfo "Running $cmdcheckout" 438 einfo "Running $cmdcheckout"
447 eval $cmdcheckout|| die "cvs checkout command failed" 439 eval $cmdcheckout|| die "cvs checkout command failed"
448 fi 440 fi
449 441
450 # Restore environment variable values 442 # Restore environment variable values
451 export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}" 443 export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}"
452 if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then 444 if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then
453 export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}" 445 export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}"
454 else 446 else
536 # Implement some of base_src_unpack's functionality; note however 528 # Implement some of base_src_unpack's functionality; note however
537 # that base.eclass may not have been inherited! 529 # that base.eclass may not have been inherited!
538 if [ -n "$PATCHES" ]; then 530 if [ -n "$PATCHES" ]; then
539 debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching" 531 debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching"
540 cd "$S" 532 cd "$S"
541 for x in $PATCHES; do 533 epatch ${PATCHES}
542 debug-print "patching from $x"
543 patch -p0 < "$x"
544 done
545 # Make sure we don't try to apply patches more than once, 534 # Make sure we don't try to apply patches more than once,
546 # since cvs_src_unpack is usually called several times from 535 # since cvs_src_unpack is usually called several times from
547 # e.g. kde-source_src_unpack 536 # e.g. kde-source_src_unpack
548 export PATCHES="" 537 export PATCHES=""
549 fi 538 fi
550 539
551 einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}" 540 einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}"
552} 541}
553 542
554EXPORT_FUNCTIONS src_unpack 543EXPORT_FUNCTIONS src_unpack

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.61

  ViewVC Help
Powered by ViewVC 1.1.20