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

Diff of /eclass/cvs.eclass

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

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

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

  ViewVC Help
Powered by ViewVC 1.1.20