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

Diff of /eclass/cvs.eclass

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

Revision 1.45 Revision 1.48
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.45 2003/07/20 05:23:17 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.48 2003/09/28 17:19:43 coredumb Exp $
4# 4#
5# Current Maintainer: Tal Peer <coredumb@gentoo.org>
5# Author Dan Armak <danarmak@gentoo.org> 6# Original Author: Dan Armak <danarmak@gentoo.org>
7#
8# SSH auth code by Danny <danny.milo@gmx.net>
6# 9#
7# This eclass provides the generic cvs fetching functions. 10# This eclass provides the generic cvs fetching functions.
8# to use from an ebuild, set the 'ebuild-configurable settings' below in your ebuild before inheriting. 11# to use from an ebuild, set the 'ebuild-configurable settings' below in your ebuild before inheriting.
9# then either leave the default src_unpack or extend over cvs_src_unpack. 12# then either leave the default src_unpack or extend over cvs_src_unpack.
10# if you find that you need to call the cvs_* functions directly, i'd be interested to hear about it. 13# if you find that you need to call the cvs_* functions directly, i'd be interested to hear about it.
14
15# TODO:
16# Implement more auth types (gserver?, kserver?)
17# Implement more 'ext' auth methods (do anyone actually use it with anything other than ssh?)
11 18
12ECLASS=cvs 19ECLASS=cvs
13INHERITED="$INHERITED $ECLASS" 20INHERITED="$INHERITED $ECLASS"
14 21
15# You shouldn't change these settings yourself! The ebuild/eclass inheriting this eclass 22# You shouldn't change these settings yourself! The ebuild/eclass inheriting this eclass
50[ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline" 57[ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline"
51 58
52# Authentication method to use - possible values are "pserver" and "ext" 59# Authentication method to use - possible values are "pserver" and "ext"
53# WARNING ext is NOT supported! (never was, despite what earlier version of this file said) 60# WARNING ext is NOT supported! (never was, despite what earlier version of this file said)
54[ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" 61[ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver"
55[ "$ECVS_AUTH" == ext ] && die "ERROR: ext auth not supported. If you want it, please contact danarmak@gentoo.org."
56 62
57# Use su to run cvs as user 63# Use su to run cvs as user
58# Currently b0rked and wouldn't work with portage userpriv anyway without special magic 64# Currently b0rked and wouldn't work with portage userpriv anyway without special magic
59# [ -z "$ECVS_RUNAS" ] && ECVS_RUNAS="`whoami`" 65# [ -z "$ECVS_RUNAS" ] && ECVS_RUNAS="`whoami`"
60 66
72# the following default _will_ reset your branch checkout to head if used 78# the following default _will_ reset your branch checkout to head if used
73#[ -z "$ECVS_BRANCH" ] && ECVS_BRANCH="HEAD" 79#[ -z "$ECVS_BRANCH" ] && ECVS_BRANCH="HEAD"
74 80
75# deprecated - do not use 81# deprecated - do not use
76[ -n "$ECVS_SUBDIR" ] && die "ERROR: deprecated ECVS_SUBDIR defined. Please fix this ebuild." 82[ -n "$ECVS_SUBDIR" ] && die "ERROR: deprecated ECVS_SUBDIR defined. Please fix this ebuild."
83
84# ECVS_CLEAN: set this to something to get a clean copy when updating (passes the -C option to cvs update)
77 85
78# --- end ebuild-configurable settings --- 86# --- end ebuild-configurable settings ---
79 87
80# add cvs to deps 88# add cvs to deps
81# ssh is used for ext auth 89# ssh is used for ext auth
82# sudo is used to run as a specified user 90# sudo is used to run as a specified user
83DEPEND="$DEPEND dev-util/cvs app-admin/sudo" 91DEPEND="$DEPEND dev-util/cvs app-admin/sudo"
84#[ "$ECVS_AUTH" == "ext" ] && DEPEND="$DEPEND net-misc/openssh" 92
93if [ "$ECVS_AUTH" == "ext" ]; then
94 #default to ssh
95 [ -z "$CVS_RSH" ] && export SSH_RSH="ssh"
96 if [ "$CVS_RSH" != "ssh" ]; then
97 die "Support for ext auth with clients other than ssh has not been implemented yet"
98 fi
99 DEPEND="$DEPEND net-misc/openssh"
100fi
85 101
86# calls cvs_contorl, is called from cvs_src_unpack 102# calls cvs_contorl, is called from cvs_src_unpack
87cvs_fetch() { 103cvs_fetch() {
88 104
89 # fix for sourceforge which doesnt want -z>3 anymore. 105 # fix for sourceforge which doesnt want -z>3 anymore.
108 124
109 if [ "$ECVS_LOCALNAME" != "$ECVS_MODULE" ]; then 125 if [ "$ECVS_LOCALNAME" != "$ECVS_MODULE" ]; then
110 # the option to cvs on which this is based. note this isn't the same as the 126 # the option to cvs on which this is based. note this isn't the same as the
111 # global -d option to cvs, which specifies the cvs server. ugh @ cvs syntax. 127 # global -d option to cvs, which specifies the cvs server. ugh @ cvs syntax.
112 ECVS_CO_OPTS="$ECVS_CO_OPTS -d $ECVS_LOCALNAME" 128 ECVS_CO_OPTS="$ECVS_CO_OPTS -d $ECVS_LOCALNAME"
129 fi
130
131 if [ -n "$ECVS_CLEAN" ]; then
132 ECVS_UP_OPTS="$ECVS_UP_OPTS -C"
113 fi 133 fi
114 134
115 # it's easiest to always be in "run-as mode", logic-wise 135 # it's easiest to always be in "run-as mode", logic-wise
116 # or would be if sudo didn't ask for a password even when sudo'ing to `whoami` 136 # or would be if sudo didn't ask for a password even when sudo'ing to `whoami`
117 if [ -z "$ECVS_RUNAS" ]; then 137 if [ -z "$ECVS_RUNAS" ]; then
207 eval $cmdupdate || die "cvs update command failed" 227 eval $cmdupdate || die "cvs update command failed"
208 elif [ "${mode}" == "checkout" ]; then 228 elif [ "${mode}" == "checkout" ]; then
209 einfo "Running $cmdcheckout" 229 einfo "Running $cmdcheckout"
210 eval $cmdcheckout|| die "cvs checkout command failed" 230 eval $cmdcheckout|| die "cvs checkout command failed"
211 fi 231 fi
212# elif [ "${ECVS_AUTH}" == "ext" ]; then 232 elif [ "${ECVS_AUTH}" == "ext" ]; then
213# # for ext there's also a possible ssh prompt, code not yet written 233 #no login needed for ext
214# echo "${ECVS_DELAY} continue connecting&yes" >> "$instruct"
215# echo "${ECVS_DELAY} CVS password:&${ECVS_PASS}" >> "$instruct"
216# if [ "$mode" == "update" ]; then 234 if [ "${mode}" == "update" ]; then
217# expect "$cvsout" "$instruct" | $cmdupdate > "$cvsout" 235 einfo "Running $cmdupdate"
236 eval $cmdupdate || die "cvs update command failed"
218# elif [ "$mode" == "checkout" ]; then 237 elif [ "${mode}" == "checkout" ]; then
219# expect "$cvsout" "$instruct" | $cmdcheckout > "$cvsout" 238 einfo "Running $cmdcheckout"
239 eval $cmdcheckout|| die "cvs checkout command failed"
220# fi 240 fi
221 fi 241 fi
222 242
223 # restore ownership. not sure why this is needed, but someone added it in the orig ECVS_RUNAS stuff. 243 # restore ownership. not sure why this is needed, but someone added it in the orig ECVS_RUNAS stuff.
224 if [ -n "$ECVS_RUNAS" ]; then 244 if [ -n "$ECVS_RUNAS" ]; then
225 chown `whoami` "${T}/cvspass" 245 chown `whoami` "${T}/cvspass"
231cvs_src_unpack() { 251cvs_src_unpack() {
232 252
233 debug-print-function $FUNCNAME $* 253 debug-print-function $FUNCNAME $*
234 254
235 debug-print "$FUNCNAME: init: 255 debug-print "$FUNCNAME: init:
236ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND 256 ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND
237ECVS_UP_OPTS=$ECVS_UP_OPTS 257 ECVS_UP_OPTS=$ECVS_UP_OPTS
238ECVS_CO_OPTS=$ECVS_CO_OPTS 258 ECVS_CO_OPTS=$ECVS_CO_OPTS
239ECVS_TOP_DIR=$ECVS_TOP_DIR 259 ECVS_TOP_DIR=$ECVS_TOP_DIR
240ECVS_SERVER=$ECVS_SERVER 260 ECVS_SERVER=$ECVS_SERVER
241ECVS_USER=$ECVS_USER 261 ECVS_USER=$ECVS_USER
242ECVS_PASS=$ECVS_PASS 262 ECVS_PASS=$ECVS_PASS
243ECVS_MODULE=$ECVS_MODULE 263 ECVS_MODULE=$ECVS_MODULE
244ECVS_LOCAL=$ECVS_LOCAL 264 ECVS_LOCAL=$ECVS_LOCAL
245ECVS_RUNAS=$ECVS_RUNAS 265 ECVS_RUNAS=$ECVS_RUNAS
246ECVS_LOCALNAME=$ECVS_LOCALNAME" 266 ECVS_LOCALNAME=$ECVS_LOCALNAME"
247 267
248 [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue." 268 [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue."
249 269
250 # merely setting this default value makes things fail when cvs_src_unpack is called 270 # merely setting this default value makes things fail when cvs_src_unpack is called
251 # more than once per ebuild (eg kdenonbeta submodules); so if we set a default value, 271 # more than once per ebuild (eg kdenonbeta submodules); so if we set a default value,
310 if [ -n "$ECVS_LOCALNAME_SETDEFAULT" ]; then 330 if [ -n "$ECVS_LOCALNAME_SETDEFAULT" ]; then
311 unset ECVS_LOCALNAME 331 unset ECVS_LOCALNAME
312 unset ECVS_LOCALNAME_SETDEFAULT 332 unset ECVS_LOCALNAME_SETDEFAULT
313 fi 333 fi
314 334
315 einfo "Source now in ${WORKDIR}" 335 einfo "Module ${ECVS_MODULE} is now in ${WORKDIR}"
336
316} 337}
317 338
318EXPORT_FUNCTIONS src_unpack 339EXPORT_FUNCTIONS src_unpack

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.48

  ViewVC Help
Powered by ViewVC 1.1.20