File: prepare_new_stable

package info (click to toggle)
coinutils 2.11.4%2Brepack1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,212 kB
  • sloc: cpp: 73,714; sh: 11,224; makefile: 276; ansic: 35
file content (752 lines) | stat: -rwxr-xr-x 22,010 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
#!/bin/sh

# Copyright (C) 2007  International Business Machines.
# All Rights Reserved.
# This file is distributed under the Eclipse Public License.
# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
#
# $Id: prepare_new_stable 3946 2019-02-24 17:55:35Z stefan $
#
# Adapted from prepare_new_release by Lou Hafer, SFU, 100507. 

#set -x -v
set -e

# Know thy self. If there are no '/' chars in the command name, we're running
# in the current directory. Otherwise, strip the command name, leaving the
# prefix.  Coin-functions is expected to live in the same directory.

if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then
  cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'`
else
  cmdDir='.'
fi
cmdDir=`cd $cmdDir ; pwd`
if test -r $cmdDir/coin-functions ; then
  . $cmdDir/coin-functions
else
  echo "Cannot find utility functions file coin-functions; exiting."
fi
#################### end of function definitions ##########################


# Note that plain sh does not accept negative exit values

exitValue=0

# Specify the COIN URL base for convenience.

coinURL="https://projects.coin-or.org/svn"

# Begin parameter processing.

printHelp=0
ignoreBuildToolsMismatch=no
mismatchBTExternals=
bumpMajor=0
suppressCheckout=0

# srcURL will be the parent for the stable we are building. We'll need to be
# able to distinguish ThirdParty and Data builds, and BuildTools itself; they
# require special handling.  cmdBTURL points to a BuildTools source and is
# required when srcURL specifies a ThirdParty or Data project --- we'll need to
# assemble a temporary package while creating the stable candidate.

srcURL=
isThirdParty=no
isData=no
isBuildTools=no
cmdBTURL=

# trunkExternals specifies externals for which we want to do simultaneous
# creation of stable branches. We will use the trunk as the external while
# preparing and testing the stable candidate, changing the Dependencies file
# to specify a (nonexistent) stable branch of the external at the last moment.

trunkExternals=

# exciseExternals specifies externals that should be removed when creating the
# new stable branch.

exciseExternals=

# We need at least one parameter.

if test "$#" -eq 0; then
  printHelp=1
else

