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

Diff of /eclass/cvs.eclass

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

Revision 1.22 Revision 1.23
1# Copyright 1999-2000 Gentoo Technologies, Inc. 1# Copyright 1999-2000 Gentoo Technologies, Inc.
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# Author Dan Armak <danarmak@gentoo.org> 3# Author Dan Armak <danarmak@gentoo.org>
4# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.22 2002/10/25 19:55:52 vapier Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.23 2002/11/01 10:54:42 danarmak Exp $
5# This eclass provides the generic cvs fetching functions. 5# This eclass provides the generic cvs fetching functions.
6 6
7ECLASS=cvs 7ECLASS=cvs
8INHERITED="$INHERITED $ECLASS" 8INHERITED="$INHERITED $ECLASS"
9 9
34# parts of the full CVSROOT (which looks like 34# parts of the full CVSROOT (which looks like
35# ":pserver:anonymous@anoncvs.kde.org:/home/kde"); these are added from 35# ":pserver:anonymous@anoncvs.kde.org:/home/kde"); these are added from
36# other settings 36# other settings
37[ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline" 37[ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline"
38 38
39# Anonymous cvs login?
40# if 'yes' uses :pserver: with empty password, if 'no' uses :ext: with $ECVS_PASS, other values not allowed
41[ -z "$ECVS_ANON" ] && ECVS_ANON="yes"
42
39# Username to use 43# Username to use
40[ -z "$ECVS_USER" ] && ECVS_USER="anonymous" 44[ -z "$ECVS_USER" ] && ECVS_USER="anonymous"
41 45
42# Password to use (NOT (YET) SUPPORTED, because cvs doesn't store passwords in plaintext in .cvspass) 46# Password to use if anonymous login is off
43[ -z "$ECVS_PASS" ] && ECVS_PASS="" 47[ -z "$ECVS_PASS" ] && ECVS_PASS=""
44 48
45# Module to be fetched, must be set explicitly - 49# Module to be fetched, must be set explicitly -
46# I don't like the former ="$PN" default setting 50# I don't like the former ="$PN" default setting
47[ -z "$ECVS_MODULE" ] && debug-print "$ECLASS: error: ECVS_MODULE not set, cannot continue" 51[ -z "$ECVS_MODULE" ] && debug-print "$ECLASS: error: ECVS_MODULE not set, cannot continue"
56#[ -z "$ECVS_SUBDIR" ] && ECVS_SUBDIR="" 60#[ -z "$ECVS_SUBDIR" ] && ECVS_SUBDIR=""
57 61
58# --- end ebuild-configurable settings --- 62# --- end ebuild-configurable settings ---
59 63
60# add cvs to deps 64# add cvs to deps
61DEPEND="$DEPEND dev-util/cvs" 65DEPEND="$DEPEND dev-util/cvs dev-python/pexpect"
62 66
63# since we now longer have src_fetch as a redefinable ebuild function, 67# since we now longer have src_fetch as a redefinable ebuild function,
64# we are forced to call this function from cvs_src_unpack 68# we are forced to call this function from cvs_src_unpack
65cvs_fetch() { 69cvs_fetch() {
66 70
69 debug-print "$FUNCNAME: init: 73 debug-print "$FUNCNAME: init:
70ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND 74ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND
71ECVS_CVS_OPTIONS=$ECVS_CVS_OPTIONS 75ECVS_CVS_OPTIONS=$ECVS_CVS_OPTIONS
72ECVS_TOP_DIR=$ECVS_TOP_DIR 76ECVS_TOP_DIR=$ECVS_TOP_DIR
73ECVS_SERVER=$ECVS_SERVER 77ECVS_SERVER=$ECVS_SERVER
78ECVS_ANON=$ECVS_ANON
74ECVS_USER=$ECVS_USER 79ECVS_USER=$ECVS_USER
75ECVS_PASS=$ECVS_PASS 80ECVS_PASS=$ECVS_PASS
76ECS_MODULE=$ECVS_MODULE 81ECS_MODULE=$ECVS_MODULE
77ECVS_SUBDIR=$ECVS_SUBDIR 82ECVS_SUBDIR=$ECVS_SUBDIR
78ECVS_LOCAL=$ECVS_LOCAL 83ECVS_LOCAL=$ECVS_LOCAL
128 133
129 # Note: cvs update and checkout commands are unified. 134 # Note: cvs update and checkout commands are unified.
130 # we make sure a CVS/ dir exists in our module subdir with the right 135 # we make sure a CVS/ dir exists in our module subdir with the right
131 # Root and Repository entries in it and cvs update. 136 # Root and Repository entries in it and cvs update.
132 137
138 [ "${ECVS_ANON}" == "yes" ] && \
133 newserver=":pserver:${ECVS_USER}@${ECVS_SERVER}" 139 newserver=":pserver:${ECVS_USER}@${ECVS_SERVER}" || \
140 newserver=":ext:${ECVS_USER}@${ECVS_SERVER}"
141
134 142
135 # CVS/Repository files can't (I think) contain two concatenated slashes 143 # CVS/Repository files can't (I think) contain two concatenated slashes
136 if [ -n "$ECVS_SUBDIR" ]; then 144 if [ -n "$ECVS_SUBDIR" ]; then
137 repository="${ECVS_MODULE}/${ECVS_SUBDIR}" 145 repository="${ECVS_MODULE}/${ECVS_SUBDIR}"
138 else 146 else
195 203
196 # finally run the cvs update command 204 # finally run the cvs update command
197 debug-print "$FUNCNAME: is in dir `/bin/pwd`" 205 debug-print "$FUNCNAME: is in dir `/bin/pwd`"
198 debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS with $ECVS_SERVER for module $ECVS_MODULE subdir $ECVS_SUBDIR" 206 debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS with $ECVS_SERVER for module $ECVS_MODULE subdir $ECVS_SUBDIR"
199 einfo "Running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS with $ECVS_SERVER for $ECVS_MODULE/$ECVS_SUBDIR..." 207 einfo "Running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS with $ECVS_SERVER for $ECVS_MODULE/$ECVS_SUBDIR..."
208
209 if [ "${ECVS_ANON}" == "no" ]; then
210
211 debug-print "$FUNCNAME: starting non-anonymous cvs login..."
212 # CVS Login - written in python :: the right way ;)
213 # Tilman Klar, <phoenix@gentoo.org>
214
215 export CVS_RSH="/usr/bin/ssh"
216
217############################## inline-python #####################################
218/usr/bin/env python << EndOfFile
219
220import pexpect,os
221
222mypasswd = "${ECVS_PASS}"
223mytimeout = 10
224
225mycommand = "${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}"
226child = pexpect.spawn(mycommand)
227
228index = child.expect(['continue connecting','word:'], mytimeout)
229if index == 0:
230 child.sendline('yes')
231 ## Added server to ~/.ssh/known_hosts
232 child.expect('word:', mytimeout)
233else:
234 ## Server already is in ~/.ssh/known_hosts
235 pass
236
237child.sendline(mypasswd)
238child.expect(pexpect.EOF)
239
240EndOfFile
241########################### End of inline-python ##################################
242 else
243 debug-print "$FUNCNAME: using anonymous cvs login"
200 $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update" 244 $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update"
245 fi
246
247
201 248
202} 249}
203 250
204cvs_src_unpack() { 251cvs_src_unpack() {
205 252

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.20