1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright (C) 2007 International Business Machines. |
---|
4 | # All Rights Reserved. |
---|
5 | # This file is distributed under the Eclipse Public License. |
---|
6 | # It is part of the BuildTools project in COIN-OR (www.coin-or.org) |
---|
7 | # |
---|
8 | # $Id: prepare_new_release 2231 2011-06-03 08:53:44Z stefan $ |
---|
9 | # |
---|
10 | # Author: Andreas Waechter IBM 2007-06-21 |
---|
11 | # Modified: Lou Hafer SFU 2008-01-20 |
---|
12 | # Accommodate simultaneous creation of releases with circular |
---|
13 | # dependencies. |
---|
14 | # Modified: Ted Ralphs Lehigh University 2009-07-10 |
---|
15 | # Set libtool version info automatically |
---|
16 | # Modified: Lou Hafer SFU 2010-06-02 |
---|
17 | # Adapt to new script architecture pioneered in *_new_stable; major |
---|
18 | # rewrite. |
---|
19 | # Modified: Lou Hafer SFU 2011-03-14 |
---|
20 | # Change handling of externals so the svn:externals is left pointing to |
---|
21 | # releases but Dependencies is left pointing to stable branches. |
---|
22 | |
---|
23 | #set -x -v |
---|
24 | set -e |
---|
25 | |
---|
26 | # You can think of this script as having two sections: parameter parsing and |
---|
27 | # validation, followed by generation of the release candidate. See the help |
---|
28 | # message for a good description of the actions taken to generate the release |
---|
29 | # candidate. |
---|
30 | |
---|
31 | # Know thy self. If there are no '/' chars in the command name, we're running |
---|
32 | # in the currrent directory. Otherwise, strip the command name, leaving the |
---|
33 | # prefix. Coin-functions is expected to live in the same directory. |
---|
34 | |
---|
35 | if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then |
---|
36 | cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` |
---|
37 | else |
---|
38 | cmdDir='.' |
---|
39 | fi |
---|
40 | cmdDir=`cd $cmdDir ; pwd` |
---|
41 | if test -r $cmdDir/coin-functions ; then |
---|
42 | . $cmdDir/coin-functions |
---|
43 | else |
---|
44 | echo "Cannot find utility functions file coin-functions; exiting." |
---|
45 | fi |
---|
46 | |
---|
47 | # Note that plain sh does not accept negative exit values |
---|
48 | |
---|
49 | exitValue=0 |
---|
50 | |
---|
51 | # Specify the COIN URL base for convenience. |
---|
52 | |
---|
53 | coinURL="https://projects.coin-or.org/svn" |
---|
54 | |
---|
55 | # Begin parameter processing. |
---|
56 | |
---|
57 | printHelp=0 |
---|
58 | ignoreBuildToolsMismatch=no |
---|
59 | mismatchBTExternals= |
---|
60 | suppressCheckout=0 |
---|
61 | |
---|
62 | # stableURL will be the stable branch that is the parent for the release we |
---|
63 | # are building. We'll need to be able to distinguish ThirdParty and Data |
---|
64 | # builds, and BuildTools itself; they require special handling. If a project |
---|
65 | # is not BuildTools, ThirdParty, or Data, it's `normal'. |
---|
66 | # SV: I think also ThirdParty projects should be treated as 'normal', so I changed that. |
---|
67 | |
---|
68 | stableURL= |
---|
69 | isThirdParty=no |
---|
70 | isData=no |
---|
71 | isBuildTools=no |
---|
72 | isNormal=yes |
---|
73 | |
---|
74 | # cmdBTURL is required when stableURL specifies a ThirdParty or Data |
---|
75 | # project --- we'll need to assemble a temporary package while creating the |
---|
76 | # release candidate. |
---|
77 | |
---|
78 | cmdBTURL= |
---|
79 | |
---|
80 | # stableExternals specifies externals for which we are doing simultaneous |
---|
81 | # releases. We will use the stable branch of the external while preparing |
---|
82 | # and testing this release candidate, changing svn:externals to specify a |
---|
83 | # (nonexistent) release of the external at the last moment. |
---|
84 | |
---|
85 | stableExternals= |
---|
86 | |
---|
87 | # exciseExternals specifies externals that should be removed when creating the |
---|
88 | # new release. |
---|
89 | |
---|
90 | exciseExternals= |
---|
91 | |
---|
92 | # We need at least one parameter. |
---|
93 | |
---|
94 | if test "$#" -eq 0; then |
---|
95 | printHelp=1 |
---|
96 | else |
---|
97 | |
---|
98 | # Process the parameters. A parameter without an opening `-' is assumed to be |
---|
99 | # the spec for the stable branch. |
---|
100 | |
---|
101 | while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do |
---|
102 | case "$1" in |
---|
103 | -h* | --h*) printHelp=1 ;; |
---|
104 | -i* | --i*) |
---|
105 | if expr "$1" : '.*-i.*=.*' 2>&1 >/dev/null ; then |
---|
106 | mismatchBTExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
107 | else |
---|
108 | shift |
---|
109 | mismatchBTExternals=$1 |
---|
110 | fi |
---|
111 | if test "x$mismatchBTExternals" = "xall" ; then |
---|
112 | ignoreBuildToolsMismatch=all |
---|
113 | else |
---|
114 | ignoreBuildToolsMismatch=partial |
---|
115 | fi |
---|
116 | ;; |
---|
117 | -p* | --p*) suppressCheckout=1 ;; |
---|
118 | -s* | --s*) |
---|
119 | if expr "$1" : '.*-s.*=.*' 2>&1 >/dev/null ; then |
---|
120 | stableExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
121 | else |
---|
122 | shift |
---|
123 | stableExternals=$1 |
---|
124 | fi |
---|
125 | ;; |
---|
126 | -x* | --x*) |
---|
127 | if expr "$1" : '.*-x.*=.*' 2>&1 >/dev/null ; then |
---|
128 | exciseExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
129 | else |
---|
130 | shift |
---|
131 | exciseExternals=$1 |
---|
132 | fi |
---|
133 | ;; |
---|
134 | -b* | --b*) |
---|
135 | if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then |
---|
136 | cmdBTURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
137 | else |
---|
138 | shift |
---|
139 | cmdBTURL=$1 |
---|
140 | fi |
---|
141 | if expr "$cmdBTURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then |
---|
142 | case $cmdBTURL in |
---|
143 | http*) ;; |
---|
144 | *) cmdBTURL=${coinURL}/$cmdBTURL |
---|
145 | ;; |
---|
146 | esac |
---|
147 | else |
---|
148 | echo '' |
---|
149 | echo "URL $cmdBTURL does not point to BuildTools." |
---|
150 | echo '' |
---|
151 | printHelp=1 |
---|
152 | exitValue=3 |
---|
153 | fi |
---|
154 | ;; |
---|
155 | |
---|
156 | -*) echo "$0: unrecognised command line switch '"$1"'." |
---|
157 | printHelp=1 |
---|
158 | exitValue=1 |
---|
159 | ;; |
---|
160 | *) stableURL=$1 |
---|
161 | if expr "$stableURL" : '.*/stable/.*' 2>&1 >/dev/null ; then |
---|
162 | case $stableURL in |
---|
163 | http*) ;; |
---|
164 | BuildTools/ThirdParty/* ) |
---|
165 | stableURL=${coinURL}/$stableURL |
---|
166 | ;; |
---|
167 | ThirdParty/* ) |
---|
168 | stableURL=${coinURL}/BuildTools/$stableURL |
---|
169 | ;; |
---|
170 | CoinAll/* ) |
---|
171 | stableURL=${coinURL}/CoinBinary/$stableURL |
---|
172 | ;; |
---|
173 | *) stableURL=${coinURL}/$stableURL |
---|
174 | ;; |
---|
175 | esac |
---|
176 | else |
---|
177 | echo '' |
---|
178 | echo "URL $stableURL does not specify a stable release." |
---|
179 | echo '' |
---|
180 | printHelp=1 |
---|
181 | exitValue=2 |
---|
182 | fi |
---|
183 | ;; |
---|
184 | esac |
---|
185 | shift |
---|
186 | done |
---|
187 | |
---|
188 | # Consistency checks: Make sure that the stable URL exists. If we're building |
---|
189 | # a ThirdParty or Data release, we need a BuildTools URL. |
---|
190 | |
---|
191 | if test $printHelp = 0 && test $exitValue = 0 ; then |
---|
192 | if svn list $stableURL 2>&1 >/dev/null ; then |
---|
193 | : |
---|
194 | else |
---|
195 | echo "Stable URL $stableURL does not seem to exist." |
---|
196 | printHelp=1 |
---|
197 | exitValue=5 |
---|
198 | fi |
---|
199 | fi |
---|
200 | if test $printHelp = 0 && test $exitValue = 0 ; then |
---|
201 | case $stableURL in |
---|
202 | *ThirdParty/* ) |
---|
203 | isThirdParty=yes |
---|
204 | ;; |
---|
205 | *Data/* ) |
---|
206 | isData=yes |
---|
207 | isNormal=no |
---|
208 | ;; |
---|
209 | *BuildTools/* ) |
---|
210 | isBuildTools=yes |
---|
211 | isNormal=no |
---|
212 | ;; |
---|
213 | *) |
---|
214 | ;; |
---|
215 | esac |
---|
216 | if test $isThirdParty = yes || test $isData = yes ; then |
---|
217 | if test -z $cmdBTURL ; then |
---|
218 | echo "You must provide a BuildTools URL to build a ThirdParty or Data project." |
---|
219 | printHelp=1 |
---|
220 | exitValue=4 |
---|
221 | else |
---|
222 | if svn list $cmdBTURL 2>&1 >/dev/null ; then |
---|
223 | : |
---|
224 | else |
---|
225 | echo "BuildTools URL $cmdBTURL does not seem to exist." |
---|
226 | printHelp=1 |
---|
227 | exitValue=6 |
---|
228 | fi |
---|
229 | fi |
---|
230 | fi |
---|
231 | fi |
---|
232 | fi # if "$#" .eq 0 |
---|
233 | |
---|
234 | if test $printHelp = 1 ; then |
---|
235 | cat <<EOF |
---|
236 | Usage: prepare_new_release <stableVer> [options] |
---|
237 | |
---|
238 | COIN standard practice is to generate periodic releases by taking a snapshot |
---|
239 | of the stable branch of the project. You can use this script to prepare |
---|
240 | a new release based on the specified stable branch. |
---|
241 | |
---|
242 | <stableVer> specifies the stable branch of your project to be used to |
---|
243 | create the new release. You can specify the entire URL, or you just enter |
---|
244 | what comes after "https://projects.coin-or.org/svn". A typical example is |
---|
245 | |
---|
246 | prepare_new_release Ipopt/stable/3.3 |
---|
247 | |
---|
248 | Options: |
---|
249 | -b <BuildToolsURL> URL for BuildTools; required to generate a release |
---|
250 | for a ThirdParty or Data project. |
---|
251 | -i <projectlist> Ignore BuildTools version mismatches for the listed |
---|
252 | externals (comma-separated list of project names, |
---|
253 | e.g., -i Osi,Cbc). '-i all' ignores all mismatches. |
---|
254 | -p Suppress checkout (useful for testing) |
---|
255 | -s <projectlist> Suppress conversion from stable to release for the |
---|
256 | listed externals (comma-separated list of project |
---|
257 | names). |
---|
258 | -x <projectlist> Remove the listed projects from the list of externals |
---|
259 | (comma-separated list of project names). |
---|
260 | |
---|
261 | This script will do the following: |
---|
262 | |
---|
263 | - Automatically determine the next release number (X.Y.0 if this is the |
---|
264 | first release for stable/X.Y, otherwise one greater than any existing |
---|
265 | release) |
---|
266 | - Check out a clean copy of the specified stable branch, without externals |
---|
267 | - Make sure that the svn:externals property points to releases, with the |
---|
268 | exception of projects in the list specified with -s. |
---|
269 | - Create a new package configure.ac file with the release version number |
---|
270 | specified in the AC_INIT macro. |
---|
271 | - Use the "get.*" scripts to download any ThirdParty code. |
---|
272 | - Execute run_autotools to update configure, Makefile.in, etc., to reflect |
---|
273 | the most recent release of BuildTools. |
---|
274 | - Run the configure script, compile the code, and run the unit test. |
---|
275 | - Replace stable externals for projects specified with -s with the |
---|
276 | appropriate (yet to be committed) release. |
---|
277 | |
---|
278 | If there is any error during these tasks the script will stop and you should |
---|
279 | examine the output. |
---|
280 | |
---|
281 | If the script completes without error, examine the output, particularly the |
---|
282 | output of the unit test ('make test') and the set of externals specified in |
---|
283 | the Dependencies file. |
---|
284 | |
---|
285 | This script does not make any changes to the repository. If you want to |
---|
286 | commit the new release, run the "commit_new_release" script, as described |
---|
287 | at the end of the output. |
---|
288 | |
---|
289 | EOF |
---|
290 | fi |
---|
291 | |
---|
292 | if test $exitValue != 0 || test $printHelp = 1 ; then |
---|
293 | exit $exitValue |
---|
294 | fi |
---|
295 | |
---|
296 | # End of parameter parsing. We have a stable URL to work with. Tell the |
---|
297 | # user what we've seen. |
---|
298 | |
---|
299 | stableURL=`echo $stableURL | sed -e 's|/$||'` |
---|
300 | stableProj=`extractProjFromURL $stableURL` |
---|
301 | majVer=`extractMajorFromURL $stableURL` |
---|
302 | minVer=`extractMinorFromURL $stableURL` |
---|
303 | stableVer=$majVer.$minVer |
---|
304 | echo "Stable URL..........: $stableURL" |
---|
305 | echo "Stable project......: $stableProj" |
---|
306 | echo "Stable branch.......: $stableVer" |
---|
307 | if test -n "$stableExternals" ; then |
---|
308 | echo "Stable externals....: $stableExternals." |
---|
309 | fi |
---|
310 | |
---|
311 | # Find out the most recent release (if any) for the stable branch, then |
---|
312 | # construct the revision number of the new release. If there are existing |
---|
313 | # releases, it's a matter of bumping the revision number and inserting the |
---|
314 | # new revision in the URL. Otherwise, we know the new revision is 0 and we |
---|
315 | # can simply tweak the stable URL. |
---|
316 | |
---|
317 | releaseURL=`bestRelease $stableURL $majVer $minVer | sed -e 's|/$||'` |
---|
318 | if test -n "$releaseURL" ; then |
---|
319 | curRel=`extractReleaseFromURL $releaseURL` |
---|
320 | existingURL=$releaseURL |
---|
321 | newRel=`expr $curRel + 1` |
---|
322 | else |
---|
323 | curRel=-1 |
---|
324 | releaseURL=`echo $stableURL | sed -e s/stable/releases/` |
---|
325 | existingURL="none" |
---|
326 | newRel=0 |
---|
327 | fi |
---|
328 | newVer=$majVer.$minVer.$newRel |
---|
329 | releaseURL=`replaceVersionInURL $releaseURL $majVer $minVer $newRel` |
---|
330 | |
---|
331 | echo "Top release URL.....: $existingURL" |
---|
332 | echo "New release URL.....: $releaseURL" |
---|
333 | |
---|
334 | # Relevant only if we're building ThirdParty or Data |
---|
335 | |
---|
336 | if test $isThirdParty = yes || test $isData = yes ; then |
---|
337 | echo "BuildTools URL......: $cmdBTURL" |
---|
338 | fi |
---|
339 | |
---|
340 | # We need a libtool version number only for normal projects |
---|
341 | |
---|
342 | if test $isNormal = yes ; then |
---|
343 | newLTCurrent=`calcLibtoolCurrent $stableURL $majVer $minVer` |
---|
344 | newLTRevision=$newRel |
---|
345 | newLTAge=`calcLibtoolAge $stableURL $majVer $minVer` |
---|
346 | newLTAge=`expr $newLTAge - 1` |
---|
347 | newLTVer=${newLTCurrent}:${newLTRevision}:${newLTAge} |
---|
348 | echo "Libtool version.....: $newLTVer" |
---|
349 | fi |
---|
350 | |
---|
351 | # Now decide where to build and check out code. If the stable project name |
---|
352 | # contains a '/', strip it out to make the build and checkout directories. |
---|
353 | |
---|
354 | topBuildDir=`echo $stableProj | sed -e 's|.*/\([^/]*\)$|\1|'` |
---|
355 | topBuildDir="${topBuildDir}-${newVer}" |
---|
356 | if test $isThirdParty = yes; then |
---|
357 | coDir=$topBuildDir/Thirdparty/$stableProj |
---|
358 | elif test $isData = yes; then |
---|
359 | coDir=$topBuildDir/Data/$stableProj |
---|
360 | else |
---|
361 | coDir=$topBuildDir |
---|
362 | fi |
---|
363 | echo "Build directory.....: $topBuildDir" |
---|
364 | echo "Checkout directory..: $coDir" |
---|
365 | |
---|
366 | # Check out the stable branch that'll be the base of the new release. No |
---|
367 | # externals at this point. Creating a release of a ThirdParty or Data project |
---|
368 | # requires a bit of work, as we need to assemble a temporary package with a |
---|
369 | # BuildTools external. |
---|
370 | |
---|
371 | echo '' |
---|
372 | echo "===> Checking out stable release $stableVer without externals..." |
---|
373 | echo '' |
---|
374 | |
---|
375 | rm -rf $topBuildDir |
---|
376 | cmd="svn co --ignore-externals $stableURL $coDir" |
---|
377 | if test $suppressCheckout = 1 ; then |
---|
378 | echo "Pretending to do: $cmd" |
---|
379 | else |
---|
380 | rm -rf $topBuildDir |
---|
381 | echo $cmd |
---|
382 | eval $cmd |
---|
383 | fi |
---|
384 | |
---|
385 | if test $isThirdParty = yes || test $isData = yes; then |
---|
386 | echo '' |
---|
387 | echo '===> Checking out BuildTools (Data or ThirdParty) ...' |
---|
388 | echo '' |
---|
389 | cmd="svn co $cmdBTURL $topBuildDir/BuildTools" |
---|
390 | if test $suppressCheckout = 1 ; then |
---|
391 | echo "Pretending to do: $cmd" |
---|
392 | else |
---|
393 | echo $cmd |
---|
394 | eval $cmd |
---|
395 | fi |
---|
396 | fi |
---|
397 | |
---|
398 | startDir=`pwd` |
---|
399 | coDir=`cd $coDir; pwd` |
---|
400 | topBuildDir=`cd $topBuildDir; pwd` |
---|
401 | |
---|
402 | cd $coDir |
---|
403 | |
---|
404 | # Find configure.ac files for the package and project and update the version. |
---|
405 | # We have no externals or third-party code at this point, so there will be |
---|
406 | # two files for a normal project, one for a ThirdParty or Data project, and |
---|
407 | # none for BuildTools. |
---|
408 | |
---|
409 | echo '' |
---|
410 | echo "===> Checking for configure.ac files ..." |
---|
411 | bak_files=`find . -name 'configure.ac'` |
---|
412 | |
---|
413 | if test -n "$bak_files" ; then |
---|
414 | for i in $bak_files; do |
---|
415 | cp $i $i.bak |
---|
416 | done |
---|
417 | |
---|
418 | # Take the attitude that [] around parameters in AC_INIT is optional, |
---|
419 | # it's the commas that count. This does make for a surpassing ugly regular |
---|
420 | # expression. A comma in the version string will cause a spectacular failure. |
---|
421 | # In AC_COIN_PROJECTDIR_INIT, take the attitude that the existing parameters |
---|
422 | # don't matter, we know what the release parameters should be. |
---|
423 | |
---|
424 | echo '' |
---|
425 | echo "===> Updating version numbers in configure.ac files ..." |
---|
426 | for i in $bak_files; do |
---|
427 | sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVer\3,\4|" $i > bla |
---|
428 | mv bla $i |
---|
429 | lastComponent=`echo $stableProj | sed -e 's|.*/\([^/][^/]*\)|\1|'` |
---|
430 | sed -e "s|AC_COIN_PROJECTDIR_INIT(.*)|AC_COIN_PROJECTDIR_INIT\($lastComponent,$newLTCurrent:$newLTRevision:$newLTAge\)|" $i > bla |
---|
431 | mv bla $i |
---|
432 | svn diff $i |
---|
433 | done |
---|
434 | else |
---|
435 | echo " ... none to process." |
---|
436 | fi |
---|
437 | |
---|
438 | # Find ProjConfig.h. If there's a definition for PROJ_VERSION, adjust it and |
---|
439 | # add ProjConfig.h.bak to the list of files to be restored. |
---|
440 | |
---|
441 | stableProjUC=`echo $stableProj | tr '[a-z]' '[A-Z]'` |
---|
442 | configFileLoc=`find . -name '*Config.h' -print` |
---|
443 | if test -n "$configFileLoc" ; then |
---|
444 | versionSym=${stableProjUC}_VERSION |
---|
445 | echo '' |
---|
446 | echo "===> Updating $versionSym in $configFileLoc (if present)" |
---|
447 | echo '' |
---|
448 | mv $configFileLoc $configFileLoc.bak |
---|
449 | bak_files="$bak_files $configFileLoc" |
---|
450 | sed -e "s/# *define $versionSym.*\$/#define $versionSym \"$newVer\"/" <$configFileLoc.bak >$configFileLoc |
---|
451 | svn diff $configFileLoc |
---|
452 | fi |
---|
453 | |
---|
454 | # The Dependencies file in a stable branch should contain only stable |
---|
455 | # and release references (trunk is flagged as an error below). The overall |
---|
456 | # algorithm is to convert svn:externals to use releases but leave Dependencies |
---|
457 | # with stables. In practice, this is accomplished by backing up Dependencies, |
---|
458 | # using Dependencies to assemble and set svn:externals, and finally restoring |
---|
459 | # Dependencies from the backup after all else is done. |
---|
460 | |
---|
461 | # Look for a file specifying externals. Preferably Dependencies, but check for |
---|
462 | # Externals just in case this is an unconverted project. |
---|
463 | |
---|
464 | srcDepFile= |
---|
465 | for file in Dependencies Externals ; do |
---|
466 | if test -r $file ; then |
---|
467 | srcDepFile=$file |
---|
468 | break |
---|
469 | fi |
---|
470 | done |
---|
471 | |
---|
472 | # Now generate the proper externals for the release. Each line in a |
---|
473 | # Dependencies file has the format <ext_name> <ext_url>. Normally, each |
---|
474 | # <ext_url> should be a stable branch. References to stable branches will be |
---|
475 | # converted to references to releases unless the reference is to a project |
---|
476 | # in the stableExternals list (in which case it'll be converted at the very |
---|
477 | # end). References to releases are not changed. References to trunk are an |
---|
478 | # error. Failure to find a release for an external not in the stableExternals |
---|
479 | # list is an error. Save the existing externals and srcDepFile, as we'll |
---|
480 | # probably change both. |
---|
481 | |
---|
482 | if test -n "$srcDepFile" ; then |
---|
483 | |
---|
484 | svn propget svn:externals . > .Externals.original |
---|
485 | bak_files="$bak_files $srcDepFile" |
---|
486 | cp $srcDepFile $srcDepFile.bak |
---|
487 | |
---|
488 | echo '' |
---|
489 | echo "===> Checking externals in $srcDepFile ..." |
---|
490 | echo '' |
---|
491 | |
---|
492 | # Because we're working directly from command output, the regular expression |
---|
493 | # must check for lines. |
---|
494 | |
---|
495 | ourBTURL=`svn propget svn:externals . | \ |
---|
496 | sed -n -e 's/^BuildTools *https:\([^ ]*\)$/https:\1/p'` |
---|
497 | if test -z "$ourBTURL" ; then |
---|
498 | ourBTURL=none |
---|
499 | fi |
---|
500 | echo "Our BuildTools...: $ourBTURL" |
---|
501 | |
---|
502 | rm -f Dependencies |
---|
503 | ext_name= |
---|
504 | ext_url= |
---|
505 | buildtoolsMismatch=0 |
---|
506 | for i in `cat $srcDepFile.bak`; do |
---|
507 | if test "$ext_name" = ""; then |
---|
508 | ext_name="$i" |
---|
509 | else |
---|
510 | ext_url=$i |
---|
511 | if expr "$ext_name" : '#.*' 2>&1 >/dev/null ; then |
---|
512 | echo " $ext_name $ext_url ==> skipped" |
---|
513 | ext_name= |
---|
514 | continue |
---|
515 | fi |
---|
516 | ext_urltype=`extractTypeFromURL $ext_url` |
---|
517 | ext_proj=`extractProjFromURL $ext_url` |
---|
518 | |
---|
519 | # See if this external should be dropped. |
---|
520 | |
---|
521 | if expr "$exciseExternals" : '.*'$ext_proj'.*' 2>&1 > /dev/null ; then |
---|
522 | echo " $ext_name $ext_url ==> excised" |
---|
523 | ext_name= |
---|
524 | continue |
---|
525 | fi |
---|
526 | |
---|
527 | # External must be a stable or a release. |
---|
528 | |
---|
529 | if test $ext_urltype != stable && test $ext_urltype != release ; then |
---|
530 | echo '' |
---|
531 | echo "===> The external URL $ext_url is not a stable branch or release. Exiting." |
---|
532 | echo '' |
---|
533 | exit 2 |
---|
534 | fi |
---|
535 | |
---|
536 | ext_isNormal=`isNormalURL $ext_url` |
---|
537 | |
---|
538 | # Convert stable branches to releases unless listed in stableExternals. |
---|
539 | # Existing releases are unchanged. |
---|
540 | |
---|
541 | if test $ext_urltype = stable ; then |
---|
542 | if expr "$stableExternals" : '.*'"$ext_proj"'.*' 2>&1 >/dev/null ; then |
---|
543 | echo " $ext_name $ext_url unchanged" |
---|
544 | ext_rel_url=$ext_url |
---|
545 | else |
---|
546 | ext_majVer=`extractMajorFromURL $ext_url` |
---|
547 | ext_minVer=`extractMinorFromURL $ext_url` |
---|
548 | ext_rel_url=`bestRelease $ext_url $ext_majVer $ext_minVer` |
---|
549 | if test -z "$ext_rel_url" ; then |
---|
550 | echo '' |
---|
551 | echo "===> No release for $ext_url. Exiting." |
---|
552 | echo '' |
---|
553 | exit 2 |
---|
554 | fi |
---|
555 | # Normal (not BuildTools/ThirdParty/Data) need a directory name, |
---|
556 | # and it may differ from the project name. Carefully preserve it. |
---|
557 | if test $ext_isNormal = yes ; then |
---|
558 | ext_tail=`extractTailFromExt $ext_url` |
---|
559 | ext_rel_url=${ext_rel_url}${ext_tail} |
---|
560 | fi |
---|
561 | echo " $ext_name $ext_url ==> $ext_rel_url" |
---|
562 | fi |
---|
563 | else |
---|
564 | ext_rel_url=$ext_url |
---|
565 | echo " $ext_name $ext_url ==> unchanged" |
---|
566 | fi |
---|
567 | |
---|
568 | # Get the BuildTools URL for the external and compare to the BuildTools URL |
---|
569 | # for the source, assuming we have one and the external has one. We only need |
---|
570 | # to do this for normal URLs, and we need to strip the tail. |
---|
571 | |
---|
572 | if test $ext_isNormal = yes && |
---|
573 | test $ext_proj != BuildTools && test $ourBTURL != none ; then |
---|
574 | ext_rel_url_notail=`echo $ext_rel_url | sed -e 's,/[^/]*$,,'` |
---|
575 | extBTURL=`svn propget svn:externals $ext_rel_url_notail` |
---|
576 | extBTURL=`echo $extBTURL | \ |
---|
577 | sed -n -e 's/^BuildTools *https:\([^ ]*\) *$/https:\1/p'` |
---|
578 | if test -n "$extBTURL" ; then |
---|
579 | testResult=`compareURLVersions "$ourBTURL" "$extBTURL"` |
---|
580 | if test $testResult = no ; then |
---|
581 | if test $ignoreBuildToolsMismatch = all || \ |
---|
582 | expr "$mismatchBTExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then |
---|
583 | echo " WARNING: BuildTools mismatch: $ext_url_notail uses $extBTURL" |
---|
584 | else |
---|
585 | buildtoolsMismatch=1 |
---|
586 | echo " ERROR: BuildTools mismatch: $ext_url_notail uses $extBTURL" |
---|
587 | fi |
---|
588 | fi |
---|
589 | fi |
---|
590 | fi |
---|
591 | echo "$ext_name $ext_rel_url" >>Dependencies |
---|
592 | ext_name= |
---|
593 | echo '' |
---|
594 | fi |
---|
595 | done |
---|
596 | |
---|
597 | # If we have a BuildTools mismatch, exit. |
---|
598 | |
---|
599 | if test $buildtoolsMismatch = 1 ; then |
---|
600 | echo "Exiting due to BuildTools mismatches; use -i to ignore." |
---|
601 | exit 2 |
---|
602 | fi |
---|
603 | |
---|
604 | # Try to check out the externals. Try three times before failing. |
---|
605 | echo '' |
---|
606 | echo '===> Updating svn:externals property and checking out externals ...' |
---|
607 | echo '' |
---|
608 | |
---|
609 | svn propset svn:externals -F Dependencies . |
---|
610 | svn update || |
---|
611 | { echo "Retry 1 ... " ; svn update ; } || |
---|
612 | { echo "Retry 2 ... " ; svn update ; } || |
---|
613 | { echo "Checkout of externals failed. Aborting." ; exit 3 ; } |
---|
614 | |
---|
615 | if test -d ThirdParty ; then |
---|
616 | echo '' |
---|
617 | echo '===> Downloading ThirdParty code ...' |
---|
618 | echo '' |
---|
619 | |
---|
620 | ext_name= |
---|
621 | ext_url= |
---|
622 | for i in `svn propget svn:externals .` ; do |
---|
623 | if test -z "$ext_name" ; then |
---|
624 | ext_name="$i" |
---|
625 | else |
---|
626 | ext_url=$i |
---|
627 | if expr "$ext_name" : 'ThirdParty/.*' 2>&1 >/dev/null ; then |
---|
628 | cd $ext_name |
---|
629 | ext_proj=`extractProjFromURL $ext_url` |
---|
630 | getScript=get.$ext_proj |
---|
631 | if test -x "$getScript" ; then |
---|
632 | ./$getScript -patch |
---|
633 | fi |
---|
634 | cd $coDir |
---|
635 | fi |
---|
636 | ext_name= |
---|
637 | fi |
---|
638 | done |
---|
639 | fi |
---|
640 | fi |
---|
641 | |
---|
642 | # Finally! Done processing externals. If this is a ThirdParty project, we |
---|
643 | # still have to run the get script. |
---|
644 | |
---|
645 | if test $isThirdParty = yes ; then |
---|
646 | if test -x get.$stableProj ; then |
---|
647 | echo '' |
---|
648 | echo '===> Downloading third party code ...' |
---|
649 | echo '' |
---|
650 | ./get.$stableProj |
---|
651 | fi |
---|
652 | fi |
---|
653 | |
---|
654 | # Don't run run_autotools for BuildTools! |
---|
655 | |
---|
656 | if test $isBuildTools = no ; then |
---|
657 | echo '' |
---|
658 | echo '===> Running BuildTools/run_autotools ...' |
---|
659 | echo '' |
---|
660 | if test $isThirdParty = yes || test $isData = yes ; then |
---|
661 | cd ../.. |
---|
662 | ./BuildTools/run_autotools |
---|
663 | cd "$coDir" |
---|
664 | elif test $isNormal = yes ; then |
---|
665 | ./BuildTools/run_autotools |
---|
666 | fi |
---|
667 | fi |
---|
668 | |
---|
669 | # Let's see if it works. We only run tests for normal projects. DO NOT turn |
---|
670 | # on --enable-maintainer-mode in the initial configure command. At the least, |
---|
671 | # it's not needed. At the worst, as of 100526, it'll undo all the careful |
---|
672 | # work above to set externals. |
---|
673 | |
---|
674 | if test $isNormal = yes ; then |
---|
675 | (set -e |
---|
676 | echo '' |
---|
677 | echo '===> Creating build directory and running the configuration script...' |
---|
678 | echo '' |
---|
679 | mkdir build |
---|
680 | cd build |
---|
681 | cmd="$coDir/configure -C" |
---|
682 | echo $cmd |
---|
683 | eval $cmd |
---|
684 | echo '' |
---|
685 | echo '===> Compiling code...' |
---|
686 | echo '' |
---|
687 | cmd='make install' |
---|
688 | echo $cmd |
---|
689 | eval $cmd |
---|
690 | echo '' |
---|
691 | echo '===> Running the unit test...' |
---|
692 | echo '' |
---|
693 | echo '*******************************************************************************' |
---|
694 | echo '*** ***' |
---|
695 | echo '*** BEGIN OUTPUT OF MAKE TEST ***' |
---|
696 | echo '*** ***' |
---|
697 | echo '*******************************************************************************' |
---|
698 | echo '' |
---|
699 | cmd='make test' |
---|
700 | echo $cmd |
---|
701 | eval $cmd |
---|
702 | echo '' |
---|
703 | echo '*******************************************************************************' |
---|
704 | echo '*** ***' |
---|
705 | echo '*** END OUTPUT OF MAKE TEST ***' |
---|
706 | echo '*** ***' |
---|
707 | echo '*******************************************************************************' |
---|
708 | ) |
---|
709 | if test $? != 0; then |
---|
710 | echo '' |
---|
711 | echo 'Error during build or test' |
---|
712 | echo '' |
---|
713 | exit 3 |
---|
714 | fi |
---|
715 | echo '' |
---|
716 | echo '===> ALL TESTS PASSED' |
---|
717 | fi |
---|
718 | |
---|
719 | echo '' |
---|
720 | if test $isNormal = yes ; then |
---|
721 | echo 'Please review the output above, particularly the one of make test.' |
---|
722 | else |
---|
723 | echo 'Please review the output above.' |
---|
724 | fi |
---|
725 | echo '' |
---|
726 | |
---|
727 | # Do we need to plug in nonexistent releases for circular dependencies tested |
---|
728 | # with the stable versions? If so, generate a new Dependencies. This is the |
---|
729 | # only reason stable references should appear in the externals for a release, |
---|
730 | # so we don't need to check further before removing them. |
---|
731 | |
---|
732 | if test -n "$stableExternals" ; then |
---|
733 | echo "===> Grooming externals to remove stable externals used for testing ..." |
---|
734 | mv Dependencies Dependencies.temp.$$ |
---|
735 | ext_name= |
---|
736 | ext_url= |
---|
737 | for i in `cat Dependencies.temp.$$`; do |
---|
738 | if test "$ext_name" = ""; then |
---|
739 | ext_name="$i" |
---|
740 | else |
---|
741 | ext_url=$i |
---|
742 | ext_urltype=`extractTypeFromURL $ext_url` |
---|
743 | ext_proj=`extractProjFromURL $ext_url` |
---|
744 | if test $ext_urltype = stable ; then |
---|
745 | ext_rel_url=$ext_url |
---|
746 | ext_majVer=`extractMajorFromURL $ext_url` |
---|
747 | ext_minVer=`extractMinorFromURL $ext_url` |
---|
748 | ext_rel_url=`echo $ext_url | sed -e 's,/stable/,/releases/,'` |
---|
749 | ext_rel_url=`replaceVersionInURL $ext_rel_url $ext_majVer $ext_minVer 0` |
---|
750 | echo " $ext_name $ext_url ==> $ext_rel_url" |
---|
751 | else |
---|
752 | ext_rel_url=$ext_url |
---|
753 | fi |
---|
754 | echo "$ext_name $ext_rel_url" >>Dependencies |
---|
755 | ext_name= |
---|
756 | fi |
---|
757 | done |
---|
758 | rm -f Dependencies.temp.$$ |
---|
759 | svn propset -F Dependencies svn:externals . |
---|
760 | echo '' |
---|
761 | fi |
---|
762 | |
---|
763 | # If we had a Dependencies file to begin with, it contained references to |
---|
764 | # stable branches, and perhaps releases. This is the set of dependencies that |
---|
765 | # we want to commit in Dependencies, so reload $srcDepFile.bak into |
---|
766 | # Dependencies, now that we have svn:externals set to releases. |
---|
767 | |
---|
768 | if test -n "$srcDepFile" ; then |
---|
769 | cp $srcDepFile.bak Dependencies |
---|
770 | fi |
---|
771 | |
---|
772 | if test -r Dependencies ; then |
---|
773 | echo 'Also, please confirm the externals are correct:' |
---|
774 | svn propget svn:externals |
---|
775 | fi |
---|
776 | |
---|
777 | echo '' |
---|
778 | echo 'After reviewing the output above, you can create a new release by going into' |
---|
779 | echo 'the directory' |
---|
780 | echo '' |
---|
781 | echo " $startDir" |
---|
782 | echo '' |
---|
783 | echo "and run the commit_new_release script" |
---|
784 | |
---|
785 | cd $topBuildDir |
---|
786 | |
---|
787 | cat >.new_release_data <<EOF |
---|
788 | coinURL=$coinURL |
---|
789 | startDir=$startDir |
---|
790 | topBuildDir=$topBuildDir |
---|
791 | coDir=$coDir |
---|
792 | releaseURL=$releaseURL |
---|
793 | stableURL=$stableURL |
---|
794 | newVer=$newVer |
---|
795 | bak_files="$bak_files" |
---|
796 | EOF |
---|