1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright (C) 2007 International Business Machines. |
---|
4 | # All Rights Reserved. |
---|
5 | # This file is distributed under the Common Public License. |
---|
6 | # It is part of the BuildTools project in COIN-OR (www.coin-or.org) |
---|
7 | # |
---|
8 | # $Id$ |
---|
9 | # |
---|
10 | # Adapted from prepare_new_release by Lou Hafer, SFU, 100507. |
---|
11 | |
---|
12 | #set -x -v |
---|
13 | set -e |
---|
14 | |
---|
15 | # Know thy self. If there are no '/' chars in the command name, we're running |
---|
16 | # in the currrent directory. Otherwise, strip the command name, leaving the |
---|
17 | # prefix. Coin-functions is expected to live in the same directory. |
---|
18 | |
---|
19 | if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then |
---|
20 | cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` |
---|
21 | else |
---|
22 | cmdDir='.' |
---|
23 | fi |
---|
24 | if test -r $cmdDir/coin-functions ; then |
---|
25 | . $cmdDir/coin-functions |
---|
26 | else |
---|
27 | echo "Cannot find utility functions file coin-functions; exiting." |
---|
28 | fi |
---|
29 | |
---|
30 | #################### end of function definitions ########################## |
---|
31 | |
---|
32 | |
---|
33 | # Note that plain sh does not accept negative exit values |
---|
34 | |
---|
35 | exitValue=0 |
---|
36 | |
---|
37 | # Specify the COIN URL base for convenience. |
---|
38 | |
---|
39 | coinURL="https://projects.coin-or.org/svn" |
---|
40 | |
---|
41 | # Begin parameter processing. |
---|
42 | |
---|
43 | printHelp=0 |
---|
44 | ignoreBuildToolsMismatch=0 |
---|
45 | bumpMajor=0 |
---|
46 | suppressCheckout=0 |
---|
47 | |
---|
48 | # srcURL will be the parent for the stable we are building. We'll need to be |
---|
49 | # able to distinguish ThirdParty and Data builds, and BuildTools itself; they |
---|
50 | # require special handling. cmdBTURL points to a BuildTools source and is |
---|
51 | # required when srcURL specifies a ThirdParty or Data project --- we'll need to |
---|
52 | # assemble a temporary package while creating the stable candidate. |
---|
53 | |
---|
54 | srcURL= |
---|
55 | isThirdParty=no |
---|
56 | isData=no |
---|
57 | isBuildTools=no |
---|
58 | cmdBTURL= |
---|
59 | |
---|
60 | # trunkExternals specifies externals for which we want to do simultaneous |
---|
61 | # creation of stable branches. We will use the trunk as the external while |
---|
62 | # preparing and testing the stable candidate, changing the Dependencies file |
---|
63 | # to specify a (nonexistent) stable branch of the external at the last moment. |
---|
64 | |
---|
65 | trunkExternals= |
---|
66 | |
---|
67 | # exciseExternals specifies externals that should be removed when creating the |
---|
68 | # new stable branch. |
---|
69 | |
---|
70 | exciseExternals= |
---|
71 | |
---|
72 | # We need at least one parameter. |
---|
73 | |
---|
74 | if test "$#" -eq 0; then |
---|
75 | printHelp=1 |
---|
76 | else |
---|
77 | |
---|
78 | # Process the parameters. A parameter without an opening `-' is assumed to be |
---|
79 | # the spec for the source branch. |
---|
80 | |
---|
81 | while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do |
---|
82 | case "$1" in |
---|
83 | -h* | --h*) printHelp=1 ;; |
---|
84 | -i* | --i*) ignoreBuildToolsMismatch=1 ;; |
---|
85 | -m* | --m*) bumpMajor=1 ;; |
---|
86 | -p* | --p*) suppressCheckout=1 ;; |
---|
87 | -t* | --t*) |
---|
88 | if expr "$1" : '.*-t.*=.*' 2>&1 >/dev/null ; then |
---|
89 | trunkExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
90 | else |
---|
91 | shift |
---|
92 | trunkExternals=$1 |
---|
93 | fi |
---|
94 | ;; |
---|
95 | -x* | --x*) |
---|
96 | if expr "$1" : '.*-x.*=.*' 2>&1 >/dev/null ; then |
---|
97 | exciseExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
98 | else |
---|
99 | shift |
---|
100 | exciseExternals=$1 |
---|
101 | fi |
---|
102 | ;; |
---|
103 | -b* | --b*) |
---|
104 | if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then |
---|
105 | cmdBTURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
106 | else |
---|
107 | shift |
---|
108 | cmdBTURL=$1 |
---|
109 | fi |
---|
110 | if expr "$cmdBTURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then |
---|
111 | case $cmdBTURL in |
---|
112 | http*) ;; |
---|
113 | *) cmdBTURL=${coinURL}/$cmdBTURL |
---|
114 | ;; |
---|
115 | esac |
---|
116 | else |
---|
117 | echo '' |
---|
118 | echo "URL $cmdBTURL does not point to BuildTools." |
---|
119 | echo '' |
---|
120 | printHelp=1 |
---|
121 | exitValue=3 |
---|
122 | fi |
---|
123 | ;; |
---|
124 | -*) echo "$0: unrecognised command line switch '"$1"'." |
---|
125 | printHelp=1 |
---|
126 | exitValue=1 |
---|
127 | ;; |
---|
128 | *) srcURL=$1 |
---|
129 | case $srcURL in |
---|
130 | http* ) ;; |
---|
131 | BuildTools/ThirdParty/* ) |
---|
132 | srcURL=${coinURL}/$srcURL |
---|
133 | ;; |
---|
134 | ThirdParty/* ) |
---|
135 | srcURL=${coinURL}/BuildTools/$srcURL |
---|
136 | ;; |
---|
137 | * ) srcURL=${coinURL}/$srcURL |
---|
138 | ;; |
---|
139 | esac |
---|
140 | ;; |
---|
141 | esac |
---|
142 | shift |
---|
143 | done |
---|
144 | |
---|
145 | # Consistency check: Make sure that the source URL exists. Note that it's not |
---|
146 | # possible to specify a Data URL without including trunk/stable/release in the |
---|
147 | # URL. For others, helpfully append `trunk'. |
---|
148 | |
---|
149 | srcURL=`echo $srcURL | sed -e 's/\/$//'` |
---|
150 | urlType=`extractTypeFromURL "$srcURL"` |
---|
151 | if test $printHelp = 0 && test $exitValue = 0 ; then |
---|
152 | if svn list $srcURL 2>&1 >/dev/null ; then |
---|
153 | : |
---|
154 | else |
---|
155 | echo "Source URL $srcURL does not seem to exist." |
---|
156 | printHelp=1 |
---|
157 | exitValue=5 |
---|
158 | fi |
---|
159 | if test "$urlType" = invalid ; then |
---|
160 | srcURL=$srcURL/trunk |
---|
161 | urlType=trunk |
---|
162 | fi |
---|
163 | fi |
---|
164 | |
---|
165 | # Just what are we building? Order is important; BuildTools without ThirdParty |
---|
166 | # means we're actually doing a BuildTools stable. |
---|
167 | |
---|
168 | if test $printHelp = 0 && test $exitValue = 0 ; then |
---|
169 | case $srcURL in |
---|
170 | *ThirdParty* ) |
---|
171 | isThirdParty=yes |
---|
172 | ;; |
---|
173 | *BuildTools* ) |
---|
174 | isBuildTools=yes |
---|
175 | ;; |
---|
176 | *Data* ) |
---|
177 | isData=yes |
---|
178 | ;; |
---|
179 | *) |
---|
180 | ;; |
---|
181 | esac |
---|
182 | |
---|
183 | # If we're building a ThirdParty or Data release, we need a BuildTools URL. |
---|
184 | |
---|
185 | if test $isThirdParty = yes || test $isData = yes ; then |
---|
186 | if test -z "$cmdBTURL" ; then |
---|
187 | cmdBTURL=`bestRelease $coinURL/BuildTools -1 -1` |
---|
188 | echo "A BuildTools URL is required for Data or ThirdParty projects." |
---|
189 | echo "Using $cmdBTURL; override with -b" |
---|
190 | else |
---|
191 | if svn list $cmdBTURL 2>&1 >/dev/null ; then |
---|
192 | : |
---|
193 | else |
---|
194 | echo "BuildTools URL $cmdBTURL does not seem to exist." |
---|
195 | printHelp=1 |
---|
196 | exitValue=6 |
---|
197 | fi |
---|
198 | fi |
---|
199 | fi |
---|
200 | fi |
---|
201 | fi # if "$#" .eq 0 |
---|
202 | |
---|
203 | if test $printHelp = 1 ; then |
---|
204 | cat <<EOF |
---|
205 | Usage: prepare_new_stable [options] <source URL> |
---|
206 | |
---|
207 | This script will create a new stable branch from the head of the specified |
---|
208 | URL. Typically this will be the trunk, but it can be an existing stable |
---|
209 | branch. You can specify the entire URL, or just enter what comes after |
---|
210 | "https://projects.coin-or.org/svn". A typical example is |
---|
211 | |
---|
212 | prepare_new_stable Ipopt/trunk |
---|
213 | |
---|
214 | Options: |
---|
215 | -b <BuildToolsURL> URL for BuildTools; required to generate a release |
---|
216 | for a ThirdParty or Data project. |
---|
217 | -i Ignore BuildTools version mismatches in externals. |
---|
218 | -p Suppress checkout (useful for testing) |
---|
219 | -m Bump the major version number. |
---|
220 | -t <project-list> Suppress conversion from trunk to stable for the |
---|
221 | listed externals (comma-separated list of project |
---|
222 | names, e.g., -t Osi,Cbc). |
---|
223 | -x <project-list> Remove the listed projects from the list of externals |
---|
224 | (comma-separated list of project names). |
---|
225 | |
---|
226 | This script will do the following: |
---|
227 | |
---|
228 | - Set the new stable version number as the next minor version number in |
---|
229 | the current major version number. Use the -m flag to bump the major |
---|
230 | version number. |
---|
231 | |
---|
232 | - Convert externals from trunk to the top stable branch. Externals which |
---|
233 | are currently stable or release are left untouched. Use -t to suppress |
---|
234 | the change from trunk to stable. Set_externals is then invoked to set |
---|
235 | release externals where available. |
---|
236 | |
---|
237 | - Check out externals. The BuildTools version used by externals (if any) |
---|
238 | is checked, and the script issues a warning if it doesn't match the |
---|
239 | version used by the source URL. |
---|
240 | |
---|
241 | - Run the scripts to download any ThirdParty code. |
---|
242 | |
---|
243 | - Run run_autotools to rebuild configure and make files. |
---|
244 | |
---|
245 | - Run configure, make, and make test |
---|
246 | |
---|
247 | - Tweak the externals to upgrade trunk (-t) dependencies to stable (you |
---|
248 | won't get to release in this case). |
---|
249 | |
---|
250 | If there is any error during these tasks the script will stop and you should |
---|
251 | examine the output. |
---|
252 | |
---|
253 | If the script completes without error, examine the output, particularly the |
---|
254 | output of the unit test ('make test') and the set of externals specified in |
---|
255 | the Dependencies file. Whether you start with Externals or Dependencies, the |
---|
256 | stable will have a proper Dependencies. Externals will be unmodified. |
---|
257 | |
---|
258 | This script does not make any changes to the repository. If you want to |
---|
259 | commit the new stable branch, run the "commit_new_stable" script, as described |
---|
260 | at the end of the output. |
---|
261 | |
---|
262 | EOF |
---|
263 | fi |
---|
264 | |
---|
265 | if test $exitValue != 0 || test $printHelp = 1 ; then |
---|
266 | exit $exitValue |
---|
267 | fi |
---|
268 | |
---|
269 | # End of parameter parsing. We have a source URL to work with. Tell the |
---|
270 | # user what we've seen. |
---|
271 | |
---|
272 | srcURL=`echo $srcURL | sed -e 's|/$||'` |
---|
273 | srcProj=`extractProjFromURL $srcURL` |
---|
274 | |
---|
275 | echo "Source URL..........: $srcURL" |
---|
276 | echo "Base project........: $srcProj" |
---|
277 | if test $isThirdParty = yes || test $isData = yes ; then |
---|
278 | echo "BuildTools URL......: $cmdBTURL" |
---|
279 | fi |
---|
280 | |
---|
281 | # Figure out the URL of the new stable branch. Consider that there may not be |
---|
282 | # any existing stable branches. |
---|
283 | |
---|
284 | topStableURL=`bestStable $srcURL -1` |
---|
285 | echo "Top stable URL......: ${topStableURL:-none}" |
---|
286 | |
---|
287 | if test -z "$topStableURL" ; then |
---|
288 | majVer=0 |
---|
289 | minVer=1 |
---|
290 | case "$srcURL" in |
---|
291 | */Data/* ) |
---|
292 | newStableURL=$coinURL/Data/stable/$majVer.$minVer/$srcProj |
---|
293 | ;; |
---|
294 | */ThirdParty/* ) |
---|
295 | newStableURL=$coinURL/BuildTools/ThirdParty/$srcProj/stable/$majVer.$minVer |
---|
296 | ;; |
---|
297 | * ) |
---|
298 | newStableURL=$coinURL/$srcProj/stable/$majVer.$minVer |
---|
299 | ;; |
---|
300 | esac |
---|
301 | else |
---|
302 | majVer=`extractMajorFromURL $topStableURL` |
---|
303 | if test $bumpMajor = 1 ; then |
---|
304 | majVer=`expr $majVer + 1` |
---|
305 | minVer=0 |
---|
306 | else |
---|
307 | minVer=`extractMinorFromURL $topStableURL` |
---|
308 | minVer=`expr $minVer + 1` |
---|
309 | fi |
---|
310 | newStableURL=`replaceVersionInURL $topStableURL $majVer $minVer` |
---|
311 | fi |
---|
312 | echo "New stable URL......: $newStableURL" |
---|
313 | newVersion=${majVer}.${minVer} |
---|
314 | |
---|
315 | # Construct a build directory name. |
---|
316 | |
---|
317 | topBuildDir=${srcProj}-${newVersion} |
---|
318 | echo "Build directory.....: $topBuildDir" |
---|
319 | |
---|
320 | # Now decide where to check out code. |
---|
321 | |
---|
322 | if test $isThirdParty = yes; then |
---|
323 | coDir=$topBuildDir/Thirdparty/$srcProj |
---|
324 | elif test $isData = yes; then |
---|
325 | coDir=$topBuildDir/Data/$srcProj |
---|
326 | else |
---|
327 | coDir=$topBuildDir |
---|
328 | fi |
---|
329 | echo "Checkout directory..: $coDir" |
---|
330 | |
---|
331 | echo '' |
---|
332 | echo "===> Checking out source $srcURL without externals ..." |
---|
333 | echo '' |
---|
334 | |
---|
335 | cmd="svn co --ignore-externals $srcURL $coDir" |
---|
336 | if test $suppressCheckout = 1 ; then |
---|
337 | echo "Pretending to do: $cmd" |
---|
338 | else |
---|
339 | rm -rf $topBuildDir |
---|
340 | echo $cmd |
---|
341 | eval $cmd |
---|
342 | fi |
---|
343 | |
---|
344 | if test $isThirdParty = yes || test $isData = yes; then |
---|
345 | echo '' |
---|
346 | echo '===> Checking out BuildTools (Data or ThirdParty) ...' |
---|
347 | echo '' |
---|
348 | cmd="svn co $cmdBTURL $topBuildDir/BuildTools" |
---|
349 | if test $suppressCheckout = 1 ; then |
---|
350 | echo "Pretending to do: $cmd" |
---|
351 | else |
---|
352 | echo $cmd |
---|
353 | eval $cmd |
---|
354 | fi |
---|
355 | fi |
---|
356 | |
---|
357 | startDir=`pwd` |
---|
358 | coDir=`cd $coDir; pwd` |
---|
359 | topBuildDir=`cd $topBuildDir; pwd` |
---|
360 | |
---|
361 | cd $coDir |
---|
362 | |
---|
363 | # Find configure.ac files for the package and project and update the version. |
---|
364 | # We have no externals at this point, so there will be two files for a |
---|
365 | # standard project, one for a ThirdParty or Data project. |
---|
366 | |
---|
367 | echo '' |
---|
368 | bak_files=`find . -name 'configure.ac' | grep -v -E 'ThirdParty/.*/.*/configure.ac'` |
---|
369 | echo "===> Creating backup (.bak) for configure.ac files..." |
---|
370 | for i in $bak_files; do |
---|
371 | cp $i $i.bak |
---|
372 | done |
---|
373 | |
---|
374 | echo '' |
---|
375 | echo "===> Updating version number in configure.ac files" |
---|
376 | for i in $bak_files; do |
---|
377 | sed -e "s|AC_INIT\(.*\),\[[^]]*\],\(.*\)|AC_INIT\1,[$newVersion],\2|" $i > bla |
---|
378 | mv bla $i |
---|
379 | svn diff $i |
---|
380 | done |
---|
381 | |
---|
382 | # Find ProjConfig.h. If there's a definition for PROJ_VERSION, adjust it and |
---|
383 | # add ProjConfig.h.bak to the list of files to be restored. |
---|
384 | |
---|
385 | srcProjUC=`echo $srcProj | tr '[a-z]' '[A-Z]'` |
---|
386 | configFileLoc=`find . -name .svn -prune -o -name '*Config.h' -print` |
---|
387 | if test -n "$configFileLoc" ; then |
---|
388 | versionSym=${srcProjUC}_VERSION |
---|
389 | echo '' |
---|
390 | echo "===> Updating $versionSym in $configFileLoc (if present)" |
---|
391 | echo '' |
---|
392 | mv $configFileLoc $configFileLoc.bak |
---|
393 | bak_files="$bak_files $configFileLoc" |
---|
394 | sed -e "s/# *define $versionSym.*\$/#define $versionSym \"$newVersion\"/" <$configFileLoc.bak >$configFileLoc |
---|
395 | svn diff $configFileLoc |
---|
396 | fi |
---|
397 | |
---|
398 | # Now generate a proper Dependencies file for the stable branch. References to |
---|
399 | # trunk will be converted to references to stable branches unless the reference |
---|
400 | # is to a project in the trunkExternals list (in which case it'll be converted |
---|
401 | # at the very end). References to releases are not changed. Each line in a |
---|
402 | # Dependencies file has the format <ext_name> <ext_url>. Normally, each entry |
---|
403 | # should be a stable branch. |
---|
404 | |
---|
405 | srcDepFile= |
---|
406 | for file in Dependencies Externals ; do |
---|
407 | if test -r $file ; then |
---|
408 | srcDepFile=$file |
---|
409 | break |
---|
410 | fi |
---|
411 | done |
---|
412 | |
---|
413 | if test -n "$srcDepFile" ; then |
---|
414 | |
---|
415 | # Save the externals property of the source, so we can just restore it after |
---|
416 | # the commit. Also save srcDepFile, because we may well modify it for the |
---|
417 | # stable branch, converting trunk externals to stable externals. |
---|
418 | |
---|
419 | svn propget svn:externals . > .Externals.original |
---|
420 | bak_files="$bak_files $srcDepFile" |
---|
421 | cp $srcDepFile $srcDepFile.bak |
---|
422 | |
---|
423 | echo '' |
---|
424 | echo "===> Checking externals in $srcDepFile ..." |
---|
425 | echo '' |
---|
426 | |
---|
427 | # We've just checked this out, no sense going back to the server for the |
---|
428 | # BuildTools version. |
---|
429 | |
---|
430 | srcExternals=`svn propget svn:externals .` |
---|
431 | srcBTURL=`echo $srcExternals | \ |
---|
432 | sed -n -e 's/.*BuildTools https:\([^ ]*\) .*/https:\1/p'` |
---|
433 | if test -z "$srcBTURL" ; then |
---|
434 | srcBTURL="none" |
---|
435 | fi |
---|
436 | echo "Source BuildTools...: $srcBTURL" |
---|
437 | |
---|
438 | rm -f Dependencies |
---|
439 | ext_name= |
---|
440 | ext_url= |
---|
441 | buildtoolsMismatch=0 |
---|
442 | for i in `cat $srcDepFile.bak` ; do |
---|
443 | if test "$ext_name" = "" ; then |
---|
444 | ext_name=$i |
---|
445 | else |
---|
446 | ext_url=$i |
---|
447 | if expr "$ext_name" : '#.*' 2>&1 >/dev/null ; then |
---|
448 | echo " $ext_name $ext_url ==> skipped" |
---|
449 | ext_name= |
---|
450 | continue |
---|
451 | fi |
---|
452 | ext_urltype=`extractTypeFromURL $ext_url` |
---|
453 | ext_proj=`extractProjFromURL $ext_url` |
---|
454 | |
---|
455 | # See if this external should be dropped. |
---|
456 | |
---|
457 | if expr "$exciseExternals" : '.*'$ext_proj'.*' 2>&1 > /dev/null ; then |
---|
458 | echo " $ext_name $ext_url ==> excised" |
---|
459 | ext_name= |
---|
460 | continue |
---|
461 | fi |
---|
462 | |
---|
463 | # Convert a trunk URL to stable unless it's listed in trunkExternals. |
---|
464 | |
---|
465 | if test $ext_urltype = trunk ; then |
---|
466 | if expr "$trunkExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then |
---|
467 | echo " $ext_name $ext_url ==> unchanged" |
---|
468 | else |
---|
469 | ext_oldurl=$ext_url |
---|
470 | ext_url=`bestStable $ext_url -1` |
---|
471 | case "$ext_url" in |
---|
472 | */Data/* | */BuildTools/* ) ;; |
---|
473 | *) ext_url="${ext_url}${ext_proj}" |
---|
474 | esac |
---|
475 | echo " $ext_name $ext_oldurl ==> $ext_url" |
---|
476 | fi |
---|
477 | else |
---|
478 | echo " $ext_name $ext_url ==> unchanged" |
---|
479 | fi |
---|
480 | |
---|
481 | # Get the BuildTools URL for the external and compare to the BuildTools URL |
---|
482 | # for the source, assuming we have one and the external has one. |
---|
483 | |
---|
484 | if test $ext_proj != BuildTools && test $srcBTURL != none ; then |
---|
485 | extBTURL=`svn propget svn:externals $ext_url` |
---|
486 | extBTURL=`echo $extBTURL | \ |
---|
487 | sed -n -e 's/.*BuildTools https:\([^ ]*\) .*/https:\1/p'` |
---|
488 | if test -n "$extBTURL" && test "$srcBTURL" != "$extBTURL" ; then |
---|
489 | echo " WARNING: BuildTools mismatch: $ext_url uses $extBTURL" |
---|
490 | if test $ignoreBuildToolsMismatch = 0 ; then |
---|
491 | buildtoolsMismatch=1 |
---|
492 | fi |
---|
493 | fi |
---|
494 | fi |
---|
495 | |
---|
496 | echo "$ext_name $ext_url" >>Dependencies |
---|
497 | ext_name= |
---|
498 | echo '' |
---|
499 | fi |
---|
500 | done |
---|
501 | if test $buildtoolsMismatch -gt $ignoreBuildToolsMismatch ; then |
---|
502 | echo "Exiting due to BuildTools mismatches; use -i to ignore." |
---|
503 | exit 2 |
---|
504 | fi |
---|
505 | |
---|
506 | $cmdDir/set_externals Dependencies |
---|
507 | |
---|
508 | echo '' |
---|
509 | echo '===> Checking out externals ...' |
---|
510 | echo '' |
---|
511 | |
---|
512 | svn update |
---|
513 | |
---|
514 | # Run any scripts to acquire ThirdParty code. |
---|
515 | |
---|
516 | if test -d ThirdParty ; then |
---|
517 | |
---|
518 | echo '' |
---|
519 | echo '===> Downloading ThirdParty code ...' |
---|
520 | echo '' |
---|
521 | |
---|
522 | ext_name= |
---|
523 | ext_url= |
---|
524 | for i in `svn propget svn:externals .` ; do |
---|
525 | if test -z "$ext_name" ; then |
---|
526 | ext_name=$i |
---|
527 | else |
---|
528 | ext_url=$i |
---|
529 | if expr "$ext_name" : 'ThirdParty/.*' 2>&1 >/dev/null ; then |
---|
530 | cd $ext_name |
---|
531 | ext_proj=`extractProjFromURL $ext_url` |
---|
532 | getScript=get.$ext_proj |
---|
533 | if test -x "$getScript" ; then |
---|
534 | ./$getScript -patch |
---|
535 | fi |
---|
536 | cd $coDir |
---|
537 | fi |
---|
538 | ext_name= |
---|
539 | fi |
---|
540 | done |
---|
541 | fi |
---|
542 | fi |
---|
543 | |
---|
544 | |
---|
545 | # Done processing externals. If this is a ThirdParty project, we still have |
---|
546 | # to run the get script. |
---|
547 | |
---|
548 | if test $isThirdParty = yes; then |
---|
549 | if test -x get.$srcProj ; then |
---|
550 | echo '' |
---|
551 | echo '===> Downloading third party code...' |
---|
552 | echo '' |
---|
553 | ./get.$srcProj |
---|
554 | fi |
---|
555 | fi |
---|
556 | |
---|
557 | # Run the autotools to update configure and make files |
---|
558 | |
---|
559 | echo '' |
---|
560 | echo '===> Running BuildTools/run_autotools ...' |
---|
561 | echo '' |
---|
562 | |
---|
563 | if test $isThirdParty = yes || test $isData = yes ; then |
---|
564 | cd ../.. |
---|
565 | BuildTools/run_autotools |
---|
566 | cd "$coDir" |
---|
567 | else |
---|
568 | BuildTools/run_autotools |
---|
569 | fi |
---|
570 | |
---|
571 | # Let's see if it works. We only run tests for non-ThirdParty, non-Data. DO NOT |
---|
572 | # turn on --enable-maintainer-mode in the initial configure command. At the |
---|
573 | # least, it's not needed. At the worst, as of 100526, it'll undo all the |
---|
574 | # careful work above to set externals. |
---|
575 | |
---|
576 | if test $isThirdParty != yes && test $isData != yes; then ( |
---|
577 | set -e |
---|
578 | echo '' |
---|
579 | echo '===> Creating build directory and running the configuration script...' |
---|
580 | echo '' |
---|
581 | mkdir build |
---|
582 | cd build |
---|
583 | cmd="$coDir/configure -C" |
---|
584 | echo $cmd |
---|
585 | eval $cmd |
---|
586 | echo '' |
---|
587 | echo '===> Compiling code...' |
---|
588 | echo '' |
---|
589 | cmd='make install' |
---|
590 | echo $cmd |
---|
591 | eval $cmd |
---|
592 | echo '' |
---|
593 | echo '===> Running the unit test...' |
---|
594 | echo '' |
---|
595 | echo '*******************************************************************************' |
---|
596 | echo '*** ***' |
---|
597 | echo '*** BEGIN OUTPUT OF MAKE TEST ***' |
---|
598 | echo '*** ***' |
---|
599 | echo '*******************************************************************************' |
---|
600 | echo '' |
---|
601 | cmd='make test' |
---|
602 | echo $cmd |
---|
603 | eval $cmd |
---|
604 | echo '' |
---|
605 | echo '*******************************************************************************' |
---|
606 | echo '*** ***' |
---|
607 | echo '*** END OUTPUT OF MAKE TEST ***' |
---|
608 | echo '*** ***' |
---|
609 | echo '*******************************************************************************' |
---|
610 | ) |
---|
611 | if test $? != 0; then |
---|
612 | echo '' |
---|
613 | echo 'Error during build or test' |
---|
614 | echo '' |
---|
615 | exit 3 |
---|
616 | fi |
---|
617 | fi |
---|
618 | |
---|
619 | # No fatal errors. Declare victory. |
---|
620 | |
---|
621 | echo '' |
---|
622 | echo '===> ALL TESTS PASSED' |
---|
623 | if test $isThirdParty != yes && |
---|
624 | test $isData != yes && test $isBuildTools != yes ; then |
---|
625 | echo '' |
---|
626 | echo 'Please review the output above, particularly the one of make test' |
---|
627 | fi |
---|
628 | echo '' |
---|
629 | |
---|
630 | # Do we need to plug in nonexistent stable branches for circular dependencies |
---|
631 | # tested with the trunk? If so, generate a new Externals.release. This is |
---|
632 | # the only reason trunk references should appear in the externals for a |
---|
633 | # stable branch, so we don't need to check further before removing them. |
---|
634 | |
---|
635 | if test -n "$trunkExternals" ; then |
---|
636 | echo '' |
---|
637 | echo "===> Grooming externals to remove trunk references used for testing." |
---|
638 | echo '' |
---|
639 | mv Dependencies Dependencies.temp.$$ |
---|
640 | ext_name= |
---|
641 | ext_url= |
---|
642 | for i in `cat Dependencies.temp.$$`; do |
---|
643 | if test "$ext_name" = ""; then |
---|
644 | ext_name="$i" |
---|
645 | else |
---|
646 | ext_url=$i |
---|
647 | ext_urltype=`extractTypeFromURL $ext_url` |
---|
648 | ext_proj=`extractProjFromURL $ext_url` |
---|
649 | if test $ext_urltype = trunk ; then |
---|
650 | ext_oldurl=$ext_url |
---|
651 | ext_url=`bestStable $ext_url -1` |
---|
652 | ext_majVer=`extractMajorFromURL $ext_url` |
---|
653 | ext_minVer=`extractMinorFromURL $ext_url` |
---|
654 | ext_minVer=`expr $ext_minVer + 1` |
---|
655 | ext_url=`replaceVersionInURL $ext_url $ext_majVer $ext_minVer` |
---|
656 | ext_url="${ext_url}${ext_proj}" |
---|
657 | echo " $ext_name $ext_oldurl ==> $ext_url" |
---|
658 | fi |
---|
659 | echo "$ext_name $ext_url" >>Dependencies |
---|
660 | ext_name= |
---|
661 | fi |
---|
662 | done |
---|
663 | rm -f Dependencies.temp.$$ |
---|
664 | $cmdDir/set_externals Dependencies |
---|
665 | fi |
---|
666 | |
---|
667 | if test -r Dependencies ; then |
---|
668 | echo '' |
---|
669 | echo 'Also, please confirm the Externals are correct:' |
---|
670 | svn propget svn:externals |
---|
671 | fi |
---|
672 | |
---|
673 | echo '' |
---|
674 | echo 'After reviewing the output above, you can create a new release by going into' |
---|
675 | echo 'the directory' |
---|
676 | echo '' |
---|
677 | echo " $startDir" |
---|
678 | echo '' |
---|
679 | echo "and run the commit_new_stable script" |
---|
680 | |
---|
681 | cd $topBuildDir |
---|
682 | |
---|
683 | # Record information for the commit_new_stable script. |
---|
684 | |
---|
685 | cat >.new_stable_data <<EOF |
---|
686 | coinURL=$coinURL |
---|
687 | startDir=$startDir |
---|
688 | topBuildDir=$topBuildDir |
---|
689 | coDir=$coDir |
---|
690 | newStableURL=$newStableURL |
---|
691 | srcURL=$srcURL |
---|
692 | newVersion=$newVersion |
---|
693 | bak_files="$bak_files" |
---|
694 | EOF |
---|