# Process the parameters. A parameter without an opening `-' is assumed to be
# the spec for the source branch.

  while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do
    case "$1" in
      -h* | --h*) printHelp=1 ;;
      -i* | --i*)
	   if expr "$1" : '.*-i.*=.*' 2>&1 >/dev/null ; then
	     mismatchBTExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
	   else
	     shift
	     mismatchBTExternals=$1
	   fi
	   if test "x$mismatchBTExternals" = "xall" ; then
	     ignoreBuildToolsMismatch=all
	   else
	     ignoreBuildToolsMismatch=partial
	   fi
	   ;;
      -m* | --m*) bumpMajor=1 ;;
      -p* | --p*) suppressCheckout=1 ;;
      -t* | --t*)
	   if expr "$1" : '.*-t.*=.*' 2>&1 >/dev/null ; then
	     trunkExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
	   else
	     shift
	     trunkExternals=$1
	   fi
	   ;;
      -x* | --x*)
	   if expr "$1" : '.*-x.*=.*' 2>&1 >/dev/null ; then
	     exciseExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
	   else
	     shift
	     exciseExternals=$1
	   fi
	   ;;
      -b* | --b*)
	   if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then
	     cmdBTURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
	   else
	     shift
	     cmdBTURL=$1
	   fi
	   if expr "$cmdBTURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then
	     case $cmdBTURL in
	       http*) ;;
		   *) cmdBTURL=${coinURL}/$cmdBTURL
		      ;;
	     esac
	   else
	     echo ''
	     echo "URL $cmdBTURL does not point to BuildTools."
	     echo ''
	     printHelp=1
	     exitValue=3
	    fi
	   ;;
      -*)  echo "$0: unrecognised command line switch '"$1"'."
	   printHelp=1
	   exitValue=1
	   ;;
       *)  srcURL=$1
	   case $srcURL in
	     http* ) ;;
	     BuildTools/ThirdParty/* )
		 srcURL=${coinURL}/$srcURL
		 ;;
	     ThirdParty/* )
		 srcURL=${coinURL}/BuildTools/$srcURL
		 ;;
	     * ) srcURL=${coinURL}/$srcURL
		    ;;
	   esac
	   ;;
    esac
    shift
  done

# Consistency check: Make sure that the source URL exists.  Note that it's not
# possible to specify a Data URL without including trunk/stable/release in the
# URL. For others, helpfully append `trunk'.

  srcURL=`echo $srcURL | sed -e 's/\/$//'`
  urlType=`extractTypeFromURL "$srcURL"`
  if test $printHelp = 0 && test $exitValue = 0 ; then
    if svn list $srcURL 2>&1 >/dev/null ; then
      :
    else
      echo "Source URL $srcURL does not seem to exist."
      printHelp=1
      exitValue=5
    fi
    if test "$urlType" = invalid ; then
      srcURL=$srcURL/trunk
      urlType=trunk
    fi
  fi

# Just what are we building? Order is important; BuildTools without ThirdParty
# means we're actually doing a BuildTools stable.

  if test $printHelp = 0 && test $exitValue = 0 ; then
    case $srcURL in
      *ThirdParty* )
	isThirdParty=yes
	;;
      *BuildTools* )
	isBuildTools=yes
	;;
      *Data* )
	isData=yes
	;;
      *)
	;;
    esac

# If we're building a ThirdParty or Data release, we need a BuildTools URL.

    if test $isThirdParty = yes || test $isData = yes ; then
      if test -z "$cmdBTURL" ; then
	cmdBTURL=`bestRelease $coinURL/BuildTools -1 -1`
        echo "A BuildTools URL is required for Data or ThirdParty projects."
	echo "Using $cmdBTURL; override with -b"
      else
	if svn list $cmdBTURL 2>&1 >/dev/null ; then
	  :
	else
	  echo "BuildTools URL $cmdBTURL does not seem to exist."
	  printHelp=1
	  exitValue=6
	fi
      fi
    fi
  fi
fi  # if "$#" .eq 0

if test $printHelp = 1 ; then
  cat <<EOF
Usage: prepare_new_stable [options] <source URL>

This script will create a new stable branch from the head of the specified
URL. Typically this will be the trunk, but it can be an existing stable
branch.  You can specify the entire URL, or just enter what comes after
"https://projects.coin-or.org/svn".  A typical example is

  prepare_new_stable Ipopt/trunk

Options:
  -b <BuildToolsURL>	URL for BuildTools; required to generate a release
  			for a ThirdParty or Data project.
  -i <projectlist>	Ignore BuildTools version mismatches for the listed
  			externals (comma-separated list of project names,
			e.g., -i Osi,Cbc). '-i all' ignores all mismatches.
  -p			Suppress checkout (useful for testing)
  -m			Bump the major version number.
  -t <project-list>	Suppress conversion from trunk to stable for the
			listed externals (comma-separated list of project
			names).
  -x <project-list>	Remove the listed projects from the list of externals
			(comma-separated list of project names).

This script will do the following:

  - Set the new stable version number as the next minor version number in
    the current major version number. Use the -m flag to bump the major
    version number.

  - Convert externals from trunk to the top stable branch. Externals which
    are currently stable or release are left untouched. Use -t to suppress
    the change from trunk to stable. Set_externals is then invoked to set
    release externals where available.

  - Check out externals. The BuildTools version used by externals (if any)
    is checked, and the script issues a warning if it doesn't match the
    version used by the source URL.

  - Run the scripts to download any ThirdParty code.

  - Run run_autotools to rebuild configure and make files.

  - Run configure, make, and make test

  - Tweak the externals to upgrade trunk (-t) dependencies to stable (you
    won't get to release in this case).

If there is any error during these tasks the script will stop and you should
examine the output.

If the script completes without error, examine the output, particularly the
output of the unit test ('make test') and the set of externals specified in
the Dependencies file. Whether you start with Externals or Dependencies, the
stable will have a proper Dependencies. Externals will be unmodified.

This script does not make any changes to the repository.  If you want to
commit the new stable branch, run the "commit_new_stable" script, as described
at the end of the output.

EOF
fi

if test $exitValue != 0 || test $printHelp = 1 ; then
  exit $exitValue
fi

# End of parameter parsing. We have a source URL to work with.  Tell the
# user what we've seen.

srcURL=`echo $srcURL | sed -e 's|/$||'`
srcProj=`extractProjFromURL $srcURL`

echo "Source URL..........: $srcURL"
echo "Base project........: $srcProj"
if test $isThirdParty = yes || test $isData = yes ; then
  echo "BuildTools URL......: $cmdBTURL"
fi

# Figure out the URL of the new stable branch. Consider that there may not be
# any existing stable branches.

topStableURL=`bestStable $srcURL -1`
echo "Top stable URL......: ${topStableURL:-none}"

if test -z "$topStableURL" ; then
  majVer=0
  minVer=1
  case "$srcURL" in
    */Data/* )
	newStableURL=$coinURL/Data/stable/$majVer.$minVer/$srcProj
	;;
    */ThirdParty/* )
	newStableURL=$coinURL/BuildTools/ThirdParty/$srcProj/stable/$majVer.$minVer
	;;
    * )
	newStableURL=$coinURL/$srcProj/stable/$majVer.$minVer
	;;
  esac
else
  majVer=`extractMajorFromURL $topStableURL`
  if test $bumpMajor = 1 ; then
    majVer=`expr $majVer + 1`
    minVer=0
  else
    minVer=`extractMinorFromURL $topStableURL`
    minVer=`expr $minVer + 1`
  fi
  newStableURL=`replaceVersionInURL $topStableURL $majVer $minVer`
fi
echo "New stable URL......: $newStableURL"
newVersion=${majVer}.${minVer}

# Construct a build directory name.

topProjName=`echo $srcProj | sed -e 's|.*/\([^/]*\)$|\1|'`
topBuildDir=${topProjName}-${newVersion}
echo "Build directory.....: $topBuildDir"

