-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_new_release
executable file
·819 lines (717 loc) · 25.1 KB
/
prepare_new_release
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
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
#!/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$
#
# Author: Andreas Waechter IBM 2007-06-21
# Modified: Lou Hafer SFU 2008-01-20
# Accommodate simultaneous creation of releases with circular
# dependencies.
# Modified: Ted Ralphs Lehigh University 2009-07-10
# Set libtool version info automatically
# Modified: Lou Hafer SFU 2010-06-02
# Adapt to new script architecture pioneered in *_new_stable; major
# rewrite.
# Modified: Lou Hafer SFU 2011-03-14
# Change handling of externals so the svn:externals is left pointing to
# releases but Dependencies is left pointing to stable branches.
# Modified: Stefan Vigerske HU 2011-07-16
# Do not attempt to configure/make/make test ThirdParty projects that
# do not have a get-script, since this fails in most cases (which is
# the expected behaviour).
#set -x -v
set -e
# You can think of this script as having two sections: parameter parsing and
# validation, followed by generation of the release candidate. See the help
# message for a good description of the actions taken to generate the release
# candidate.
# Know thy self. If there are no '/' chars in the command name, we're running
# in the currrent 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
# 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=
suppressCheckout=0
# stableURL will be the stable branch that is the parent for the release we
# are building. We'll need to be able to distinguish ThirdParty and Data
# builds, and BuildTools itself; they require special handling. If a project
# is not BuildTools, ThirdParty, or Data, it's `normal'.
# SV: I think also ThirdParty projects should be treated as 'normal', so I changed that.
stableURL=
isThirdParty=no
isData=no
isBuildTools=no
isNormal=yes
# cmdBTURL is required when stableURL specifies a ThirdParty or Data
# project --- we'll need to assemble a temporary package while creating the
# release candidate.
cmdBTURL=
# stableExternals specifies externals for which we are doing simultaneous
# releases. We will use the stable branch of the external while preparing
# and testing this release candidate, changing svn:externals to specify a
# (nonexistent) release of the external at the last moment.
stableExternals=
# exciseExternals specifies externals that should be removed when creating the
# new release.
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 stable 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
;;
-p* | --p*) suppressCheckout=1 ;;
-s* | --s*)
if expr "$1" : '.*-s.*=.*' 2>&1 >/dev/null ; then
stableExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
else
shift
stableExternals=$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
;;
*) stableURL=$1
if expr "$stableURL" : '.*/stable/.*' 2>&1 >/dev/null ; then
case $stableURL in
http*) ;;
BuildTools/ThirdParty/* )
stableURL=${coinURL}/$stableURL
;;
ThirdParty/* )
stableURL=${coinURL}/BuildTools/$stableURL
;;
CoinAll/* )
stableURL=${coinURL}/CoinBinary/$stableURL
;;
*) stableURL=${coinURL}/$stableURL
;;
esac
else
echo ''
echo "URL $stableURL does not specify a stable release."
echo ''
printHelp=1
exitValue=2
fi
;;
esac
shift
done
# Consistency checks: Make sure that the stable URL exists. If we're building
# a ThirdParty or Data release, we need a BuildTools URL.
if test $printHelp = 0 && test $exitValue = 0 ; then
if svn list $stableURL 2>&1 >/dev/null ; then
:
else
echo "Stable URL $stableURL does not seem to exist."
printHelp=1
exitValue=5
fi
fi
if test $printHelp = 0 && test $exitValue = 0 ; then
case $stableURL in
*ThirdParty/* )
isThirdParty=yes
;;
*Data/* )
isData=yes
;;
*BuildTools/* )
isBuildTools=yes
isNormal=no
;;
*)
;;
esac
if test $isThirdParty = yes || test $isData = yes ; then
if test -z $cmdBTURL ; then
echo "You must provide a BuildTools URL to build a ThirdParty or Data project."
printHelp=1
exitValue=4
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_release <stableVer> [options]
COIN standard practice is to generate periodic releases by taking a snapshot
of the stable branch of the project. You can use this script to prepare
a new release based on the specified stable branch.
<stableVer> specifies the stable branch of your project to be used to
create the new release. You can specify the entire URL, or you just enter
what comes after "https://projects.coin-or.org/svn". A typical example is
prepare_new_release Ipopt/stable/3.3
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)
-s <projectlist> Suppress conversion from stable to release for the
listed externals (comma-separated list of project
names).
-x <projectlist> Remove the listed projects from the list of externals
(comma-separated list of project names).
This script will do the following:
- Automatically determine the next release number (X.Y.0 if this is the
first release for stable/X.Y, otherwise one greater than any existing
release)
- Check out a clean copy of the specified stable branch, without externals
- Make sure that the svn:externals property points to releases, with the
exception of projects in the list specified with -s.
- Create a new package configure.ac file with the release version number
specified in the AC_INIT macro.
- Use the "get.*" scripts to download any ThirdParty code.
- Execute run_autotools to update configure, Makefile.in, etc., to reflect
the most recent release of BuildTools.
- Run the configure script, compile the code, and run the unit test.
- Replace stable externals for projects specified with -s with the
appropriate (yet to be committed) release.
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.
This script does not make any changes to the repository. If you want to
commit the new release, run the "commit_new_release" 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 stable URL to work with. Tell the
# user what we've seen.
stableURL=`echo $stableURL | sed -e 's|/$||'`
stableProj=`extractProjFromURL $stableURL`
majVer=`extractMajorFromURL $stableURL`
minVer=`extractMinorFromURL $stableURL`
stableVer=$majVer.$minVer
echo "Stable URL..........: $stableURL"
echo "Stable project......: $stableProj"
echo "Stable branch.......: $stableVer"
if test -n "$stableExternals" ; then
echo "Stable externals....: $stableExternals."
fi
# Find out the most recent release (if any) for the stable branch, then
# construct the revision number of the new release. If there are existing
# releases, it's a matter of bumping the revision number and inserting the
# new revision in the URL. Otherwise, we know the new revision is 0 and we
# can simply tweak the stable URL.
releaseURL=`bestRelease $stableURL $majVer $minVer | sed -e 's|/$||'`
if test -n "$releaseURL" ; then
curRel=`extractReleaseFromURL $releaseURL`
existingURL=$releaseURL
newRel=`expr $curRel + 1`
else
curRel=-1
releaseURL=`echo $stableURL | sed -e s/stable/releases/`
existingURL="none"
newRel=0
fi
newVer=$majVer.$minVer.$newRel
releaseURL=`replaceVersionInURL $releaseURL $majVer $minVer $newRel`
echo "Top release URL.....: $existingURL"
echo "New release URL.....: $releaseURL"
# Relevant only if we're building ThirdParty or Data
if test $isThirdParty = yes || test $isData = yes ; then
echo "BuildTools URL......: $cmdBTURL"
fi
# We need a libtool version number only for normal projects
if test $isNormal = yes ; then
newLTCurrent=`calcLibtoolCurrent $stableURL $majVer $minVer`
newLTRevision=$newRel
newLTAge=`calcLibtoolAge $stableURL $majVer $minVer`
# expr returns with status 1 if the result of the calculation is 0
# this leads to exiting this script, which is somewhat unexpected
if test "$newLTAge" = 1 ; then
newLTAge=0
else
newLTAge=`expr $newLTAge - 1`
fi
newLTVer=${newLTCurrent}:${newLTRevision}:${newLTAge}
echo "Libtool version.....: $newLTVer"
fi
# Now decide where to build and check out code. If the stable project name
# contains a '/', strip it out to make the build and checkout directories.
topProjName=`echo $stableProj | sed -e 's|.*/\([^/]*\)$|\1|'`
topBuildDir="${topProjName}-${newVer}"
if test $isThirdParty = yes; then
coDir=$topBuildDir/Thirdparty/$stableProj
elif test $isData = yes; then
coDir=$topBuildDir/Data/$stableProj
else
coDir=$topBuildDir
fi
echo "Build directory.....: $topBuildDir"
echo "Checkout directory..: $coDir"
# Check out the stable branch that'll be the base of the new release. No
# externals at this point. Creating a release of a ThirdParty or Data project
# requires a bit of work, as we need to assemble a temporary package with a
# BuildTools external.
echo ''
echo "===> Checking out stable release $stableVer without externals..."
echo ''
rm -rf $topBuildDir
cmd="svn co --ignore-externals $stableURL $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 or third-party code at this point, so there will be
# two files for a normal project, one for a ThirdParty or Data project, and
# none for BuildTools.
echo ''
echo "===> Checking for configure.ac files ..."
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
if test -n "$bak_files" ; then
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 there is one parameter
# with the PMs choosen project name which is preserved and we only add a
# libtool version number afterwards.
echo ''
echo "===> Updating version numbers in configure.ac files ..."
for i in $bak_files; do
sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVer\3,\4|" $i > bla
mv bla $i
sed -e "s|AC_COIN_PROJECTDIR_INIT(\(.*\))|AC_COIN_PROJECTDIR_INIT\(\1,$newLTCurrent:$newLTRevision:$newLTAge\)|" $i > bla
mv bla $i
svn diff $i
done
else
echo " ... none to process."
fi
# 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
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 \"$newVer\"/" \
-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 $newRel/" \
<$configFileLoc.bak >$configFileLoc
svn diff $configFileLoc
fi
# The Dependencies file in a stable branch should contain only stable
# and release references (trunk is flagged as an error below). The overall
# algorithm is to convert svn:externals to use releases but leave Dependencies
# with stables. In practice, this is accomplished by backing up Dependencies,
# using Dependencies to assemble and set svn:externals, and finally restoring
# Dependencies from the backup after all else is done.
# Look for a file specifying externals. Preferably Dependencies, but check for
# Externals just in case this is an unconverted project.
srcDepFile=
for file in Dependencies Externals ; do
if test -r $file ; then
srcDepFile=$file
break
fi
done
# Now generate the proper externals for the release. Each line in a
# Dependencies file has the format <ext_name> <ext_url>. Normally, each
# <ext_url> should be a stable branch. References to stable branches will be
# converted to references to releases unless the reference is to a project
# in the stableExternals list (in which case it'll be converted at the very
# end). References to releases are not changed. References to trunk are an
# error. Failure to find a release for an external not in the stableExternals
# list is an error. Save the existing externals and srcDepFile, as we'll
# probably change both.
if test -n "$srcDepFile" ; then
svn propget svn:externals . > .Externals.original
bak_files="$bak_files $srcDepFile"
cp $srcDepFile $srcDepFile.bak
echo ''
echo "===> Checking externals in $srcDepFile ..."
echo ''
# Because we're working directly from command output, the regular expression
# must check for lines.
ourBTURL=`svn propget svn:externals . | \
sed -n -e 's/^BuildTools *https:\([^ ]*\)$/https:\1/p'`
if test -z "$ourBTURL" ; then
ourBTURL=none
fi
echo "Our BuildTools...: $ourBTURL"
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
# External must be a stable or a release.
if test $ext_urltype != stable && test $ext_urltype != release ; then
echo ''
echo "===> The external URL $ext_url is not a stable branch or release. Exiting."
echo ''
exit 2
fi
ext_isNormal=`isNormalURL $ext_url`
# Convert stable branches to releases unless listed in stableExternals.
# Existing releases are unchanged.
if test $ext_urltype = stable ; then
if expr "$stableExternals" : '.*'"$ext_proj"'.*' 2>&1 >/dev/null ; then
echo " $ext_name $ext_url unchanged"
ext_rel_url=$ext_url
else
ext_majVer=`extractMajorFromURL $ext_url`
ext_minVer=`extractMinorFromURL $ext_url`
ext_rel_url=`bestRelease $ext_url $ext_majVer $ext_minVer`
if test -z "$ext_rel_url" ; then
echo ''
echo "===> No release for $ext_url. Exiting."
echo ''
exit 2
fi
# Normal (not BuildTools/ThirdParty/Data) need a directory name,
# and it may differ from the project name. Carefully preserve it.
if test $ext_isNormal = yes ; then
ext_tail=`extractTailFromExt $ext_url`
ext_rel_url=${ext_rel_url}${ext_tail}
fi
echo " $ext_name $ext_url ==> $ext_rel_url"
fi
else
ext_rel_url=$ext_url
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. We only need
# to do this for normal URLs, and we need to strip the tail.
if test $ext_isNormal = yes &&
test $ext_proj != BuildTools && test $ourBTURL != none ; then
ext_rel_url_notail=`echo $ext_rel_url | sed -e 's,/[^/]*$,,'`
extBTURL=`svn propget svn:externals $ext_rel_url_notail`
extBTURL=`echo $extBTURL | \
sed -n -e 's/^BuildTools *https:\([^ ]*\) *$/https:\1/p'`
if test -n "$extBTURL" ; then
testResult=`compareURLVersions "$ourBTURL" "$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_rel_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
# Try to check out the externals. Try three times before failing.
echo ''
echo '===> Updating svn:externals property and checking out externals ...'
echo ''
svn propset svn:externals -F Dependencies .
svn update ||
{ echo "Retry 1 ... " ; svn update ; } ||
{ echo "Retry 2 ... " ; svn update ; } ||
{ echo "Checkout of externals failed. Aborting." ; exit 3 ; }
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
# Finally! Done processing externals. If this is a ThirdParty project, we
# still have to run the get script, if there is one.
isThirdPartyWithoutGet=no
if test $isThirdParty = yes ; then
if test -x get.$stableProj ; then
echo ''
echo '===> Downloading third party code ...'
echo ''
./get.$stableProj -y
else
isThirdPartyWithoutGet=yes
fi
fi
# Don't run run_autotools for BuildTools!
if test $isBuildTools = no ; then
echo ''
echo '===> Running BuildTools/run_autotools ...'
echo ''
if test $isThirdParty = yes || test $isData = yes ; then
cd ../..
./BuildTools/run_autotools
cd "$coDir"
elif test $isNormal = yes ; then
./BuildTools/run_autotools
fi
fi
# Let's see if it works. We only run tests for normal projects. 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 $isNormal = yes && test $isThirdPartyWithoutGet = no; 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
echo ''
echo '===> ALL TESTS PASSED'
fi
echo ''
if test $isNormal = yes && test $isThirdPartyWithoutGet = no; then
echo 'Please review the output above, particularly the one of make test.'
else
echo 'Please review the output above.'
fi
echo ''
# Do we need to plug in nonexistent releases for circular dependencies tested
# with the stable versions? If so, generate a new Dependencies. This is the
# only reason stable references should appear in the externals for a release,
# so we don't need to check further before removing them.
if test -n "$stableExternals" ; then
echo "===> Grooming externals to remove stable externals used for testing ..."
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 = stable ; then
ext_rel_url=$ext_url
ext_majVer=`extractMajorFromURL $ext_url`
ext_minVer=`extractMinorFromURL $ext_url`
ext_rel_url=`echo $ext_url | sed -e 's,/stable/,/releases/,'`
ext_rel_url=`replaceVersionInURL $ext_rel_url $ext_majVer $ext_minVer 0`
echo " $ext_name $ext_url ==> $ext_rel_url"
else
ext_rel_url=$ext_url
fi
echo "$ext_name $ext_rel_url" >>Dependencies
ext_name=
fi
done
rm -f Dependencies.temp.$$
svn propset -F Dependencies svn:externals .
echo ''
fi
# If we had a Dependencies file to begin with, it contained references to
# stable branches, and perhaps releases. This is the set of dependencies that
# we want to commit in Dependencies, so reload $srcDepFile.bak into
# Dependencies, now that we have svn:externals set to releases.
if test -n "$srcDepFile" ; then
cp $srcDepFile.bak Dependencies
fi
if test -r Dependencies ; then
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 release by going into'
echo 'the directory'
echo ''
echo " $startDir"
echo ''
echo "and run the commit_new_release script"
cd $topBuildDir
cat >.new_release_data <<EOF
coinURL=$coinURL
startDir=$startDir
topBuildDir=$topBuildDir
coDir=$coDir
releaseURL=$releaseURL
stableURL=$stableURL
newVer=$newVer
bak_files="$bak_files"
EOF