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

Diff of /eclass/cvs.eclass

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

Revision 1.56 Revision 1.60
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.56 2005/07/06 20:20:03 agriffis Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.60 2005/09/21 23:19:08 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
29INHERITED="$INHERITED $ECLASS"
30 22
31# Users shouldn't change these settings! The ebuild/eclass inheriting 23# Users shouldn't change these settings! The ebuild/eclass inheriting
32# 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
33# KDE cvs ebuilds' settings, see the comments in kde-source.eclass. 25# KDE cvs ebuilds' settings, see the comments in kde-source.eclass.
34 26
156# --- end ebuild-configurable settings --- 148# --- end ebuild-configurable settings ---
157 149
158# add cvs to deps 150# add cvs to deps
159# ssh is used for ext auth 151# ssh is used for ext auth
160# sudo is used to run as a specified user 152# sudo is used to run as a specified user
161DEPEND="$DEPEND dev-util/cvs app-admin/sudo" 153DEPEND="dev-util/cvs app-admin/sudo"
162 154
163if [ "$ECVS_AUTH" == "ext" ]; then 155if [ "$ECVS_AUTH" == "ext" ]; then
164 #default to ssh 156 #default to ssh
165 [ -z "$CVS_RSH" ] && export SSH_RSH="ssh" 157 [ -z "$CVS_RSH" ] && export CVS_RSH="ssh"
166 if [ "$CVS_RSH" != "ssh" ]; then 158 if [ "$CVS_RSH" != "ssh" ]; then
167 die "Support for ext auth with clients other than ssh has not been implemented yet" 159 die "Support for ext auth with clients other than ssh has not been implemented yet"
168 fi 160 fi
169 DEPEND="$DEPEND net-misc/openssh" 161 DEPEND="${DEPEND} net-misc/openssh"
170fi 162fi
171 163
172# called from cvs_src_unpack 164# called from cvs_src_unpack
173cvs_fetch() { 165cvs_fetch() {
174 166
189 181
190 # Update variables that are modified by ebuild parameters, which 182 # Update variables that are modified by ebuild parameters, which
191 # should be effective every time cvs_fetch is called, and not just 183 # should be effective every time cvs_fetch is called, and not just
192 # every time cvs.eclass is inherited 184 # every time cvs.eclass is inherited
193 185
194
195 # Handle parameter for local (non-recursive) fetching 186 # Handle parameter for local (non-recursive) fetching
196 187
197 if [ -n "$ECVS_LOCAL" ]; then 188 if [ -n "$ECVS_LOCAL" ]; then
198 ECVS_UP_OPTS="$ECVS_UP_OPTS -l" 189 ECVS_UP_OPTS="$ECVS_UP_OPTS -l"
199 ECVS_CO_OPTS="$ECVS_CO_OPTS -l" 190 ECVS_CO_OPTS="$ECVS_CO_OPTS -l"
200 fi 191 fi
201 192
202 # Handle ECVS_BRANCH option 193 # Handle ECVS_BRANCH option
203 # 194 #
204 # Because CVS auto-switches branches, we just have to pass the 195 # Because CVS auto-switches branches, we just have to pass the
205 # correct -rBRANCH option when updating. 196 # correct -rBRANCH option when updating.
206 197
207 if [ -n "$ECVS_BRANCH" ]; then 198 if [ -n "$ECVS_BRANCH" ]; then
208 ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" 199 ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH"
339 eval $cmdlogin || die "cvs login command failed" 330 eval $cmdlogin || die "cvs login command failed"
340 if [ "${mode}" == "update" ]; then 331 if [ "${mode}" == "update" ]; then
341 einfo "Running $cmdupdate" 332 einfo "Running $cmdupdate"
342 eval $cmdupdate || die "cvs update command failed" 333 eval $cmdupdate || die "cvs update command failed"
343 elif [ "${mode}" == "checkout" ]; then 334 elif [ "${mode}" == "checkout" ]; then
344 einfo "Running $cmdcheckout" 335 einfo "Running $cmdcheckout"
345 eval $cmdcheckout|| die "cvs checkout command failed" 336 eval $cmdcheckout|| die "cvs checkout command failed"
346 fi 337 fi
347 elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then 338 elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then
348 339
349 # Hack to support SSH password authentication 340 # Hack to support SSH password authentication
414 echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \ 405 echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \
415 >> "${CVS_RSH}" 406 >> "${CVS_RSH}"
416 echo "os.execv('/usr/bin/ssh', newarglist)" \ 407 echo "os.execv('/usr/bin/ssh', newarglist)" \
417 >> "${CVS_RSH}" 408 >> "${CVS_RSH}"
418 409
419 chmod a+x "${CVS_RSH}" 410 chmod a+x "${CVS_RSH}"
420 411
421 # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS 412 # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS
422 # if DISPLAY is not set) 413 # if DISPLAY is not set)
423 414
424 [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY" 415 [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY"
425 export DISPLAY 416 export DISPLAY
426 417
427 # Create a dummy executable to echo $ECVS_PASS 418 # Create a dummy executable to echo $ECVS_PASS
428 419
429 export SSH_ASKPASS="${T}/cvs_sshechopass" 420 export SSH_ASKPASS="${T}/cvs_sshechopass"
430 if [ "${ECVS_AUTH}" != "no" ]; then 421 if [ "${ECVS_AUTH}" != "no" ]; then
431 echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ 422 echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \
432 > "${SSH_ASKPASS}" 423 > "${SSH_ASKPASS}"
433 else 424 else
434 echo -en "#!/bin/bash\nreturn\n" \ 425 echo -en "#!/bin/bash\nreturn\n" \
435 > "${SSH_ASKPASS}" 426 > "${SSH_ASKPASS}"
436 427
437 fi 428 fi
438 chmod a+x "${SSH_ASKPASS}" 429 chmod a+x "${SSH_ASKPASS}"
439 fi 430 fi
440 431
441 if [ "${mode}" == "update" ]; then 432 if [ "${mode}" == "update" ]; then
442 einfo "Running $cmdupdate" 433 einfo "Running $cmdupdate"
443 eval $cmdupdate || die "cvs update command failed" 434 eval $cmdupdate || die "cvs update command failed"
444 elif [ "${mode}" == "checkout" ]; then 435 elif [ "${mode}" == "checkout" ]; then
445 einfo "Running $cmdcheckout" 436 einfo "Running $cmdcheckout"
446 eval $cmdcheckout|| die "cvs checkout command failed" 437 eval $cmdcheckout|| die "cvs checkout command failed"
447 fi 438 fi
448 439
449 # Restore environment variable values 440 # Restore environment variable values
450 export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}" 441 export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}"
451 if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then 442 if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then
452 export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}" 443 export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}"
453 else 444 else
535 # Implement some of base_src_unpack's functionality; note however 526 # Implement some of base_src_unpack's functionality; note however
536 # that base.eclass may not have been inherited! 527 # that base.eclass may not have been inherited!
537 if [ -n "$PATCHES" ]; then 528 if [ -n "$PATCHES" ]; then
538 debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching" 529 debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching"
539 cd "$S" 530 cd "$S"
540 for x in $PATCHES; do 531 epatch ${PATCHES}
541 debug-print "patching from $x"
542 patch -p0 < "$x"
543 done
544 # Make sure we don't try to apply patches more than once, 532 # Make sure we don't try to apply patches more than once,
545 # since cvs_src_unpack is usually called several times from 533 # since cvs_src_unpack is usually called several times from
546 # e.g. kde-source_src_unpack 534 # e.g. kde-source_src_unpack
547 export PATCHES="" 535 export PATCHES=""
548 fi 536 fi
549 537
550 einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}" 538 einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}"
551} 539}
552 540
553EXPORT_FUNCTIONS src_unpack 541EXPORT_FUNCTIONS src_unpack

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

  ViewVC Help
Powered by ViewVC 1.1.20