| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2006 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.50 2004/01/04 14:35:12 coredumb Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.68 2006/12/11 00:16:28 vapier Exp $ |
|
|
4 | # |
|
|
5 | # Maintainer: vapier@gentoo.org (and anyone who wants to help) |
| 4 | |
6 | |
| 5 | # Current Maintainer: Tal Peer <coredumb@gentoo.org> |
7 | inherit eutils |
| 6 | # Original Author: Dan Armak <danarmak@gentoo.org> |
|
|
| 7 | |
|
|
| 8 | # SSH auth code by Danny <danny.milo@gmx.net> |
|
|
| 9 | |
|
|
| 10 | # SSH password authentication support and host key verification |
|
|
| 11 | # support by Jeremy Maitin-Shepard <jbms@gentoo.org> |
|
|
| 12 | |
|
|
| 13 | |
8 | |
| 14 | # This eclass provides the generic cvs fetching functions. To use |
9 | # This eclass provides the generic cvs fetching functions. To use |
| 15 | # this from an ebuild, set the `ebuild-configurable settings' as |
10 | # this from an ebuild, set the `ebuild-configurable settings' as |
| 16 | # specified below in your ebuild before inheriting. Then either leave |
11 | # specified below in your ebuild before inheriting. Then either leave |
| 17 | # the default src_unpack or extend over cvs_src_unpack. If you find |
12 | # the default src_unpack or extend over cvs_src_unpack. If you find |
| … | |
… | |
| 24 | |
19 | |
| 25 | # Support additional remote shells with `ext' authentication (does |
20 | # Support additional remote shells with `ext' authentication (does |
| 26 | # anyone actually need to use it with anything other than SSH?) |
21 | # anyone actually need to use it with anything other than SSH?) |
| 27 | |
22 | |
| 28 | |
23 | |
| 29 | ECLASS=cvs |
|
|
| 30 | INHERITED="$INHERITED $ECLASS" |
|
|
| 31 | |
24 | |
| 32 | # Users shouldn't change these settings! The ebuild/eclass inheriting |
25 | # Users shouldn't change these settings! The ebuild/eclass inheriting |
| 33 | # this eclass will take care of that. If you want to set the global |
26 | # this eclass will take care of that. If you want to set the global |
| 34 | # KDE cvs ebuilds' settings, see the comments in kde-source.eclass. |
27 | # KDE cvs ebuilds' settings, see the comments in kde-source.eclass. |
| 35 | |
28 | |
| … | |
… | |
| 40 | # You can set, for example, "cvs -t" for extensive debug information |
33 | # You can set, for example, "cvs -t" for extensive debug information |
| 41 | # on the cvs connection. The default of "cvs -q -f -z4" means to be |
34 | # on the cvs connection. The default of "cvs -q -f -z4" means to be |
| 42 | # quiet, to disregard the ~/.cvsrc config file and to use maximum |
35 | # quiet, to disregard the ~/.cvsrc config file and to use maximum |
| 43 | # compression. |
36 | # compression. |
| 44 | |
37 | |
| 45 | [ -z "$ECVS_CVS_COMMAND" ] && ECVS_CVS_COMMAND="cvs -q -f -z4" |
38 | [[ -z ${ECVS_CVS_COMPRESS} ]] && ECVS_CVS_COMPRESS="-z1" |
|
|
39 | [[ -z ${ECVS_CVS_OPTIONS} ]] && ECVS_CVS_OPTIONS="-q -f" |
|
|
40 | [[ -z ${ECVS_CVS_COMMAND} ]] && ECVS_CVS_COMMAND="cvs ${ECVS_CVS_OPTIONS} ${ECVS_CVS_COMPRESS}" |
| 46 | |
41 | |
| 47 | |
42 | |
| 48 | # ECVS_UP_OPTS, ECVS_CO_OPTS -- CVS options given after the cvs |
43 | # ECVS_UP_OPTS, ECVS_CO_OPTS -- CVS options given after the cvs |
| 49 | # command (update or checkout). |
44 | # command (update or checkout). |
| 50 | # |
45 | # |
| … | |
… | |
| 71 | |
66 | |
| 72 | |
67 | |
| 73 | # ECVS_TOP_DIR -- The directory under which CVS modules are checked |
68 | # ECVS_TOP_DIR -- The directory under which CVS modules are checked |
| 74 | # out. |
69 | # out. |
| 75 | |
70 | |
| 76 | [ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="${DISTDIR}/cvs-src" |
71 | [ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src" |
| 77 | |
72 | |
| 78 | # ECVS_NAME -- CVS path |
73 | # ECVS_SERVER -- CVS path |
| 79 | # |
74 | # |
| 80 | # The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde". |
75 | # The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde". |
| 81 | # Remove the other parts of the full CVSROOT, which might look like |
76 | # Remove the other parts of the full CVSROOT, which might look like |
| 82 | # ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated |
77 | # ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated |
| 83 | # using other settings also. |
78 | # using other settings also. |
| … | |
… | |
| 108 | # |
103 | # |
| 109 | # Possible values are "pserver" and "ext". If `ext' authentication is |
104 | # Possible values are "pserver" and "ext". If `ext' authentication is |
| 110 | # used, the remote shell to use can be specified in CVS_RSH (SSH is |
105 | # used, the remote shell to use can be specified in CVS_RSH (SSH is |
| 111 | # used by default). Currently, the only supported remote shell for |
106 | # used by default). Currently, the only supported remote shell for |
| 112 | # `ext' authentication is SSH. |
107 | # `ext' authentication is SSH. |
|
|
108 | # |
|
|
109 | # Armando Di Cianno <fafhrd@gentoo.org> 2004/09/27 |
|
|
110 | # - Added "no" as a server type, which uses no AUTH method, nor |
|
|
111 | # does it login |
|
|
112 | # e.g. |
|
|
113 | # "cvs -danoncvs@savannah.gnu.org:/cvsroot/backbone co System" |
|
|
114 | # ( from gnustep-apps/textedit ) |
| 113 | [ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" |
115 | [ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" |
| 114 | |
116 | |
| 115 | # ECVS_USER -- Username to use for authentication on the remote server |
117 | # ECVS_USER -- Username to use for authentication on the remote server |
| 116 | [ -z "$ECVS_USER" ] && ECVS_USER="anonymous" |
118 | [ -z "$ECVS_USER" ] && ECVS_USER="anonymous" |
| 117 | |
|
|
| 118 | |
119 | |
| 119 | # ECVS_PASS -- Password to use for authentication on the remote server |
120 | # ECVS_PASS -- Password to use for authentication on the remote server |
| 120 | [ -z "$ECVS_PASS" ] && ECVS_PASS="" |
121 | [ -z "$ECVS_PASS" ] && ECVS_PASS="" |
| 121 | |
122 | |
| 122 | |
123 | |
| … | |
… | |
| 150 | # --- end ebuild-configurable settings --- |
151 | # --- end ebuild-configurable settings --- |
| 151 | |
152 | |
| 152 | # add cvs to deps |
153 | # add cvs to deps |
| 153 | # ssh is used for ext auth |
154 | # ssh is used for ext auth |
| 154 | # sudo is used to run as a specified user |
155 | # sudo is used to run as a specified user |
| 155 | DEPEND="$DEPEND dev-util/cvs app-admin/sudo" |
156 | DEPEND="dev-util/cvs" |
|
|
157 | |
|
|
158 | [ -n "$ECVS_RUNAS" ] && DEPEND="$DEPEND app-admin/sudo" |
| 156 | |
159 | |
| 157 | if [ "$ECVS_AUTH" == "ext" ]; then |
160 | if [ "$ECVS_AUTH" == "ext" ]; then |
| 158 | #default to ssh |
161 | #default to ssh |
| 159 | [ -z "$CVS_RSH" ] && export SSH_RSH="ssh" |
162 | [ -z "$CVS_RSH" ] && export CVS_RSH="ssh" |
| 160 | if [ "$CVS_RSH" != "ssh" ]; then |
163 | if [ "$CVS_RSH" != "ssh" ]; then |
| 161 | die "Support for ext auth with clients other than ssh has not been implemented yet" |
164 | die "Support for ext auth with clients other than ssh has not been implemented yet" |
| 162 | fi |
165 | fi |
| 163 | DEPEND="$DEPEND net-misc/openssh" |
166 | DEPEND="${DEPEND} net-misc/openssh" |
| 164 | fi |
167 | fi |
| 165 | |
168 | |
| 166 | # called from cvs_src_unpack |
169 | # called from cvs_src_unpack |
| 167 | cvs_fetch() { |
170 | cvs_fetch() { |
| 168 | |
171 | |
| … | |
… | |
| 171 | |
174 | |
| 172 | local ECVS_COMMAND="${ECVS_COMMAND}" |
175 | local ECVS_COMMAND="${ECVS_COMMAND}" |
| 173 | local ECVS_UP_OPTS="${ECVS_UP_OPTS}" |
176 | local ECVS_UP_OPTS="${ECVS_UP_OPTS}" |
| 174 | local ECVS_CO_OPTS="${ECVS_CO_OPTS}" |
177 | local ECVS_CO_OPTS="${ECVS_CO_OPTS}" |
| 175 | |
178 | |
| 176 | # Fix for sourceforge which doesnt want -z>3 anymore. |
|
|
| 177 | |
|
|
| 178 | (echo $ECVS_SERVER | grep -q sourceforge) \ |
|
|
| 179 | && [ "$ECVS_CVS_COMMAND" == "cvs -q -f -z4" ] \ |
|
|
| 180 | && ECVS_CVS_COMMAND="cvs -q -f -z3" |
|
|
| 181 | |
|
|
| 182 | debug-print-function $FUNCNAME $* |
179 | debug-print-function $FUNCNAME $* |
| 183 | |
180 | |
| 184 | # Update variables that are modified by ebuild parameters, which |
181 | # Update variables that are modified by ebuild parameters, which |
| 185 | # should be effective every time cvs_fetch is called, and not just |
182 | # should be effective every time cvs_fetch is called, and not just |
| 186 | # every time cvs.eclass is inherited |
183 | # every time cvs.eclass is inherited |
| 187 | |
184 | |
| 188 | |
|
|
| 189 | # Handle parameter for local (non-recursive) fetching |
185 | # Handle parameter for local (non-recursive) fetching |
| 190 | |
186 | |
| 191 | if [ -n "$ECVS_LOCAL" ]; then |
187 | if [ -n "$ECVS_LOCAL" ]; then |
| 192 | ECVS_UP_OPTS="$ECVS_UP_OPTS -l" |
188 | ECVS_UP_OPTS="$ECVS_UP_OPTS -l" |
| 193 | ECVS_CO_OPTS="$ECVS_CO_OPTS -l" |
189 | ECVS_CO_OPTS="$ECVS_CO_OPTS -l" |
| 194 | fi |
190 | fi |
| 195 | |
191 | |
| 196 | # Handle ECVS_BRANCH option |
192 | # Handle ECVS_BRANCH option |
| 197 | # |
193 | # |
| 198 | # Because CVS auto-switches branches, we just have to pass the |
194 | # Because CVS auto-switches branches, we just have to pass the |
| 199 | # correct -rBRANCH option when updating. |
195 | # correct -rBRANCH option when updating. |
| 200 | |
196 | |
| 201 | if [ -n "$ECVS_BRANCH" ]; then |
197 | if [ -n "$ECVS_BRANCH" ]; then |
| 202 | ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" |
198 | ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" |
| … | |
… | |
| 268 | fi |
264 | fi |
| 269 | |
265 | |
| 270 | |
266 | |
| 271 | # Our server string (i.e. CVSROOT) without the password so it can |
267 | # Our server string (i.e. CVSROOT) without the password so it can |
| 272 | # be put in Root |
268 | # be put in Root |
|
|
269 | if [ "$ECVS_AUTH" == "no" ] |
|
|
270 | then |
| 273 | local server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" |
271 | local server="${ECVS_USER}@${ECVS_SERVER}" |
|
|
272 | else |
|
|
273 | local connection="${ECVS_AUTH}" |
|
|
274 | [[ -n ${ECVS_PROXY} ]] && connection="${connection};proxy=${ECVS_PROXY}" |
|
|
275 | [[ -n ${ECVS_PROXY_PORT} ]] && connection="${connection};proxyport=${ECVS_PROXY_PORT}" |
|
|
276 | local server=":${connection}:${ECVS_USER}@${ECVS_SERVER}" |
|
|
277 | fi |
| 274 | |
278 | |
| 275 | # Switch servers automagically if needed |
279 | # Switch servers automagically if needed |
| 276 | if [ "$mode" == "update" ]; then |
280 | if [ "$mode" == "update" ]; then |
| 277 | cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME |
281 | cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME |
| 278 | local oldserver="`$run cat CVS/Root`" |
282 | local oldserver="`$run cat CVS/Root`" |
| 279 | if [ "$server" != "$oldserver" ]; then |
283 | if [ "$server" != "$oldserver" ]; then |
| 280 | |
284 | |
| 281 | einfo "Changing the CVS server from $oldserver to $server:" |
285 | einfo "Changing the CVS server from $oldserver to $server:" |
| 282 | debug-print "$FUNCNAME: Changing the CVS server from $oldserver to $server:" |
286 | debug-print "$FUNCNAME: Changing the CVS server from $oldserver to $server:" |
| 283 | |
287 | |
| 284 | einfo "Searching for CVS directories..." |
288 | einfo "Searching for CVS directories ..." |
| 285 | local cvsdirs="`$run find . -iname CVS -print`" |
289 | local cvsdirs="`$run find . -iname CVS -print`" |
| 286 | debug-print "$FUNCNAME: CVS directories found:" |
290 | debug-print "$FUNCNAME: CVS directories found:" |
| 287 | debug-print "$cvsdirs" |
291 | debug-print "$cvsdirs" |
| 288 | |
292 | |
| 289 | einfo "Modifying CVS directories..." |
293 | einfo "Modifying CVS directories ..." |
| 290 | for x in $cvsdirs; do |
294 | for x in $cvsdirs; do |
| 291 | debug-print "In $x" |
295 | debug-print "In $x" |
| 292 | $run echo "$server" > "$x/Root" |
296 | $run echo "$server" > "$x/Root" |
| 293 | done |
297 | done |
| 294 | |
298 | |
| … | |
… | |
| 306 | # The server string with the password in it, for login |
310 | # The server string with the password in it, for login |
| 307 | cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}" |
311 | cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}" |
| 308 | |
312 | |
| 309 | # Ditto without the password, for checkout/update after login, so |
313 | # Ditto without the password, for checkout/update after login, so |
| 310 | # that the CVS/Root files don't contain the password in plaintext |
314 | # that the CVS/Root files don't contain the password in plaintext |
|
|
315 | if [ "$ECVS_AUTH" == "no" ] |
|
|
316 | then |
|
|
317 | cvsroot_nopass="${ECVS_USER}@${ECVS_SERVER}" |
|
|
318 | else |
| 311 | cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" |
319 | cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" |
|
|
320 | fi |
| 312 | |
321 | |
| 313 | # Commands to run |
322 | # Commands to run |
| 314 | cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login" |
323 | cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login" |
| 315 | cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}" |
324 | cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}" |
| 316 | cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" |
325 | cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" |
| … | |
… | |
| 323 | eval $cmdlogin || die "cvs login command failed" |
332 | eval $cmdlogin || die "cvs login command failed" |
| 324 | if [ "${mode}" == "update" ]; then |
333 | if [ "${mode}" == "update" ]; then |
| 325 | einfo "Running $cmdupdate" |
334 | einfo "Running $cmdupdate" |
| 326 | eval $cmdupdate || die "cvs update command failed" |
335 | eval $cmdupdate || die "cvs update command failed" |
| 327 | elif [ "${mode}" == "checkout" ]; then |
336 | elif [ "${mode}" == "checkout" ]; then |
| 328 | einfo "Running $cmdcheckout" |
337 | einfo "Running $cmdcheckout" |
| 329 | eval $cmdcheckout|| die "cvs checkout command failed" |
338 | eval $cmdcheckout|| die "cvs checkout command failed" |
| 330 | fi |
339 | fi |
| 331 | elif [ "${ECVS_AUTH}" == "ext" ]; then |
340 | elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then |
| 332 | |
341 | |
| 333 | # Hack to support SSH password authentication |
342 | # Hack to support SSH password authentication |
| 334 | |
343 | |
| 335 | # Backup environment variable values |
344 | # Backup environment variable values |
| 336 | local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}" |
345 | local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}" |
| … | |
… | |
| 368 | except: |
377 | except: |
| 369 | pass |
378 | pass |
| 370 | newarglist = sys.argv[:] |
379 | newarglist = sys.argv[:] |
| 371 | EOF |
380 | EOF |
| 372 | |
381 | |
|
|
382 | # disable X11 forwarding which causes .xauth access violations |
|
|
383 | # - 20041205 Armando Di Cianno <fafhrd@gentoo.org> |
|
|
384 | echo "newarglist.insert(1, '-oClearAllForwardings=yes')" \ |
|
|
385 | >> "${CVS_RSH}" |
|
|
386 | echo "newarglist.insert(1, '-oForwardX11=no')" \ |
|
|
387 | >> "${CVS_RSH}" |
|
|
388 | |
| 373 | # Handle SSH host key checking |
389 | # Handle SSH host key checking |
| 374 | |
390 | |
| 375 | local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts" |
391 | local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts" |
| 376 | echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \ |
392 | echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \ |
| 377 | >> "${CVS_RSH}" |
393 | >> "${CVS_RSH}" |
| … | |
… | |
| 379 | if [ -z "${ECVS_SSH_HOST_KEY}" ]; then |
395 | if [ -z "${ECVS_SSH_HOST_KEY}" ]; then |
| 380 | ewarn "Warning: The SSH host key of the remote server will not be verified." |
396 | ewarn "Warning: The SSH host key of the remote server will not be verified." |
| 381 | einfo "A temporary known hosts list will be used." |
397 | einfo "A temporary known hosts list will be used." |
| 382 | local CVS_ECLASS_STRICT_HOST_CHECKING="no" |
398 | local CVS_ECLASS_STRICT_HOST_CHECKING="no" |
| 383 | touch "${CVS_ECLASS_KNOWN_HOSTS}" |
399 | touch "${CVS_ECLASS_KNOWN_HOSTS}" |
| 384 | echo "newarglist.insert(1, '-oStrictHostKeyChecking=no')" \ |
|
|
| 385 | >> "${CVS_RSH}" |
|
|
| 386 | else |
400 | else |
| 387 | local CVS_ECLASS_STRICT_HOST_CHECKING="yes" |
401 | local CVS_ECLASS_STRICT_HOST_CHECKING="yes" |
| 388 | echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}" |
402 | echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}" |
| 389 | fi |
403 | fi |
| 390 | |
404 | |
| … | |
… | |
| 393 | echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \ |
407 | echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \ |
| 394 | >> "${CVS_RSH}" |
408 | >> "${CVS_RSH}" |
| 395 | echo "os.execv('/usr/bin/ssh', newarglist)" \ |
409 | echo "os.execv('/usr/bin/ssh', newarglist)" \ |
| 396 | >> "${CVS_RSH}" |
410 | >> "${CVS_RSH}" |
| 397 | |
411 | |
| 398 | chmod a+x "${CVS_RSH}" |
412 | chmod a+x "${CVS_RSH}" |
| 399 | |
413 | |
| 400 | # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS |
414 | # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS |
| 401 | # if DISPLAY is not set) |
415 | # if DISPLAY is not set) |
| 402 | |
416 | |
| 403 | [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY" |
417 | [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY" |
| 404 | export DISPLAY |
418 | export DISPLAY |
| 405 | |
419 | |
| 406 | # Create a dummy executable to echo $ECVS_PASS |
420 | # Create a dummy executable to echo $ECVS_PASS |
| 407 | |
421 | |
| 408 | export SSH_ASKPASS="${T}/cvs_sshechopass" |
422 | export SSH_ASKPASS="${T}/cvs_sshechopass" |
| 409 | |
423 | if [ "${ECVS_AUTH}" != "no" ]; then |
| 410 | echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ |
424 | echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ |
| 411 | > "${SSH_ASKPASS}" |
425 | > "${SSH_ASKPASS}" |
|
|
426 | else |
|
|
427 | echo -en "#!/bin/bash\nreturn\n" \ |
|
|
428 | > "${SSH_ASKPASS}" |
| 412 | |
429 | |
|
|
430 | fi |
| 413 | chmod a+x "${SSH_ASKPASS}" |
431 | chmod a+x "${SSH_ASKPASS}" |
| 414 | fi |
432 | fi |
| 415 | |
433 | |
| 416 | if [ "${mode}" == "update" ]; then |
434 | if [ "${mode}" == "update" ]; then |
| 417 | einfo "Running $cmdupdate" |
435 | einfo "Running $cmdupdate" |
| 418 | eval $cmdupdate || die "cvs update command failed" |
436 | eval $cmdupdate || die "cvs update command failed" |
| 419 | elif [ "${mode}" == "checkout" ]; then |
437 | elif [ "${mode}" == "checkout" ]; then |
| 420 | einfo "Running $cmdcheckout" |
438 | einfo "Running $cmdcheckout" |
| 421 | eval $cmdcheckout|| die "cvs checkout command failed" |
439 | eval $cmdcheckout|| die "cvs checkout command failed" |
| 422 | fi |
440 | fi |
| 423 | |
441 | |
| 424 | # Restore environment variable values |
442 | # Restore environment variable values |
| 425 | export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}" |
443 | export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}" |
| 426 | if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then |
444 | if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then |
| 427 | export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}" |
445 | export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}" |
| 428 | else |
446 | else |
| … | |
… | |
| 465 | [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue." |
483 | [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue." |
| 466 | |
484 | |
| 467 | local ECVS_LOCALNAME="${ECVS_LOCALNAME}" |
485 | local ECVS_LOCALNAME="${ECVS_LOCALNAME}" |
| 468 | |
486 | |
| 469 | if [ -z "$ECVS_LOCALNAME" ]; then |
487 | if [ -z "$ECVS_LOCALNAME" ]; then |
| 470 | ECVS_LOCALNAME="$ECVS_MODULE" |
488 | ECVS_LOCALNAME="$ECVS_MODULE" |
| 471 | fi |
489 | fi |
| 472 | |
490 | |
| 473 | if [ "$ECVS_SERVER" == "offline" ]; then |
491 | local sanitized_pn=$(echo "${PN}" | LC_ALL=C sed -e 's:[^A-Za-z0-9_]:_:g') |
|
|
492 | local offline_pkg_var="ECVS_OFFLINE_${sanitized_pn}" |
|
|
493 | if [ "${!offline_pkg_var}" == "1" -o "$ECVS_OFFLINE" == "1" -o "$ECVS_SERVER" == "offline" ]; then |
| 474 | # We're not required to fetch anything; the module already |
494 | # We're not required to fetch anything; the module already |
| 475 | # exists and shouldn't be updated. |
495 | # exists and shouldn't be updated. |
| 476 | if [ -d "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" ]; then |
496 | if [ -d "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" ]; then |
| 477 | debug-print "$FUNCNAME: offline mode" |
497 | debug-print "$FUNCNAME: offline mode" |
| 478 | else |
498 | else |
| 479 | debug-print "$FUNCNAME: Offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error" |
499 | debug-print "$FUNCNAME: Offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error" |
| 480 | die "ERROR: Offline mode specified, but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting." |
500 | die "ERROR: Offline mode specified, but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting." |
| 481 | fi |
501 | fi |
| 482 | elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode |
502 | elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode |
| 483 | einfo "Fetching CVS module $ECVS_MODULE into $ECVS_TOP_DIR..." |
503 | einfo "Fetching CVS module $ECVS_MODULE into $ECVS_TOP_DIR ..." |
| 484 | cvs_fetch |
504 | cvs_fetch |
| 485 | else # ECVS_SERVER not set |
505 | else # ECVS_SERVER not set |
| 486 | die "ERROR: CVS server not specified, cannot continue." |
506 | die "ERROR: CVS server not specified, cannot continue." |
| 487 | fi |
507 | fi |
| 488 | |
508 | |
| 489 | einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR..." |
509 | einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR ..." |
| 490 | debug-print "Copying module $ECVS_MODULE local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR..." |
510 | debug-print "Copying module $ECVS_MODULE local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR ..." |
| 491 | |
511 | |
| 492 | # This is probably redundant, but best to make sure. |
512 | # This is probably redundant, but best to make sure. |
| 493 | mkdir -p "$WORKDIR/$ECVS_LOCALNAME" |
513 | mkdir -p "$WORKDIR/$ECVS_LOCALNAME" |
| 494 | |
514 | |
| 495 | if [ -n "$ECVS_LOCAL" ]; then |
515 | if [ -n "$ECVS_LOCAL" ]; then |
| … | |
… | |
| 510 | # Implement some of base_src_unpack's functionality; note however |
530 | # Implement some of base_src_unpack's functionality; note however |
| 511 | # that base.eclass may not have been inherited! |
531 | # that base.eclass may not have been inherited! |
| 512 | if [ -n "$PATCHES" ]; then |
532 | if [ -n "$PATCHES" ]; then |
| 513 | debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching" |
533 | debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching" |
| 514 | cd "$S" |
534 | cd "$S" |
| 515 | for x in $PATCHES; do |
535 | epatch ${PATCHES} |
| 516 | debug-print "patching from $x" |
|
|
| 517 | patch -p0 < "$x" |
|
|
| 518 | done |
|
|
| 519 | # Make sure we don't try to apply patches more than once, |
536 | # Make sure we don't try to apply patches more than once, |
| 520 | # since cvs_src_unpack is usually called several times from |
537 | # since cvs_src_unpack is usually called several times from |
| 521 | # e.g. kde-source_src_unpack |
538 | # e.g. kde-source_src_unpack |
| 522 | export PATCHES="" |
539 | export PATCHES="" |
| 523 | fi |
540 | fi |
| 524 | |
541 | |
| 525 | einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}" |
542 | einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}" |
| 526 | } |
543 | } |
| 527 | |
544 | |
| 528 | EXPORT_FUNCTIONS src_unpack |
545 | EXPORT_FUNCTIONS src_unpack |