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

Diff of /eclass/cvs.eclass

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

Revision 1.36 Revision 1.42
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.36 2003/04/19 11:52:50 danarmak Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.42 2003/06/13 09:22:47 torbenh Exp $
4# 4#
5# Author Dan Armak <danarmak@gentoo.org> 5# Author Dan Armak <danarmak@gentoo.org>
6# 6#
7# This eclass provides the generic cvs fetching functions. 7# 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. 8# to use from an ebuild, set the 'ebuild-configurable settings' below in your ebuild before inheriting.
77#[ "$ECVS_AUTH" == "ext" ] && DEPEND="$DEPEND net-misc/openssh" 77#[ "$ECVS_AUTH" == "ext" ] && DEPEND="$DEPEND net-misc/openssh"
78 78
79# calls cvs_contorl, is called from cvs_src_unpack 79# calls cvs_contorl, is called from cvs_src_unpack
80cvs_fetch() { 80cvs_fetch() {
81 81
82 # fix for sourceforge which doesnt want -z>3 anymore.
83
84 (echo $ECVS_SERVER | grep sourceforge) && [ "$ECVS_CVS_COMMAND" == "cvs -q -f -z4" ] && ECVS_CVS_COMMAND="cvs -q -f -z3"
85
82 debug-print-function $FUNCNAME $* 86 debug-print-function $FUNCNAME $*
83 87
84 # parameters modifying other parameters that should be effective every time cvs_prep is called, and not 88 # parameters modifying other parameters that should be effective every time cvs_fetch is called,
85 # just every time cvs.eclas is inherited 89 # and not just every time cvs.eclas is inherited
86 # 1. parameter for local (non-recursive) fetching 90 # 1. parameter for local (non-recursive) fetching
87 if [ -n "$ECVS_LOCAL" ]; then 91 if [ -n "$ECVS_LOCAL" ]; then
88 ECVS_UP_OPTS="$ECVS_UP_OPTS -l" 92 ECVS_UP_OPTS="$ECVS_UP_OPTS -l"
89 ECVS_CO_OPTS="$ECVS_CO_OPTS -l" 93 ECVS_CO_OPTS="$ECVS_CO_OPTS -l"
90 fi 94 fi
135 # chowning the directory and all contents 139 # chowning the directory and all contents
136 if [ -n "$ECVS_RUNAS" ]; then 140 if [ -n "$ECVS_RUNAS" ]; then
137 $run chown -R "$ECVS_RUNAS" "/$ECVS_TOP_DIR" 141 $run chown -R "$ECVS_RUNAS" "/$ECVS_TOP_DIR"
138 fi 142 fi
139 143
140 # our server string (aka CVSHOST), without the password so it can be put in Root 144 # our server string (aka CVSROOT), without the password so it can be put in Root
141 server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" 145 server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
142 146
143 # switch servers automagically if needed 147 # switch servers automagically if needed
144 if [ "$mode" == "update" ]; then 148 if [ "$mode" == "update" ]; then
145 cd /$ECVS_TOP_DIR/$ECVS_MODULE 149 cd /$ECVS_TOP_DIR/$ECVS_MODULE
161 done 165 done
162 166
163 fi 167 fi
164 fi 168 fi
165 169
166 # the server string with the password in it
167 # needed for mode=update too as we may not be inside ECVS_MODULE but only inside ECVS_TOP_DIR
168 # however putting the password in in update mode can break (?)
169 if [ "$mode" == "checkout" ]; then
170 export CVSROOT=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
171 else
172 export CVSROOT=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
173 fi
174
175 # prepare a cvspass file just for this session, we don't want to mess with ~/.cvspass 170 # prepare a cvspass file just for this session, we don't want to mess with ~/.cvspass
176 touch "${T}/cvspass" 171 touch "${T}/cvspass"
177 export CVS_PASSFILE="${T}/cvspass" 172 export CVS_PASSFILE="${T}/cvspass"
178 if [ -n "$ECVS_RUNAS" ]; then 173 if [ -n "$ECVS_RUNAS" ]; then
179 chown "$ECVS_RUNAS" "${T}/cvspass" 174 chown "$ECVS_RUNAS" "${T}/cvspass"
180 fi 175 fi
181 176
177 # the server string with the password in it, for login
178 cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
179 # ditto without the password, for checkout/update after login, so that
180 # the CVS/Root files don't contain the password in plaintext
181 cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
182
182 # commands to run 183 # commands to run
184 cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login"
183 cmdupdate="${run} ${ECVS_CVS_COMMAND} update ${ECVS_UP_OPTS} ${ECVS_MODULE}" 185 cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_MODULE}"
184 cmdcheckout="${run} ${ECVS_CVS_COMMAND} checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" 186 cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}"
185 187
186 cd "${ECVS_TOP_DIR}" 188 cd "${ECVS_TOP_DIR}"
187 if [ "${ECVS_AUTH}" == "pserver" ]; then 189 if [ "${ECVS_AUTH}" == "pserver" ]; then
190 einfo "Running $cmdlogin"
191 eval $cmdlogin || die "cvs login command failed"
188 if [ "${mode}" == "update" ]; then 192 if [ "${mode}" == "update" ]; then
189 $cmdupdate 193 einfo "Running $cmdupdate"
194 eval $cmdupdate || die "cvs update command failed"
190 elif [ "${mode}" == "checkout" ]; then 195 elif [ "${mode}" == "checkout" ]; then
191 $cmdcheckout 196 einfo "Running $cmdcheckout"
197 eval $cmdcheckout|| die "cvs checkout command failed"
192 fi 198 fi
193# elif [ "${ECVS_AUTH}" == "ext" ]; then 199# elif [ "${ECVS_AUTH}" == "ext" ]; then
194# # for ext there's also a possible ssh prompt, code not yet written 200# # for ext there's also a possible ssh prompt, code not yet written
195# echo "${ECVS_DELAY} continue connecting&yes" >> "$instruct" 201# echo "${ECVS_DELAY} continue connecting&yes" >> "$instruct"
196# echo "${ECVS_DELAY} CVS password:&${ECVS_PASS}" >> "$instruct" 202# echo "${ECVS_DELAY} CVS password:&${ECVS_PASS}" >> "$instruct"
227 233
228 [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue." 234 [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue."
229 235
230 if [ "$ECVS_SERVER" == "offline" ]; then 236 if [ "$ECVS_SERVER" == "offline" ]; then
231 # we're not required to fetch anything, the module already exists and shouldn't be updated 237 # we're not required to fetch anything, the module already exists and shouldn't be updated
232 if [ -d "${ECVS_TOP_DIR}/${ECVS_MODULE}" ]; then 238 if [ -d "${ECVS_TOP_DIR}/${ECVS_MODULE}" ]; then
233 debug-print "$FUNCNAME: offline mode, exiting" 239 debug-print "$FUNCNAME: offline mode"
234 return 0
235 else 240 else
236 debug-print "$FUNCNAME: offline mode specified but module/subdir not found, exiting with error" 241 debug-print "$FUNCNAME: offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_MODULE} not found, exiting with error"
237 die "ERROR: Offline mode specified, but module/subdir checkout not found. Aborting." 242 die "ERROR: Offline mode specified, but dir ${ECVS_TOP_DIR}/${ECVS_MODULE} not found. Aborting."
238 fi 243 fi
239 elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode 244 elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode
240 einfo "Fetching cvs module $ECVS_MODULE into $ECVS_TOP_DIR..." 245 einfo "Fetching cvs module $ECVS_MODULE into $ECVS_TOP_DIR..."
241 cvs_fetch 246 cvs_fetch
242 else # ECVS_SERVER not set 247 else # ECVS_SERVER not set

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.42

  ViewVC Help
Powered by ViewVC 1.1.20