# Now decide where to check out code.

if test $isThirdParty = yes; then
  coDir=$topBuildDir/Thirdparty/$srcProj
elif test $isData = yes; then
  coDir=$topBuildDir/Data/$srcProj
else
  coDir=$topBuildDir
fi
echo "Checkout directory..: $coDir"

echo ''
echo "===> Checking out source $srcURL without externals ..."
echo ''

cmd="svn co --ignore-externals $srcURL $coDir"
if test $suppressCheckout = 1 ; then
  echo "Pretending to do: $cmd"
else
  rm -rf $topBuildDir
  echo $cmd
  eval $cmd
fi

if test $isThirdParty = yes || test $isData = yes; then
  echo ''
  echo '===> Checking out BuildTools (Data or ThirdParty) ...'
  echo ''
  cmd="svn co $cmdBTURL $topBuildDir/BuildTools"
  if test $suppressCheckout = 1 ; then
    echo "Pretending to do: $cmd"
  else
    echo $cmd
    eval $cmd
  fi
fi

startDir=`pwd`
coDir=`cd $coDir; pwd`
topBuildDir=`cd $topBuildDir; pwd`

cd $coDir

# Find configure.ac files for the package and project and update the version.
# We have no externals at this point, and no third-party code, so there will
# be two files for a standard project, one for a ThirdParty or Data project.

echo ''
if test -d $topProjName ; then
  bak_files=`find $topProjName -name 'configure.ac'`
fi
if test -e configure.ac ; then
  bak_files="$bak_files configure.ac"
