/[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.41
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.41 2003/06/10 22:06:18 danarmak 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.
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 debug-print-function $FUNCNAME $* 82 debug-print-function $FUNCNAME $*
83 83
84 # parameters modifying other parameters that should be effective every time cvs_prep is called, and not 84 # parameters modifying other parameters that should be effective every time cvs_fetch is called,
85 # just every time cvs.eclas is inherited 85 # and not just every time cvs.eclas is inherited
86 # 1. parameter for local (non-recursive) fetching 86 # 1. parameter for local (non-recursive) fetching
87 if [ -n "$ECVS_LOCAL" ]; then 87 if [ -n "$ECVS_LOCAL" ]; then
88 ECVS_UP_OPTS="$ECVS_UP_OPTS -l" 88 ECVS_UP_OPTS="$ECVS_UP_OPTS -l"
89 ECVS_CO_OPTS="$ECVS_CO_OPTS -l" 89 ECVS_CO_OPTS="$ECVS_CO_OPTS -l"
90 fi 90 fi
135 # chowning the directory and all contents 135 # chowning the directory and all contents
136 if [ -n "$ECVS_RUNAS" ]; then 136 if [ -n "$ECVS_RUNAS" ]; then
137 $run chown -R "$ECVS_RUNAS" "/$ECVS_TOP_DIR" 137 $run chown -R "$ECVS_RUNAS" "/$ECVS_TOP_DIR"
138 fi 138 fi
139 139
140 # our server string (aka CVSHOST), without the password so it can be put in Root 140 # our server string (aka CVSROOT), without the password so it can be put in Root
141 server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" 141 server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
142 142
143 # switch servers automagically if needed 143 # switch servers automagically if needed
144 if [ "$mode" == "update" ]; then 144 if [ "$mode" == "update" ]; then
145 cd /$ECVS_TOP_DIR/$ECVS_MODULE 145 cd /$ECVS_TOP_DIR/$ECVS_MODULE
161 done 161 done
162 162
163 fi 163 fi
164 fi 164 fi
165 165
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 166 # prepare a cvspass file just for this session, we don't want to mess with ~/.cvspass
176 touch "${T}/cvspass" 167 touch "${T}/cvspass"
177 export CVS_PASSFILE="${T}/cvspass" 168 export CVS_PASSFILE="${T}/cvspass"
178 if [ -n "$ECVS_RUNAS" ]; then 169 if [ -n "$ECVS_RUNAS" ]; then
179 chown "$ECVS_RUNAS" "${T}/cvspass" 170 chown "$ECVS_RUNAS" "${T}/cvspass"
180 fi 171 fi
181 172
173 # the server string with the password in it, for login
174 cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
175 # ditto without the password, for checkout/update after login, so that
176 # the CVS/Root files don't contain the password in plaintext
177 cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
178
182 # commands to run 179 # commands to run
180 cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login"
183 cmdupdate="${run} ${ECVS_CVS_COMMAND} update ${ECVS_UP_OPTS} ${ECVS_MODULE}" 181 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}" 182 cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}"
185 183
186 cd "${ECVS_TOP_DIR}" 184 cd "${ECVS_TOP_DIR}"
187 if [ "${ECVS_AUTH}" == "pserver" ]; then 185 if [ "${ECVS_AUTH}" == "pserver" ]; then
186 einfo "Running $cmdlogin"
187 eval $cmdlogin || die "cvs login command failed"
188 if [ "${mode}" == "update" ]; then 188 if [ "${mode}" == "update" ]; then
189 $cmdupdate 189 einfo "Running $cmdupdate"
190 eval $cmdupdate || die "cvs update command failed"
190 elif [ "${mode}" == "checkout" ]; then 191 elif [ "${mode}" == "checkout" ]; then
191 $cmdcheckout 192 einfo "Running $cmdcheckout"
193 eval $cmdcheckout|| die "cvs checkout command failed"
192 fi 194 fi
193# elif [ "${ECVS_AUTH}" == "ext" ]; then 195# elif [ "${ECVS_AUTH}" == "ext" ]; then
194# # for ext there's also a possible ssh prompt, code not yet written 196# # for ext there's also a possible ssh prompt, code not yet written
195# echo "${ECVS_DELAY} continue connecting&yes" >> "$instruct" 197# echo "${ECVS_DELAY} continue connecting&yes" >> "$instruct"
196# echo "${ECVS_DELAY} CVS password:&${ECVS_PASS}" >> "$instruct" 198# echo "${ECVS_DELAY} CVS password:&${ECVS_PASS}" >> "$instruct"
227 229
228 [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue." 230 [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue."
229 231
230 if [ "$ECVS_SERVER" == "offline" ]; then 232 if [ "$ECVS_SERVER" == "offline" ]; then
231 # we're not required to fetch anything, the module already exists and shouldn't be updated 233 # 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 234 if [ -d "${ECVS_TOP_DIR}/${ECVS_MODULE}" ]; then
233 debug-print "$FUNCNAME: offline mode, exiting" 235 debug-print "$FUNCNAME: offline mode"
234 return 0
235 else 236 else
236 debug-print "$FUNCNAME: offline mode specified but module/subdir not found, exiting with error" 237 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." 238 die "ERROR: Offline mode specified, but dir ${ECVS_TOP_DIR}/${ECVS_MODULE} not found. Aborting."
238 fi 239 fi
239 elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode 240 elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode
240 einfo "Fetching cvs module $ECVS_MODULE into $ECVS_TOP_DIR..." 241 einfo "Fetching cvs module $ECVS_MODULE into $ECVS_TOP_DIR..."
241 cvs_fetch 242 cvs_fetch
242 else # ECVS_SERVER not set 243 else # ECVS_SERVER not set

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

  ViewVC Help
Powered by ViewVC 1.1.20