| 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.28 2002/11/30 19:44:18 danarmak Exp $ |
4 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.29 2002/12/22 12:06:00 danarmak Exp $ |
| 5 | # This eclass provides the generic cvs fetching functions. |
5 | # This eclass provides the generic cvs fetching functions. |
| 6 | |
6 | |
| 7 | ECLASS=cvs |
7 | ECLASS=cvs |
| 8 | INHERITED="$INHERITED $ECLASS" |
8 | INHERITED="$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 | |
| 234 | mypasswd = "${ECVS_PASS}" |
234 | mypasswd = "${ECVS_PASS}" |
| 235 | myauth = "${ECVS_AUTH}" |
235 | myauth = "${ECVS_AUTH}" |
| 236 | mytimeout = 10 |
236 | mytimeout = 10 |
| 237 | |
237 | |
|
|
238 | if "${ECVS_RUNAS}" == "`whoami`": |
|
|
239 | mycommand = "${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}" |
|
|
240 | else: |
|
|
241 | mycommand = "su ${ECVS_RUNAS} -c \"${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}\"" |
|
|
242 | |
| 238 | if myauth == "ext": |
243 | if 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') |
| … | |
… | |
| 257 | child.expect("CVS password:",mytimeout) |
261 | child.expect("CVS password:",mytimeout) |
| 258 | child.sendline(mypasswd) |
262 | child.sendline(mypasswd) |
| 259 | child.expect(pexpect.EOF) |
263 | child.expect(pexpect.EOF) |
| 260 | |
264 | |
| 261 | # Logged in - checking out |
265 | # Logged in - checking out |
| 262 | os.system("su ${ECVS_RUNAS} -c \"${ECVS_CVS_COMMAND} update ${ECVS_CVS_OPTIONS}\" &> /dev/null") |
266 | os.system(mycommand) |
|
|
267 | |
| 263 | EndOfFile |
268 | EndOfFile |
| 264 | ########################### End of inline-python ################################## |
269 | ########################### End of inline-python ################################## |
| 265 | else |
270 | else |
| 266 | debug-print "$FUNCNAME: using anonymous cvs login" |
271 | debug-print "$FUNCNAME: using anonymous cvs login" |
| 267 | $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update" |
272 | $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update" |
| 268 | fi |
273 | fi |
| 269 | |
274 | |
| 270 | # log out and restore ownership |
275 | # log out and restore ownership |
|
|
276 | if [ "$ECVS_RUNAS" == "`whoami`" ]; then |
|
|
277 | cvs logout &> /dev/null |
|
|
278 | else |
| 271 | su $ECVS_RUNAS -c "cvs logout" &> /dev/null |
279 | su $ECVS_RUNAS -c "cvs logout" &> /dev/null |
|
|
280 | fi |
| 272 | chown `whoami` "${T}/cvspass" |
281 | chown `whoami` "${T}/cvspass" |
| 273 | } |
282 | } |
| 274 | |
283 | |
| 275 | cvs_src_unpack() { |
284 | cvs_src_unpack() { |
| 276 | |
285 | |