fi
echo "===> Creating backup (.bak) for configure.ac files..."
for i in $bak_files; do
  cp $i $i.bak
done

# Take the attitude that [] around parameters in AC_INIT is optional,
# it's the commas that count. This does make for a surpassing ugly regular
# expression.  A comma in the version string will cause a spectacular failure.
# In AC_COIN_PROJECTDIR_INIT, take the attitude that the existing parameters
# don't matter, we know what the release parameters should be.

echo ''
echo "===> Updating version numbers in configure.ac files"
for i in $bak_files; do
  sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVersion\3,\4|" $i > bla
  mv bla $i
  svn diff $i
done

# Find config_proj_default.h. If there's a definition for PROJ_VERSION, adjust it and
# add config_proj_default.h.bak to the list of files to be restored.

topProjNameUC=`echo $topProjName | tr '[a-z]' '[A-Z]'`
if test -d $topProjName ; then
  configFileLoc=`find $topProjName -name .svn -prune -o -name 'config_*_default.h' -print`
fi
echo "config File Loc: $configFileLoc"
if test -n "$configFileLoc" ; then
  versionSym=${topProjNameUC}_VERSION
  echo ''
  echo "===> Updating $versionSym in $configFileLoc (if present)"
  echo ''
  mv $configFileLoc $configFileLoc.bak
  bak_files="$bak_files $configFileLoc"
  sed -e "s/# *define $versionSym .*\$/#define $versionSym \"$newVersion\"/" \
    -e "s/# *define ${versionSym}_MAJOR .*\$/#define ${versionSym}_MAJOR $majVer/" \
    -e "s/# *define ${versionSym}_MINOR .*\$/#define ${versionSym}_MINOR $minVer/" \
    -e "s/# *define ${versionSym}_RELEASE .*\$/#define ${versionSym}_RELEASE 9999/" \
  <$configFileLoc.bak >$configFileLoc
  svn diff $configFileLoc
fi

# Now generate a proper Dependencies file for the stable branch.  References to
# trunk will be converted to references to stable branches unless the reference
# is to a project in the trunkExternals list (in which case it'll be converted
# at the very end). References to releases are not changed. Each line in a
# Dependencies file has the format <ext_name> <ext_url>. Normally, each entry
# should be a stable branch.

srcDepFile=
for file in Dependencies Externals ; do
  if test -r $file ; then
    srcDepFile=$file
    break
  fi
done

if test -n "$srcDepFile" ; then

# Save the externals property of the source, so we can just restore it after
# the commit. Also save srcDepFile, because we may well modify it for the
# stable branch, converting trunk externals to stable externals.

  svn propget svn:externals . > .Externals.original
  bak_files="$bak_files $srcDepFile"
  cp $srcDepFile $srcDepFile.bak

  echo ''
  echo "===> Checking externals in $srcDepFile ..."
  echo ''

# We've just checked this out, no sense going back to the server for the
# BuildTools version. Because of the intermediate variable, newline has
# become space.

  srcExternals=`svn propget svn:externals .`
  srcBTURL=`echo $srcExternals | \
	    sed -n -e 's/.*BuildTools *https:\([^ ]*\) .*/https:\1/p'`
  if test -z "$srcBTURL" ; then
    srcBTURL="none"
  fi
  echo "Source BuildTools...:  $srcBTURL"

  rm -f Dependencies
  ext_name=
  ext_url=
  buildtoolsMismatch=0
  for i in `cat $srcDepFile.bak` ; do
    if test "$ext_name" = "" ; then
      ext_name=$i
    else
      ext_url=$i
      if expr "$ext_name" : '#.*' 2>&1 >/dev/null ; then
        echo "    $ext_name $ext_url ==> skipped"
        ext_name=
        continue
      fi
      ext_urltype=`extractTypeFromURL $ext_url`
      ext_proj=`extractProjFromURL $ext_url`

# See if this external should be dropped.

      if expr "$exciseExternals" : '.*'$ext_proj'.*' 2>&1 > /dev/null ; then
        echo "    $ext_name $ext_url ==> excised"
	ext_name=
	continue
      fi

      ext_isNormalURL=`isNormalURL $ext_url`

