| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 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.57 2005/07/06 20:23:20 agriffis Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.58 2005/07/11 15:08:06 swegener Exp $ |
| 4 | |
4 | |
| 5 | # Current Maintainer: Tal Peer <coredumb@gentoo.org> |
5 | # Current Maintainer: Tal Peer <coredumb@gentoo.org> |
| 6 | # Original Author: Dan Armak <danarmak@gentoo.org> |
6 | # Original Author: Dan Armak <danarmak@gentoo.org> |
| 7 | |
7 | |
| 8 | # SSH auth code by Danny <danny.milo@gmx.net> |
8 | # SSH auth code by Danny <danny.milo@gmx.net> |
| … | |
… | |
| 155 | # --- end ebuild-configurable settings --- |
155 | # --- end ebuild-configurable settings --- |
| 156 | |
156 | |
| 157 | # add cvs to deps |
157 | # add cvs to deps |
| 158 | # ssh is used for ext auth |
158 | # ssh is used for ext auth |
| 159 | # sudo is used to run as a specified user |
159 | # sudo is used to run as a specified user |
| 160 | DEPEND="$DEPEND dev-util/cvs app-admin/sudo" |
160 | DEPEND="dev-util/cvs app-admin/sudo" |
| 161 | |
161 | |
| 162 | if [ "$ECVS_AUTH" == "ext" ]; then |
162 | if [ "$ECVS_AUTH" == "ext" ]; then |
| 163 | #default to ssh |
163 | #default to ssh |
| 164 | [ -z "$CVS_RSH" ] && export SSH_RSH="ssh" |
164 | [ -z "$CVS_RSH" ] && export SSH_RSH="ssh" |
| 165 | if [ "$CVS_RSH" != "ssh" ]; then |
165 | if [ "$CVS_RSH" != "ssh" ]; then |
| 166 | die "Support for ext auth with clients other than ssh has not been implemented yet" |
166 | die "Support for ext auth with clients other than ssh has not been implemented yet" |
| 167 | fi |
167 | fi |
| 168 | DEPEND="$DEPEND net-misc/openssh" |
168 | DEPEND="${DEPEND} net-misc/openssh" |
| 169 | fi |
169 | fi |
| 170 | |
170 | |
| 171 | # called from cvs_src_unpack |
171 | # called from cvs_src_unpack |
| 172 | cvs_fetch() { |
172 | cvs_fetch() { |
| 173 | |
173 | |
| … | |
… | |
| 188 | |
188 | |
| 189 | # Update variables that are modified by ebuild parameters, which |
189 | # Update variables that are modified by ebuild parameters, which |
| 190 | # should be effective every time cvs_fetch is called, and not just |
190 | # should be effective every time cvs_fetch is called, and not just |
| 191 | # every time cvs.eclass is inherited |
191 | # every time cvs.eclass is inherited |
| 192 | |
192 | |
| 193 | |
|
|
| 194 | # Handle parameter for local (non-recursive) fetching |
193 | # Handle parameter for local (non-recursive) fetching |
| 195 | |
194 | |
| 196 | if [ -n "$ECVS_LOCAL" ]; then |
195 | if [ -n "$ECVS_LOCAL" ]; then |
| 197 | ECVS_UP_OPTS="$ECVS_UP_OPTS -l" |
196 | ECVS_UP_OPTS="$ECVS_UP_OPTS -l" |
| 198 | ECVS_CO_OPTS="$ECVS_CO_OPTS -l" |
197 | ECVS_CO_OPTS="$ECVS_CO_OPTS -l" |
| 199 | fi |
198 | fi |
| 200 | |
199 | |
| 201 | # Handle ECVS_BRANCH option |
200 | # Handle ECVS_BRANCH option |
| 202 | # |
201 | # |
| 203 | # Because CVS auto-switches branches, we just have to pass the |
202 | # Because CVS auto-switches branches, we just have to pass the |
| 204 | # correct -rBRANCH option when updating. |
203 | # correct -rBRANCH option when updating. |
| 205 | |
204 | |
| 206 | if [ -n "$ECVS_BRANCH" ]; then |
205 | if [ -n "$ECVS_BRANCH" ]; then |
| 207 | ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" |
206 | ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" |
| … | |
… | |
| 338 | eval $cmdlogin || die "cvs login command failed" |
337 | eval $cmdlogin || die "cvs login command failed" |
| 339 | if [ "${mode}" == "update" ]; then |
338 | if [ "${mode}" == "update" ]; then |
| 340 | einfo "Running $cmdupdate" |
339 | einfo "Running $cmdupdate" |
| 341 | eval $cmdupdate || die "cvs update command failed" |
340 | eval $cmdupdate || die "cvs update command failed" |
| 342 | elif [ "${mode}" == "checkout" ]; then |
341 | elif [ "${mode}" == "checkout" ]; then |
| 343 | einfo "Running $cmdcheckout" |
342 | einfo "Running $cmdcheckout" |
| 344 | eval $cmdcheckout|| die "cvs checkout command failed" |
343 | eval $cmdcheckout|| die "cvs checkout command failed" |
| 345 | fi |
344 | fi |
| 346 | elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then |
345 | elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then |
| 347 | |
346 | |
| 348 | # Hack to support SSH password authentication |
347 | # Hack to support SSH password authentication |
| … | |
… | |
| 413 | echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \ |
412 | echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \ |
| 414 | >> "${CVS_RSH}" |
413 | >> "${CVS_RSH}" |
| 415 | echo "os.execv('/usr/bin/ssh', newarglist)" \ |
414 | echo "os.execv('/usr/bin/ssh', newarglist)" \ |
| 416 | >> "${CVS_RSH}" |
415 | >> "${CVS_RSH}" |
| 417 | |
416 | |
| 418 | chmod a+x "${CVS_RSH}" |
417 | chmod a+x "${CVS_RSH}" |
| 419 | |
418 | |
| 420 | # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS |
419 | # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS |
| 421 | # if DISPLAY is not set) |
420 | # if DISPLAY is not set) |
| 422 | |
421 | |
| 423 | [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY" |
422 | [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY" |
| 424 | export DISPLAY |
423 | export DISPLAY |
| 425 | |
424 | |
| 426 | # Create a dummy executable to echo $ECVS_PASS |
425 | # Create a dummy executable to echo $ECVS_PASS |
| 427 | |
426 | |
| 428 | export SSH_ASKPASS="${T}/cvs_sshechopass" |
427 | export SSH_ASKPASS="${T}/cvs_sshechopass" |
| 429 | if [ "${ECVS_AUTH}" != "no" ]; then |
428 | if [ "${ECVS_AUTH}" != "no" ]; then |
| 430 | echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ |
429 | echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ |
| 431 | > "${SSH_ASKPASS}" |
430 | > "${SSH_ASKPASS}" |
| 432 | else |
431 | else |
| 433 | echo -en "#!/bin/bash\nreturn\n" \ |
432 | echo -en "#!/bin/bash\nreturn\n" \ |
| 434 | > "${SSH_ASKPASS}" |
433 | > "${SSH_ASKPASS}" |
| 435 | |
434 | |
| 436 | fi |
435 | fi |
| 437 | chmod a+x "${SSH_ASKPASS}" |
436 | chmod a+x "${SSH_ASKPASS}" |
| 438 | fi |
437 | fi |
| 439 | |
438 | |
| 440 | if [ "${mode}" == "update" ]; then |
439 | if [ "${mode}" == "update" ]; then |
| 441 | einfo "Running $cmdupdate" |
440 | einfo "Running $cmdupdate" |
| 442 | eval $cmdupdate || die "cvs update command failed" |
441 | eval $cmdupdate || die "cvs update command failed" |
| 443 | elif [ "${mode}" == "checkout" ]; then |
442 | elif [ "${mode}" == "checkout" ]; then |
| 444 | einfo "Running $cmdcheckout" |
443 | einfo "Running $cmdcheckout" |
| 445 | eval $cmdcheckout|| die "cvs checkout command failed" |
444 | eval $cmdcheckout|| die "cvs checkout command failed" |
| 446 | fi |
445 | fi |
| 447 | |
446 | |
| 448 | # Restore environment variable values |
447 | # Restore environment variable values |
| 449 | export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}" |
448 | export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}" |
| 450 | if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then |
449 | if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then |
| 451 | export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}" |
450 | export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}" |
| 452 | else |
451 | else |
| … | |
… | |
| 543 | # Make sure we don't try to apply patches more than once, |
542 | # Make sure we don't try to apply patches more than once, |
| 544 | # since cvs_src_unpack is usually called several times from |
543 | # since cvs_src_unpack is usually called several times from |
| 545 | # e.g. kde-source_src_unpack |
544 | # e.g. kde-source_src_unpack |
| 546 | export PATCHES="" |
545 | export PATCHES="" |
| 547 | fi |
546 | fi |
| 548 | |
547 | |
| 549 | einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}" |
548 | einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}" |
| 550 | } |
549 | } |
| 551 | |
550 | |
| 552 | EXPORT_FUNCTIONS src_unpack |
551 | EXPORT_FUNCTIONS src_unpack |