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

Diff of /eclass/cvs.eclass

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

Revision 1.28 Revision 1.31
1# Copyright 1999-2000 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.31 2003/02/16 04:26:21 vapier Exp $
4#
3# Author Dan Armak <danarmak@gentoo.org> 5# Author Dan Armak <danarmak@gentoo.org>
4# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.28 2002/11/30 19:44:18 danarmak Exp $ 6#
5# This eclass provides the generic cvs fetching functions. 7# This eclass provides the generic cvs fetching functions.
6 8
7ECLASS=cvs 9ECLASS=cvs
8INHERITED="$INHERITED $ECLASS" 10INHERITED="$INHERITED $ECLASS"
9 11
207 # cvs auto-switches branches, how nice 209 # cvs auto-switches branches, how nice
208 # warning: if we do it this way we get multiple -rX options - harmless i think 210 # warning: if we do it this way we get multiple -rX options - harmless i think
209 [ -n "$ECVS_BRANCH" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -r$ECVS_BRANCH" 211 [ -n "$ECVS_BRANCH" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -r$ECVS_BRANCH"
210 212
211 # Chowning the directory 213 # Chowning the directory
212 if [ "${ECVS_RUNAS}" != "root" ]; then 214 if [ "${ECVS_RUNAS}" != "`whoami`" ]; then
213 chown -R "$ECVS_RUNAS" "/$DIR" 215 chown -R "$ECVS_RUNAS" "/$DIR"
214 fi 216 fi
215 217
216 # finally run the cvs update command 218 # finally run the cvs update command
217 debug-print "$FUNCNAME: is in dir `/bin/pwd`" 219 debug-print "$FUNCNAME: is in dir `/bin/pwd`"
233 235
234mypasswd = "${ECVS_PASS}" 236mypasswd = "${ECVS_PASS}"
235myauth = "${ECVS_AUTH}" 237myauth = "${ECVS_AUTH}"
236mytimeout = 10 238mytimeout = 10
237 239
240if "${ECVS_RUNAS}" == "`whoami`":
241 mycommand = "${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}"
242else:
243 mycommand = "su ${ECVS_RUNAS} -c \"${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}\""
244
238if myauth == "ext": 245if myauth == "ext":
239 mycommand = "su ${ECVS_RUNAS} -c \"${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}\""
240 child = pexpect.spawn(mycommand) 246 child = pexpect.spawn(mycommand)
241 247
242 index = child.expect(['continue connecting','word:'], mytimeout) 248 index = child.expect(['continue connecting','word:'], mytimeout)
243 if index == 0: 249 if index == 0:
244 child.sendline('yes') 250 child.sendline('yes')
250 256
251 child.sendline(mypasswd) 257 child.sendline(mypasswd)
252 child.expect(pexpect.EOF) 258 child.expect(pexpect.EOF)
253 259
254elif myauth == "pserver": 260elif myauth == "pserver":
261 if "${ECVS_RUNAS}" == "`whoami`":
262 mycommand2 = "cvs login"
263 else:
255 mycommand = "su ${ECVS_RUNAS} -c \"cvs login\"" 264 mycommand2 = "su ${ECVS_RUNAS} -c \"cvs login\""
256 child = pexpect.spawn(mycommand) 265 child = pexpect.spawn(mycommand2)
257 child.expect("CVS password:",mytimeout) 266 child.expect("CVS password:",mytimeout)
258 child.sendline(mypasswd) 267 child.sendline(mypasswd)
259 child.expect(pexpect.EOF) 268 child.expect(pexpect.EOF)
260 269
261 # Logged in - checking out 270 # Logged in - checking out
262 os.system("su ${ECVS_RUNAS} -c \"${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}\" &> /dev/null") 271 os.system(mycommand)
272
263EndOfFile 273EndOfFile
264########################### End of inline-python ################################## 274########################### End of inline-python ##################################
265 else 275 else
266 debug-print "$FUNCNAME: using anonymous cvs login" 276 debug-print "$FUNCNAME: using anonymous cvs login"
267 $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update" 277 $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update"
268 fi 278 fi
269 279
270 # log out and restore ownership 280 # log out and restore ownership
281 if [ "$ECVS_RUNAS" == "`whoami`" ]; then
282 cvs logout &> /dev/null
283 else
271 su $ECVS_RUNAS -c "cvs logout" &> /dev/null 284 su $ECVS_RUNAS -c "cvs logout" &> /dev/null
285 fi
272 chown `whoami` "${T}/cvspass" 286 chown `whoami` "${T}/cvspass"
273} 287}
274 288
275cvs_src_unpack() { 289cvs_src_unpack() {
276 290

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20