1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2003 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 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.32 2003/02/21 14:07:46 phoenix Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.33 2003/03/19 11:54:21 danarmak Exp $ |
4 | # |
4 | # |
5 | # Author Dan Armak <danarmak@gentoo.org> |
5 | # Author Dan Armak <danarmak@gentoo.org> |
6 | # |
6 | # |
7 | # This eclass provides the generic cvs fetching functions. |
7 | # This eclass provides the generic cvs fetching functions. |
8 | |
8 | |
… | |
… | |
78 | cvs_fetch() { |
78 | cvs_fetch() { |
79 | |
79 | |
80 | debug-print-function $FUNCNAME $* |
80 | debug-print-function $FUNCNAME $* |
81 | |
81 | |
82 | debug-print "$FUNCNAME: init: |
82 | debug-print "$FUNCNAME: init: |
83 | ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND |
83 | 9ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND |
84 | ECVS_CVS_OPTIONS=$ECVS_CVS_OPTIONS |
84 | ECVS_CVS_OPTIONS=$ECVS_CVS_OPTIONS |
85 | ECVS_TOP_DIR=$ECVS_TOP_DIR |
85 | ECVS_TOP_DIR=$ECVS_TOP_DIR |
86 | ECVS_SERVER=$ECVS_SERVER |
86 | ECVS_SERVER=$ECVS_SERVER |
87 | ECVS_ANON=$ECVS_ANON |
87 | ECVS_ANON=$ECVS_ANON |
88 | ECVS_USER=$ECVS_USER |
88 | ECVS_USER=$ECVS_USER |
… | |
… | |
132 | addwrite "$ECVS_TOP_DIR/$ECVS_MODULE" |
132 | addwrite "$ECVS_TOP_DIR/$ECVS_MODULE" |
133 | |
133 | |
134 | # add option for local (non-recursive) fetching |
134 | # add option for local (non-recursive) fetching |
135 | [ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l" |
135 | [ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l" |
136 | |
136 | |
137 | # prepare a cvspass file just for this session so that cvs thinks we're logged |
137 | # prepare a cvspass file just for this session, we don't want to mess with ~/.cvspass |
138 | # in at the cvs server. we don't want to mess with ~/.cvspass. |
138 | touch "${T}/cvspass" |
139 | echo ":pserver:${ECVS_SERVER} A" > "${T}/cvspass" |
|
|
140 | export CVS_PASSFILE="${T}/cvspass" |
139 | export CVS_PASSFILE="${T}/cvspass" |
141 | chown $ECVS_RUNAS "${T}/cvspass" |
140 | chown $ECVS_RUNAS "${T}/cvspass" |
142 | #export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER} |
141 | |
143 | |
|
|
144 | # Note: cvs update and checkout commands are unified. |
142 | # Note: cvs update and checkout commands are unified. |
145 | # we make sure a CVS/ dir exists in our module subdir with the right |
143 | # we make sure a CVS/ dir exists in our module subdir with the right |
146 | # Root and Repository entries in it and cvs update. |
144 | # Root and Repository entries in it and cvs update. |
147 | |
145 | |
148 | [ "${ECVS_ANON}" == "yes" ] && \ |
146 | [ "${ECVS_ANON}" == "yes" ] && \ |
… | |
… | |
273 | |
271 | |
274 | EndOfFile |
272 | EndOfFile |
275 | ########################### End of inline-python ################################## |
273 | ########################### End of inline-python ################################## |
276 | else |
274 | else |
277 | # is anonymous cvs. |
275 | # is anonymous cvs. |
278 | debug-print "$FUNCNAME: using anonymous cvs login" |
|
|
279 | # is there a password to use for login with this "anonymous" login |
276 | # is there a password to use for login with this "anonymous" login |
280 | if [ -n $ECVS_PASS ]; then |
277 | if [ -n "$ECVS_PASS" ]; then |
281 | debug-print "$FUNCNAME: using anonymous cvs login with password" |
278 | debug-print "$FUNCNAME: using anonymous cvs login with password" |
282 | |
279 | |
283 | # inline-python # |
280 | # inline-python # |
284 | /usr/bin/env python << EndOfFile |
281 | /usr/bin/env python << EndOfFile |
285 | |
282 | |
… | |
… | |
297 | child.sendline(mypasswd) |
294 | child.sendline(mypasswd) |
298 | child.expect(pexpect.EOF) |
295 | child.expect(pexpect.EOF) |
299 | EndOfFile |
296 | EndOfFile |
300 | # End of inline-python # |
297 | # End of inline-python # |
301 | |
298 | |
|
|
299 | else |
|
|
300 | debug-print "$FUNCNAME: using anonymous cvs login (without password)" |
|
|
301 | # passwordless, truly anonymous login; or login with empty (but existing) |
|
|
302 | # password. |
|
|
303 | # make cvs think we're logged in at the cvs server, |
|
|
304 | # because i don't trust myself to write the right code for the case |
|
|
305 | # where the password is empty but still required (what's the bash test |
|
|
306 | # to see if a variable is defined? -n returns false if it is defined |
|
|
307 | # but empty...) |
|
|
308 | echo ":pserver:${ECVS_SERVER} A" > "${T}/cvspass" |
|
|
309 | # remember we did this so we don't try to run cvs logout later |
|
|
310 | DONT_LOGOUT=yes |
302 | fi |
311 | fi |
|
|
312 | |
|
|
313 | debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS" |
303 | $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update" |
314 | $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update" |
304 | |
315 | |
305 | fi |
316 | fi |
306 | |
317 | |
307 | # log out and restore ownership |
318 | # log out and restore ownership as needed |
|
|
319 | if [ -z "$DONT_LOGOUT" ]; then |
|
|
320 | debug-print "$FUNCNAME: cvs logout stuff" |
308 | if [ "$ECVS_RUNAS" == "`whoami`" ]; then |
321 | if [ "$ECVS_RUNAS" == "`whoami`" ]; then |
309 | cvs logout &> /dev/null |
322 | cvs logout &> /dev/null |
310 | else |
323 | else |
311 | su $ECVS_RUNAS -c "cvs logout" &> /dev/null |
324 | su $ECVS_RUNAS -c "cvs logout" &> /dev/null |
|
|
325 | fi |
312 | fi |
326 | fi |
313 | chown `whoami` "${T}/cvspass" |
327 | chown `whoami` "${T}/cvspass" |
314 | } |
328 | } |
315 | |
329 | |
316 | cvs_src_unpack() { |
330 | cvs_src_unpack() { |