# Convert a trunk URL to stable unless it's listed in trunkExternals.

      if test $ext_urltype = trunk ; then
        if expr "$trunkExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then
	  echo "    $ext_name $ext_url ==> unchanged"
	else
	  ext_oldurl=$ext_url
	  ext_url=`bestStable $ext_url -1`
	  # Normal (not BuildTools/ThirdParty/Data) need a directory name,
	  # and it may differ from the project name. Carefully preserve it.
	  if test $ext_isNormalURL = yes ; then
	    ext_tail=`extractTailFromExt $ext_oldurl`
	    ext_url=${ext_url}${ext_tail}
	  fi
	  echo "    $ext_name $ext_oldurl ==> $ext_url"
	fi
      else
        echo "    $ext_name $ext_url ==> unchanged"
      fi

# Get the BuildTools URL for the external and compare to the BuildTools URL
# for the source, assuming we have one and the external has one.

      if test $ext_isNormalURL = yes &&
         test $ext_proj != BuildTools && test $srcBTURL != none ; then
        ext_url_notail=`echo $ext_url | sed -e 's,/[^/]*$,,'`
	extBTURL=`svn propget svn:externals $ext_url_notail || :`
	extBTURL=`echo $extBTURL | \
	  sed -n -e 's/^BuildTools *https:\([^ ]*\) *$/https:\1/p'`
	if test -n "$extBTURL" ; then
	  testResult=`compareURLVersions "$srcBTURL" "$extBTURL"`
	  if test $testResult = no ; then
	    if test $ignoreBuildToolsMismatch = all || \
	       expr "$mismatchBTExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then
	      echo "    WARNING: BuildTools mismatch: $ext_url_notail uses $extBTURL"
	    else
	      buildtoolsMismatch=1
	      echo "    ERROR: BuildTools mismatch: $ext_url_notail uses $extBTURL"
	    fi
	  fi
	fi
      fi

      echo "$ext_name  $ext_url" >>Dependencies
      ext_name=
      echo ''
    fi
  done

# If we have a BuildTools mismatch, exit.

  if test $buildtoolsMismatch = 1 ; then
    echo "Exiting due to BuildTools mismatches; use -i to ignore."
    exit 2
  fi

  $cmdDir/set_externals Dependencies

# Try three times to check out externals before conceding defeat.

  echo ''
  echo '===> Checking out externals ...'
  echo ''

  svn update ||
  { echo "Retry 1 ... " ; svn update ; } ||
  { echo "Retry 2 ... " ; svn update ; } ||
  { echo "Checkout of externals failed. Aborting." ; exit 3 ; }

# Run any scripts to acquire ThirdParty code.

  if test -d ThirdParty ; then

    echo ''
    echo '===> Downloading ThirdParty code ...'
    echo ''
    
    ext_name=
    ext_url=
    for i in `svn propget svn:externals .` ; do
      if test -z "$ext_name" ; then
        ext_name=$i
      else
        ext_url=$i
	if expr "$ext_name" : 'ThirdParty/.*' 2>&1 >/dev/null ; then
	  cd $ext_name
	  ext_proj=`extractProjFromURL $ext_url`
	  getScript=get.$ext_proj
	  if test -x "$getScript" ; then
	    ./$getScript -y
	  fi
	  cd $coDir
	fi
	ext_name=
      fi
    done
  fi
fi


# Done processing externals. If this is a ThirdParty project, we still have
# to run the get script.

if test $isThirdParty = yes; then
  if test -x get.$srcProj ; then
    echo ''
    echo '===> Downloading third party code...'
    echo ''
    ./get.$srcProj -y
  fi
fi

# Run the autotools to update configure and make files

echo ''
echo '===> Running BuildTools/run_autotools ...'
echo ''

if test $isThirdParty = yes || test $isData = yes ; then
  cd ../..
  ./BuildTools/run_autotools
  cd "$coDir"
