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

Diff of /eclass/cvs.eclass

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

Revision 1.27 Revision 1.30
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.27 2002/11/29 13:13:00 danarmak Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.30 2002/12/31 21:30:19 cretin 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
207 # cvs auto-switches branches, how nice 207 # cvs auto-switches branches, how nice
208 # warning: if we do it this way we get multiple -rX options - harmless i think 208 # 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" 209 [ -n "$ECVS_BRANCH" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -r$ECVS_BRANCH"
210 210
211 # Chowning the directory 211 # Chowning the directory
212 if [ "${ECVS_RUNAS}" != "root" ]; then 212 if [ "${ECVS_RUNAS}" != "`whoami`" ]; then
213 chown -R "$ECVS_RUNAS" "/$DIR" 213 chown -R "$ECVS_RUNAS" "/$DIR"
214 fi 214 fi
215 215
216 # finally run the cvs update command 216 # finally run the cvs update command
217 debug-print "$FUNCNAME: is in dir `/bin/pwd`" 217 debug-print "$FUNCNAME: is in dir `/bin/pwd`"
233 233
234mypasswd = "${ECVS_PASS}" 234mypasswd = "${ECVS_PASS}"
235myauth = "${ECVS_AUTH}" 235myauth = "${ECVS_AUTH}"
236mytimeout = 10 236mytimeout = 10
237 237
238if "${ECVS_RUNAS}" == "`whoami`":
239 mycommand = "${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}"
240else:
241 mycommand = "su ${ECVS_RUNAS} -c \"${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}\""
242
238if myauth == "ext": 243if myauth == "ext":
239 mycommand = "su ${ECVS_RUNAS} -c \"${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}\""
240 child = pexpect.spawn(mycommand) 244 child = pexpect.spawn(mycommand)
241 245
242 index = child.expect(['continue connecting','word:'], mytimeout) 246 index = child.expect(['continue connecting','word:'], mytimeout)
243 if index == 0: 247 if index == 0:
244 child.sendline('yes') 248 child.sendline('yes')
250 254
251 child.sendline(mypasswd) 255 child.sendline(mypasswd)
252 child.expect(pexpect.EOF) 256 child.expect(pexpect.EOF)
253 257
254elif myauth == "pserver": 258elif myauth == "pserver":
259 if "${ECVS_RUNAS}" == "`whoami`":
260 mycommand2 = "cvs login"
261 else:
255 mycommand = "su ${ECVS_RUNAS} -c \"cvs login\"" 262 mycommand2 = "su ${ECVS_RUNAS} -c \"cvs login\""
256 child = pexpect.spawn(mycommand) 263 child = pexpect.spawn(mycommand2)
257 child.expect("CVS password:",mytimeout) 264 child.expect("CVS password:",mytimeout)
258 child.sendline(mypasswd) 265 child.sendline(mypasswd)
259 child.expect(pexpect.EOF) 266 child.expect(pexpect.EOF)
260 267
261 # Logged in - checking out 268 # Logged in - checking out
262 os.system("su ${ECVS_RUNAS} -c \"${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}\" &> /dev/null") 269 os.system(mycommand)
270
263EndOfFile 271EndOfFile
264########################### End of inline-python ################################## 272########################### End of inline-python ##################################
265 else 273 else
266 debug-print "$FUNCNAME: using anonymous cvs login" 274 debug-print "$FUNCNAME: using anonymous cvs login"
267 $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update" 275 $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update"
268 fi 276 fi
269 277
270 # log out and restore ownership 278 # log out and restore ownership
279 if [ "$ECVS_RUNAS" == "`whoami`" ]; then
280 cvs logout &> /dev/null
281 else
271 su $ECVS_RUNAS -c "cvs logout" &> /dev/null 282 su $ECVS_RUNAS -c "cvs logout" &> /dev/null
283 fi
272 chown `whoami` "${T}/cvspass" 284 chown `whoami` "${T}/cvspass"
273} 285}
274 286
275cvs_src_unpack() { 287cvs_src_unpack() {
276 288
298 fi 310 fi
299 311
300 # if the directory is empty, remove it; empty directories cannot exist in cvs. 312 # if the directory is empty, remove it; empty directories cannot exist in cvs.
301 # this happens when fex. kde-source requests module/doc/subdir which doesn't exist. 313 # this happens when fex. kde-source requests module/doc/subdir which doesn't exist.
302 # still create the empty directory in workdir though. 314 # still create the empty directory in workdir though.
303 if [ "`ls -A $DIR`" == "CVS" ]; then 315 if [ "`ls -A \"$DIR\"`" == "CVS" ]; then
304 debug-print "$FUNCNAME: removing cvs-empty directory $ECVS_MODULE/$ECVS_SUBDIR" 316 debug-print "$FUNCNAME: removing cvs-empty directory $ECVS_MODULE/$ECVS_SUBDIR"
305 rm -rf "$DIR" 317 rm -rf "$DIR"
306 fi 318 fi
307 319
308 # implement some of base_src_unpack's functionality; 320 # implement some of base_src_unpack's functionality;

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.30

  ViewVC Help
Powered by ViewVC 1.1.20