else
  ./BuildTools/run_autotools
fi

# Let's see if it works. We only run tests for non-ThirdParty, non-Data. DO NOT
# turn on --enable-maintainer-mode in the initial configure command. At the
# least, it's not needed. At the worst, as of 100526, it'll undo all the
# careful work above to set externals.

if test $isThirdParty != yes && test $isData != yes; then (
   set -e
   echo ''
   echo '===> Creating build directory and running the configuration script...'
   echo ''
   mkdir build
   cd build
   cmd="$coDir/configure -C"
   echo $cmd
   eval $cmd
   echo ''
   echo '===> Compiling code...'
   echo ''
   cmd='make install'
   echo $cmd
   eval $cmd
   echo ''
   echo '===> Running the unit test...'
   echo ''
   echo '*******************************************************************************'
   echo '***                                                                         ***'
   echo '***                       BEGIN OUTPUT OF MAKE TEST                         ***'
   echo '***                                                                         ***'
   echo '*******************************************************************************'
   echo ''
   cmd='make test'
   echo $cmd
   eval $cmd
   echo ''
   echo '*******************************************************************************'
   echo '***                                                                         ***'
   echo '***                        END OUTPUT OF MAKE TEST                          ***'
   echo '***                                                                         ***'
   echo '*******************************************************************************'
  )
  if test $? != 0; then
    echo ''
    echo 'Error during build or test'
    echo ''
    exit 3
  fi
fi

# No fatal errors. Declare victory.

echo ''
echo '===> ALL TESTS PASSED'
if test $isThirdParty != yes &&
   test $isData != yes && test $isBuildTools != yes ; then
  echo ''
  echo 'Please review the output above, particularly the one of make test'
fi
echo ''

# Do we need to plug in nonexistent stable branches for circular dependencies
# tested with the trunk? If so, generate a new Dependencies. This is the only
# reason trunk references should appear in the externals for a stable branch,
# so we don't need to check further before removing them.

if test -n "$trunkExternals" ; then
  echo ''
  echo "===> Grooming externals to remove trunk references used for testing."
  echo ''
  mv Dependencies Dependencies.temp.$$
  ext_name=
  ext_url=
  for i in `cat Dependencies.temp.$$`; do
    if test "$ext_name" = ""; then
      ext_name="$i"
    else
      ext_url=$i
      ext_urltype=`extractTypeFromURL $ext_url`
      ext_proj=`extractProjFromURL $ext_url`
      if test $ext_urltype = trunk ; then
	ext_oldurl=$ext_url
	ext_url=`bestStable $ext_url -1`
	ext_majVer=`extractMajorFromURL $ext_url`
	ext_minVer=`extractMinorFromURL $ext_url`
	ext_minVer=`expr $ext_minVer + 1`
	ext_url=`replaceVersionInURL $ext_url $ext_majVer $ext_minVer`
	ext_isNormal=`isNormalURL $ext_url`
	if test $ext_isNormal = yes ; then
	  ext_url="${ext_url}${ext_proj}"
	fi
	echo "    $ext_name $ext_oldurl ==> $ext_url"
      fi
      echo "$ext_name  $ext_url" >>Dependencies
      ext_name=
    fi
  done
  rm -f Dependencies.temp.$$
  $cmdDir/set_externals Dependencies
fi

if test -r Dependencies ; then
  echo ''
  echo 'Also, please confirm the Externals are correct:'
  svn propget svn:externals
fi

echo ''
echo 'After reviewing the output above, you can create a new stable by going into'
echo 'the directory'
echo ''
echo "          $startDir"
echo ''
echo "and run the commit_new_stable script"

cd $topBuildDir

# Record information for the commit_new_stable script.

cat >.new_stable_data <<EOF
coinURL=$coinURL
startDir=$startDir
topBuildDir=$topBuildDir
coDir=$coDir
newStableURL=$newStableURL
srcURL=$srcURL
newVersion=$newVersion
bak_files="$bak_files"
EOF