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: prepare_new_release 1302 2009-06-07 18:17:53Z tkr $ |
---|
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 | |
---|
15 | #set -x -v |
---|
16 | set -e |
---|
17 | |
---|
18 | # You can think of this script as having three sections: first, the following |
---|
19 | # function definition, then parameter parsing and validation, and finally the |
---|
20 | # actual generation of the release candidate. See the help message for a good |
---|
21 | # description of the actions taken to generate the release candidate. |
---|
22 | |
---|
23 | # Utility function to determine current or next release for a given stable |
---|
24 | # branch. Call is determine_release(stableURL,next). Replace next with 1 for |
---|
25 | # the next release, 0 for the current release. This code is needed in three |
---|
26 | # separate places, so it really deserves to be a function. We can hope that |
---|
27 | # maintainers will have a reasonably modern version of standard sh. |
---|
28 | |
---|
29 | # Data is a real pain in the **** and should be converted to the standard |
---|
30 | # nomenclature. |
---|
31 | |
---|
32 | determine_release () |
---|
33 | { |
---|
34 | if test $isData = no ; then |
---|
35 | |
---|
36 | drtmp_stableBranch=`echo $1 | sed -e 's|.*/stable/||'` |
---|
37 | drtmp_baseURL=`echo $1 | sed -e 's|/stable/[0-9.]*||'` |
---|
38 | drtmp_returnVal= |
---|
39 | |
---|
40 | # List the existing releases and screen for releases matching stableBranch. |
---|
41 | |
---|
42 | drtmp_svnlst=`svn list $drtmp_baseURL/releases/` |
---|
43 | |
---|
44 | drtmp_release_vers= |
---|
45 | for drtmp_i in $drtmp_svnlst ; do |
---|
46 | case $drtmp_i in |
---|
47 | $drtmp_stableBranch.*) |
---|
48 | drtmp_i=`echo $drtmp_i | sed -e 's|/$||'` |
---|
49 | drtmp_release_vers="$drtmp_release_vers $drtmp_i";; |
---|
50 | esac; |
---|
51 | done |
---|
52 | |
---|
53 | # Are there any existing releases? If not, and the user didn't ask for the |
---|
54 | # next release, we have an error. |
---|
55 | |
---|
56 | if test -z "$drtmp_release_vers" ; then |
---|
57 | if test $2 = 1 ; then |
---|
58 | drtmp_returnVal="$drtmp_stableBranch.0" |
---|
59 | else |
---|
60 | drtmp_returnVal="Error" |
---|
61 | fi |
---|
62 | else |
---|
63 | |
---|
64 | # There are releases. If we don't have one after the loop, we're confused. |
---|
65 | |
---|
66 | drtmp_new_rel=-10000 |
---|
67 | for drtmp_i in $drtmp_release_vers; do |
---|
68 | drtmp_rel=`echo $drtmp_i | sed -e "s|^$drtmp_stableBranch.||"` |
---|
69 | if test $drtmp_rel -gt $drtmp_new_rel; then |
---|
70 | drtmp_new_rel=$drtmp_rel |
---|
71 | fi |
---|
72 | done |
---|
73 | |
---|
74 | if test $drtmp_new_rel = -10000; then |
---|
75 | drtmp_new_rel="Error" |
---|
76 | elif test $2 = 1 ; then |
---|
77 | drtmp_new_rel=`expr $drtmp_new_rel + 1` |
---|
78 | fi |
---|
79 | drtmp_returnVal="$drtmp_stableBranch.$drtmp_new_rel" |
---|
80 | fi |
---|
81 | |
---|
82 | else # end normal and ThirdParty, begin Data |
---|
83 | |
---|
84 | drtmp_stableBranch=`echo $1 | sed -e 's|.*/stable/\([0-9.]*\)/.*|\1|'` |
---|
85 | drtmp_baseURL=`echo $1 | sed -e 's|\(.*\)/stable/[0-9.]*/.*|\1|'` |
---|
86 | drtmp_proj=`echo $1 | sed -e 's|.*/stable/[0-9.]*/||'` |
---|
87 | |
---|
88 | # Screen for releases that match the stable branch and contain the project |
---|
89 | # of interest. First, check for releases that match the stable branch. If |
---|
90 | # there are none, we're release 0 for this stable branch. It's an error if |
---|
91 | # there are no releases and the user did not ask for the next release. Sort |
---|
92 | # by release number here, while we have newlines in the list from svn. |
---|
93 | |
---|
94 | drtmp_svnlst=`svn list $drtmp_baseURL/releases | sort -nr -t. -k3,3` |
---|
95 | |
---|
96 | drtmp_release_vers= |
---|
97 | for drtmp_i in $drtmp_svnlst ; do |
---|
98 | case $drtmp_i in |
---|
99 | $drtmp_stableBranch.*) |
---|
100 | drtmp_i=`echo $drtmp_i | sed -e 's|/$||'` |
---|
101 | drtmp_release_vers="$drtmp_release_vers $drtmp_i";; |
---|
102 | esac; |
---|
103 | done |
---|
104 | |
---|
105 | # Do we have releases that match the stable branch? |
---|
106 | |
---|
107 | if test -z "$drtmp_release_vers" ; then |
---|
108 | if test $2 = 1 ; then |
---|
109 | drtmp_returnVal="$drtmp_stableBranch.0" |
---|
110 | else |
---|
111 | drtmp_returnVal="Error" |
---|
112 | fi |
---|
113 | else |
---|
114 | |
---|
115 | # Releases exist that match stable; do any contain our project? Because |
---|
116 | # we presorted by release, we can break here at the first success. |
---|
117 | |
---|
118 | drtmp_svnlst=`echo $drtmp_release_vers` |
---|
119 | drtmp_release_vers= |
---|
120 | for drtmp_i in $drtmp_svnlst ; do |
---|
121 | case $drtmp_i in |
---|
122 | $drtmp_stableBranch.*) |
---|
123 | drtmp_i=`echo $drtmp_i | sed -e 's|/$||'` |
---|
124 | drtmp_projlst=`2>&1 svn list $drtmp_baseURL/releases/$drtmp_i/$drtmp_proj` |
---|
125 | if expr "$drtmp_projlst" : '.*non-existent.*' 2>&1 >/dev/null ; then |
---|
126 | : |
---|
127 | else |
---|
128 | drtmp_release_vers="$drtmp_i" |
---|
129 | break |
---|
130 | fi |
---|
131 | ;; |
---|
132 | esac; |
---|
133 | done |
---|
134 | |
---|
135 | # Are there any existing releases? If no, and the user didn't ask for |
---|
136 | # the next release, it's an error. Otherwise, go for release 0 of |
---|
137 | # proj in the current stable branch. If there are existing releases, |
---|
138 | # return either the current or +1. |
---|
139 | |
---|
140 | if test -z "$drtmp_release_vers" ; then |
---|
141 | if test $2 = 0 ; then |
---|
142 | drtmp_returnVal="$drtmp_stableBranch.Error" |
---|
143 | else |
---|
144 | drtmp_returnVal="$drtmp_stableBranch.0" |
---|
145 | fi |
---|
146 | else |
---|
147 | drtmp_new_rel=-10000 |
---|
148 | for drtmp_i in $drtmp_release_vers; do |
---|
149 | drtmp_rel=`echo $drtmp_i | sed -e "s|^$drtmp_stableBranch.||"` |
---|
150 | if test $drtmp_rel -gt $drtmp_new_rel; then |
---|
151 | drtmp_new_rel=$drtmp_rel |
---|
152 | fi |
---|
153 | done |
---|
154 | drtmp_new_rel=`expr $drtmp_new_rel + 1` |
---|
155 | drtmp_returnVal="$drtmp_stableBranch.$drtmp_new_rel" |
---|
156 | fi |
---|
157 | |
---|
158 | fi # for releases matching stable branch |
---|
159 | |
---|
160 | fi # for normal/Data |
---|
161 | |
---|
162 | echo $drtmp_returnVal |
---|
163 | } |
---|
164 | |
---|
165 | |
---|
166 | # Specify the COIN URL base for convenience. |
---|
167 | |
---|
168 | coinURL="https://projects.coin-or.org/svn" |
---|
169 | |
---|
170 | # Begin parameter processing. |
---|
171 | |
---|
172 | printHelp=0 |
---|
173 | exitValue=0 |
---|
174 | ignoreBuildToolsMismatch=0 |
---|
175 | |
---|
176 | # stableURL will be the stable branch that is the parent for the release we |
---|
177 | # are building. We'll need to be able to distinguish ThirdParty and Data |
---|
178 | # builds; they require special handling. |
---|
179 | # buildToolsURL is required when stableURL specifies a ThirdParty or Data |
---|
180 | # project --- we'll need to assemble a temporary package while creating the |
---|
181 | # release candidate. |
---|
182 | |
---|
183 | stableURL= |
---|
184 | isThirdParty=no |
---|
185 | isData=no |
---|
186 | buildToolsURL= |
---|
187 | |
---|
188 | # stableExternals, on the other hand, specifies externals for which we are |
---|
189 | # doing simultaneous releases. We will use the stable branch of the external |
---|
190 | # while preparing and testing this release candidate, changing the Externals |
---|
191 | # file to specify a (nonexistent) release of the external at the last moment. |
---|
192 | |
---|
193 | stableExternals= |
---|
194 | |
---|
195 | # We need at least one parameter. |
---|
196 | |
---|
197 | if test "$#" -eq 0; then |
---|
198 | printHelp=1 |
---|
199 | else |
---|
200 | |
---|
201 | # Process the parameters. A parameter without an opening `-' is assumed to be |
---|
202 | # the spec for the stable branch. |
---|
203 | |
---|
204 | while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do |
---|
205 | case "$1" in |
---|
206 | -h* | --h*) printHelp=1 ;; |
---|
207 | -i* | --i*) ignoreBuildToolsMismatch=1 ;; |
---|
208 | -s* | --s*) |
---|
209 | if expr "$1" : '.*-s.*=.*' 2>&1 >/dev/null ; then |
---|
210 | stableExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
211 | else |
---|
212 | shift |
---|
213 | stableExternals=$1 |
---|
214 | fi |
---|
215 | ;; |
---|
216 | -b* | --b*) |
---|
217 | if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then |
---|
218 | buildToolsURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
---|
219 | else |
---|
220 | shift |
---|
221 | buildToolsURL=$1 |
---|
222 | fi |
---|
223 | if expr "$buildToolsURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then |
---|
224 | case $buildToolsURL in |
---|
225 | http*) ;; |
---|
226 | *) buildToolsURL=${coinURL}/$buildToolsURL |
---|
227 | ;; |
---|
228 | esac |
---|
229 | else |
---|
230 | echo '' |
---|
231 | echo "URL $buildToolsURL does not point to BuildTools." |
---|
232 | echo '' |
---|
233 | printHelp=1 |
---|
234 | exitValue=-3 |
---|
235 | fi |
---|
236 | ;; |
---|
237 | |
---|
238 | -*) echo "$0: unrecognised command line switch '"$1"'." |
---|
239 | printHelp=1 |
---|
240 | exitValue=-1 |
---|
241 | ;; |
---|
242 | *) stableURL=$1 |
---|
243 | if expr "$stableURL" : '.*/stable/.*' 2>&1 >/dev/null ; then |
---|
244 | case $stableURL in |
---|
245 | http*) ;; |
---|
246 | *) stableURL=${coinURL}/$stableURL |
---|
247 | ;; |
---|
248 | esac |
---|
249 | else |
---|
250 | echo '' |
---|
251 | echo "URL $stableURL does not specify a stable release." |
---|
252 | echo '' |
---|
253 | printHelp=1 |
---|
254 | exitValue=-2 |
---|
255 | fi |
---|
256 | ;; |
---|
257 | esac |
---|
258 | shift |
---|
259 | done |
---|
260 | |
---|
261 | # Consistency checks: Make sure that the stable URL exists. If we're building |
---|
262 | # a ThirdParty or Data release, we need a BuildTools URL. |
---|
263 | |
---|
264 | if test $printHelp = 0 && test $exitValue = 0 ; then |
---|
265 | if svn list $stableURL 2>&1 >/dev/null ; then |
---|
266 | : |
---|
267 | else |
---|
268 | echo "Stable URL $stableURL does not seem to exist." |
---|
269 | printHelp=1 |
---|
270 | exitValue=-5 |
---|
271 | fi |
---|
272 | fi |
---|
273 | if test $printHelp = 0 && test $exitValue = 0 ; then |
---|
274 | case $stableURL in |
---|
275 | *ThirdParty/* ) |
---|
276 | isThirdParty=yes |
---|
277 | ;; |
---|
278 | *Data/* ) |
---|
279 | isData=yes |
---|
280 | ;; |
---|
281 | *) |
---|
282 | ;; |
---|
283 | esac |
---|
284 | if test $isThirdParty = yes || test $isData = yes ; then |
---|
285 | if test -z $buildToolsURL ; then |
---|
286 | echo "You must provide a BuildTools URL to build a ThirdParty or Data project." |
---|
287 | printHelp=1 |
---|
288 | exitValue=-4 |
---|
289 | else |
---|
290 | if svn list $buildToolsURL 2>&1 >/dev/null ; then |
---|
291 | : |
---|
292 | else |
---|
293 | echo "BuildTools URL $buildToolsURL does not seem to exist." |
---|
294 | printHelp=1 |
---|
295 | exitValue=-6 |
---|
296 | fi |
---|
297 | fi |
---|
298 | fi |
---|
299 | fi |
---|
300 | fi |
---|
301 | |
---|
302 | if test $printHelp = 1 ; then |
---|
303 | cat <<EOF |
---|
304 | Usage: prepare_new_release <stableBranch> [options] |
---|
305 | |
---|
306 | COIN standard practice is to generate periodic releases by taking a snapshot |
---|
307 | of the stable branch of the project. You can use this script to prepare |
---|
308 | a new release based on the specified stable branch. |
---|
309 | |
---|
310 | Stable_branch specifies the stable branch of your project to be used to |
---|
311 | create the new release. You can specify the entire URL, or you just enter |
---|
312 | what comes after "https://projects.coin-or.org/svn". A typical example is |
---|
313 | |
---|
314 | prepare_new_release Ipopt/stable/3.3 |
---|
315 | |
---|
316 | Options: |
---|
317 | -b <BuildToolsURL> URL for BuildTools; required to generate a release |
---|
318 | for a ThirdParty or Data project. |
---|
319 | -s <projectlist> Comma-separated list of projects with circular |
---|
320 | dependencies on this project. The stable branch of |
---|
321 | projects in this list will be used while testing, on |
---|
322 | the assumption that simultaneous releases will be |
---|
323 | created as the release candidates are committed. |
---|
324 | -i Ignore BuildTools version mismatches in externals. |
---|
325 | |
---|
326 | This script will do the following: |
---|
327 | |
---|
328 | - Automatically determine the next release number (X.Y.0 if this is the |
---|
329 | first release for stable/X.Y, otherwise one greater than any existing |
---|
330 | release) |
---|
331 | - Check out a clean copy of the specified stable branch, without externals |
---|
332 | - Read the Externals file and create a new Externals file for the release |
---|
333 | by converting references to stable branches to references to the most |
---|
334 | recent release for that stable branch. |
---|
335 | - Create a new package configure.ac file with the release version number |
---|
336 | specified in the AC_INIT macro. |
---|
337 | - Set the svn:externals property for the release package and check out the |
---|
338 | code for the externals. |
---|
339 | - Use the "get.*" scripts to download any ThirdParty code. |
---|
340 | - Execute run_autotools to update configure, Makefile.in, etc., to reflect |
---|
341 | the most recent release of BuildTools. |
---|
342 | - Check that all dependencies are using the same version of the BuildTools |
---|
343 | - Run the configure script, compile the code, and run the unit test. |
---|
344 | - Replace any stable references in Externals (specified with -s) with the |
---|
345 | appropriate (yet to be committed) release. |
---|
346 | |
---|
347 | If there is any error during these tasks the script will stop and you should |
---|
348 | examine the output. |
---|
349 | |
---|
350 | If the script completes without error, examine the output, particularly the |
---|
351 | output of the unit test ('make test') and the set of externals specified in |
---|
352 | the Externals file. |
---|
353 | |
---|
354 | This script does not make any changes to the repository. If you want to |
---|
355 | commit the new release, run the "commit_new_release" script, as described |
---|
356 | at the end of the output. |
---|
357 | |
---|
358 | EOF |
---|
359 | fi |
---|
360 | |
---|
361 | if test $exitValue != 0 || test $printHelp = 1 ; then |
---|
362 | exit $exitValue |
---|
363 | fi |
---|
364 | |
---|
365 | # End of parameter parsing. We have a stable URL to work with. Tell the |
---|
366 | # user what we've seen. |
---|
367 | |
---|
368 | stableURL=`echo $stableURL | sed -e 's|/$||'` |
---|
369 | if test $isData = yes ; then |
---|
370 | stableProj=`echo $stableURL | sed -n -e 's|.*/[^/]*/stable/[0-9.]*/\(.*\)|\1|p'` |
---|
371 | baseURL=`echo $stableURL | sed -e 's|\(.*\)/stable/[0-9.]*/\(.*\)|\1/_BB_/_RR_/\2|'` |
---|
372 | stableBranch=`echo $stableURL | sed -e 's|.*/stable/\([0-9.]*\)/.*|\1|'` |
---|
373 | else |
---|
374 | stableProj=`echo $stableURL | sed -n -e 's|.*/\([^/]*\)/stable/.*|\1|p'` |
---|
375 | baseURL=`echo $stableURL | sed -e 's|/stable/[0-9.]*||'` |
---|
376 | stableBranch=`echo $stableURL | sed -e 's|.*/stable/||'` |
---|
377 | fi |
---|
378 | echo "StableProj: $stableProj" |
---|
379 | echo "Base URL..........: $baseURL" |
---|
380 | echo "Stable URL........: $stableURL" |
---|
381 | echo "Stable branch.....: $stableBranch" |
---|
382 | if test -n "$stableExternals" ; then |
---|
383 | echo "Stable externals..: $stableExternals." |
---|
384 | fi |
---|
385 | |
---|
386 | # Find out the most recent release (if any) for the stable branch. List the |
---|
387 | # existing releases and screen for releases matching stableBranch. The new |
---|
388 | # release should be one greater than any existing release, or 0 if the stable |
---|
389 | # branch has no releases. |
---|
390 | |
---|
391 | echo '' |
---|
392 | echo "===> Checking releases for stable branch $stableBranch ..." |
---|
393 | |
---|
394 | new_ver=`determine_release "$stableURL" 1` |
---|
395 | |
---|
396 | echo '' |
---|
397 | echo "New release.......: $new_ver" |
---|
398 | buildBase="${stableProj}-$new_ver" |
---|
399 | echo "Build directory...: $buildBase" |
---|
400 | if test $isData = yes ; then |
---|
401 | releaseURL=`echo $baseURL | sed -e s/_BB_/releases/ -e s/_RR_/$new_ver/` |
---|
402 | else |
---|
403 | releaseURL="$baseURL/releases/$new_ver" |
---|
404 | fi |
---|
405 | echo "Release URL.......: $releaseURL" |
---|
406 | |
---|
407 | # Check out the stable branch that'll be the base of the new release. No |
---|
408 | # externals at this point. Creating a release of a ThirdParty or Data project |
---|
409 | # requires a bit of work, as we need to assemble a temporary package with a |
---|
410 | # BuildTools external. |
---|
411 | |
---|
412 | echo '' |
---|
413 | echo "===> Checking out stable release $stableBranch without externals..." |
---|
414 | echo '' |
---|
415 | |
---|
416 | if test $isThirdParty = yes; then |
---|
417 | coDir=$buildBase/a/b |
---|
418 | elif test $isData = yes; then |
---|
419 | coDir=$buildBase/a/b |
---|
420 | else |
---|
421 | coDir=$buildBase |
---|
422 | fi |
---|
423 | echo "Checkout directory: $coDir" |
---|
424 | |
---|
425 | rm -rf $buildBase |
---|
426 | cmd="svn co --ignore-externals $stableURL $coDir" |
---|
427 | echo $cmd |
---|
428 | eval $cmd |
---|
429 | |
---|
430 | if test $isThirdParty = yes || test $isData = yes; then |
---|
431 | echo '' |
---|
432 | echo '===> Checking out BuildTools for ThirdParty project...' |
---|
433 | echo '' |
---|
434 | cmd="svn co $buildToolsURL $buildBase/BuildTools" |
---|
435 | echo $cmd |
---|
436 | eval $cmd |
---|
437 | fi |
---|
438 | |
---|
439 | coDir=`cd $coDir; pwd` |
---|
440 | buildBase=`cd $buildBase; pwd` |
---|
441 | |
---|
442 | cd $coDir |
---|
443 | |
---|
444 | # Find configure.ac files for the package and project and update the version. |
---|
445 | # We have no externals at this point, so there will be two files for a |
---|
446 | # standard project, one for a ThirdParty project, and none for a Data project. |
---|
447 | |
---|
448 | echo '' |
---|
449 | conf_ac_files=`find . -name 'configure.ac' | grep -v -E 'ThirdParty/.*/.*/configure.ac'` |
---|
450 | echo "===> Creating backup (.bak) for configure.ac files..." |
---|
451 | for i in $conf_ac_files; do |
---|
452 | cp $i $i.bak |
---|
453 | done |
---|
454 | |
---|
455 | echo '' |
---|
456 | echo "===> Updating version number ($new_ver) in configure.ac files" |
---|
457 | for i in $conf_ac_files; do |
---|
458 | sed -e "s|AC_INIT\(.*\)\[[0-9A-Za-z\.]*\],\(.*\)|AC_INIT\1[$new_ver],\2|" $i > bla |
---|
459 | mv bla $i |
---|
460 | svn di $i |
---|
461 | done |
---|
462 | |
---|
463 | # Now fix up the Externals file, if it exists. References to stable branches |
---|
464 | # will be converted to references to releases unless the reference is to a |
---|
465 | # project in the stableExternals list. Each line in an Externals file has the |
---|
466 | # format <ext_name> <ext_url>. The reference must be to a stable branch. |
---|
467 | |
---|
468 | if test -r Externals; then |
---|
469 | |
---|
470 | echo '' |
---|
471 | echo '===> Creating new Externals file with pointers to releases...' |
---|
472 | echo '' |
---|
473 | |
---|
474 | rm -f Externals.releases |
---|
475 | ext_name= |
---|
476 | ext_url= |
---|
477 | for i in `cat Externals`; do |
---|
478 | if test "$ext_name" = ""; then |
---|
479 | ext_name="$i" |
---|
480 | else |
---|
481 | ext_url=$i |
---|
482 | if (echo $ext_name | grep -E '^#' >/dev/null); then |
---|
483 | echo "Skip $ext_name $ext_url." |
---|
484 | ext_name= |
---|
485 | continue |
---|
486 | fi |
---|
487 | if (echo $ext_url | grep -E 'stable/|releases/' >/dev/null); then |
---|
488 | :; |
---|
489 | else |
---|
490 | echo '' |
---|
491 | echo "The external URL $ext_url is not a stable branch or release. Exiting." |
---|
492 | echo '' |
---|
493 | exit -2 |
---|
494 | fi |
---|
495 | |
---|
496 | ext_base_front=`echo $ext_url | sed -e 's|/stable/.*||'` |
---|
497 | ext_proj=`echo $ext_base_front | sed -e 's|.*/\([^/]*\)|\1|'` |
---|
498 | |
---|
499 | if expr "$stableExternals" : '.*'"$ext_proj"'.*' 2>&1 >/dev/null ; then |
---|
500 | echo "Using stable reference for $ext_name." |
---|
501 | ext_rel_url=$ext_url |
---|
502 | elif expr "$ext_url" : '.*releases/.*' 2>&1 >/dev/null ; then |
---|
503 | echo "Using specified release for $ext_name." |
---|
504 | ext_rel_url=$ext_url |
---|
505 | else |
---|
506 | ext_stable=`echo $ext_url | sed -e 's|\(.*/stable/[0-9\.]*\).*|\1|'` |
---|
507 | ext_base_end=`echo $ext_url | sed -e 's|.*/stable/[0-9\.]*||'` |
---|
508 | |
---|
509 | echo "Determining release replacement for $ext_name:" |
---|
510 | ext_latest=`determine_release $ext_stable 0` |
---|
511 | |
---|
512 | if test "$ext_base_end" = ""; then |
---|
513 | ext_rel_url=$ext_base_front/releases/$ext_latest |
---|
514 | else |
---|
515 | ext_rel_url=$ext_base_front/releases/$ext_latest$ext_base_end |
---|
516 | fi |
---|
517 | fi |
---|
518 | |
---|
519 | echo " $ext_rel_url" |
---|
520 | echo "$ext_name $ext_rel_url" >>Externals.releases |
---|
521 | ext_name= |
---|
522 | fi |
---|
523 | done |
---|
524 | |
---|
525 | echo '' |
---|
526 | echo '===> Creating backup (.bak) for Externals' |
---|
527 | mv Externals Externals.bak |
---|
528 | mv Externals.releases Externals |
---|
529 | |
---|
530 | echo '' |
---|
531 | echo '===> Updating svn:externals properties, and checking out externals...' |
---|
532 | echo '' |
---|
533 | |
---|
534 | svn pset svn:externals -F Externals . |
---|
535 | |
---|
536 | svn update |
---|
537 | |
---|
538 | echo '' |
---|
539 | echo '===> If there are ThirdParty externals, run the download scripts...' |
---|
540 | echo '' |
---|
541 | |
---|
542 | ext_name= |
---|
543 | ext_url= |
---|
544 | for i in `cat Externals`; do |
---|
545 | if test "$ext_name" = ""; then |
---|
546 | ext_name="$i" |
---|
547 | else |
---|
548 | ext_url=$i |
---|
549 | |
---|
550 | case $ext_name in |
---|
551 | ThirdParty/*) |
---|
552 | pkg=`echo $ext_name | sed -e 's|ThirdParty/||' -e 's|/||g'` |
---|
553 | getfile=get.$pkg |
---|
554 | if test -r $ext_name/$getfile; then |
---|
555 | curdir=`pwd` |
---|
556 | cd $ext_name |
---|
557 | echo "Running $getfile -patch in `pwd`" |
---|
558 | eval ./$getfile -patch |
---|
559 | cd "$curdir" |
---|
560 | fi |
---|
561 | ;; |
---|
562 | esac |
---|
563 | ext_name= |
---|
564 | fi |
---|
565 | done |
---|
566 | fi # if test -r Externals |
---|
567 | |
---|
568 | if test $isThirdParty = yes; then |
---|
569 | pkg=`echo $baseURL | sed -e 's|.*/||g'` |
---|
570 | if test -r get.$pkg; then |
---|
571 | echo '' |
---|
572 | echo '===> Download third party code...' |
---|
573 | echo '' |
---|
574 | ./get.$pkg |
---|
575 | fi |
---|
576 | fi |
---|
577 | |
---|
578 | echo '' |
---|
579 | echo '===> Running the autotools...' |
---|
580 | echo '' |
---|
581 | |
---|
582 | if test $isThirdParty = yes; then |
---|
583 | curdir=`pwd` |
---|
584 | cd ../.. |
---|
585 | BuildTools/run_autotools |
---|
586 | cd "$curdir" |
---|
587 | elif test $isData = yes; then |
---|
588 | curdir=`pwd` |
---|
589 | cd ../.. |
---|
590 | BuildTools/run_autotools |
---|
591 | cd "$curdir" |
---|
592 | else |
---|
593 | BuildTools/run_autotools |
---|
594 | fi |
---|
595 | |
---|
596 | if test -r Externals; then |
---|
597 | |
---|
598 | echo '===> Verifying consistency of the BuildTools versions...' |
---|
599 | echo '' |
---|
600 | |
---|
601 | ext_name= |
---|
602 | ext_url= |
---|
603 | rm -f problems.ext |
---|
604 | for i in `cat Externals`; do |
---|
605 | if test "$ext_name" = ""; then |
---|
606 | ext_name="$i" |
---|
607 | else |
---|
608 | ext_url=$i |
---|
609 | |
---|
610 | echo " checking $ext_name" |
---|
611 | |
---|
612 | num_M=`svn status $ext_name | grep -E '^M' | wc -l` |
---|
613 | |
---|
614 | if test $num_M -ne 0; then |
---|
615 | echo $ext_name >>problems.ext |
---|
616 | echo ' ... BuildTools not consistent!' |
---|
617 | else |
---|
618 | echo ' ... Ok' |
---|
619 | fi |
---|
620 | ext_name= |
---|
621 | fi |
---|
622 | done |
---|
623 | |
---|
624 | if test -r problems.ext; then |
---|
625 | echo '' |
---|
626 | echo 'PROBLEM DURING CONSISTENCY CHECK:' |
---|
627 | echo '' |
---|
628 | echo 'Please contact the project manager(s) for the following project(s).' |
---|
629 | echo 'A new release needs to be made with your stable branch of BuildTools.' |
---|
630 | echo '' |
---|
631 | cat problems.ext |
---|
632 | echo '' |
---|
633 | rm -f problems.ext |
---|
634 | if test $ignoreBuildToolsMismatch = 0 ; then |
---|
635 | exit -2 |
---|
636 | else |
---|
637 | echo "Continuing in spite of BuildTools mismatch." |
---|
638 | fi |
---|
639 | fi |
---|
640 | rm -f problems.ext |
---|
641 | fi # if test -r Externals |
---|
642 | |
---|
643 | if test $isThirdParty != yes && test $isData != yes; then |
---|
644 | (set -e |
---|
645 | echo '' |
---|
646 | echo '===> Creating build directory and running the configuration script...' |
---|
647 | echo '' |
---|
648 | mkdir build |
---|
649 | cd build |
---|
650 | cmd="$coDir/configure -C --enable-maintainer-mode" |
---|
651 | echo $cmd |
---|
652 | eval $cmd |
---|
653 | echo '' |
---|
654 | echo '===> Compiling code...' |
---|
655 | echo '' |
---|
656 | cmd='make install' |
---|
657 | echo $cmd |
---|
658 | eval $cmd |
---|
659 | echo '' |
---|
660 | echo '===> Running the unit test...' |
---|
661 | echo '' |
---|
662 | echo '*******************************************************************************' |
---|
663 | echo '*** ***' |
---|
664 | echo '*** BEGIN OUTPUT OF MAKE TEST ***' |
---|
665 | echo '*** ***' |
---|
666 | echo '*******************************************************************************' |
---|
667 | echo '' |
---|
668 | cmd='make test' |
---|
669 | echo $cmd |
---|
670 | eval $cmd |
---|
671 | echo '' |
---|
672 | echo '*******************************************************************************' |
---|
673 | echo '*** ***' |
---|
674 | echo '*** END OUTPUT OF MAKE TEST ***' |
---|
675 | echo '*** ***' |
---|
676 | echo '*******************************************************************************' |
---|
677 | ) |
---|
678 | if test $? != 0; then |
---|
679 | echo '' |
---|
680 | echo 'Error during build or test' |
---|
681 | echo '' |
---|
682 | exit -3 |
---|
683 | fi |
---|
684 | fi |
---|
685 | |
---|
686 | echo '' |
---|
687 | echo '===> ALL TESTS PASSED' |
---|
688 | if test $isThirdParty != yes && test $isData != yes; then |
---|
689 | echo '' |
---|
690 | echo 'Please review the output above, particularly the one of make test' |
---|
691 | fi |
---|
692 | |
---|
693 | # Do we need to plug in nonexistent releases for circular dependencies tested |
---|
694 | # with the stable versions? If so, generate a new Externals.release. This is |
---|
695 | # the only reason stable references should appear in the Externals file for a |
---|
696 | # release, so we don't need to check further before removing them. |
---|
697 | |
---|
698 | if test -n "$stableExternals" ; then |
---|
699 | echo "Grooming Externals to remove stable references used for testing." |
---|
700 | rm -rf Externals.releases |
---|
701 | ext_name= |
---|
702 | ext_url= |
---|
703 | for i in `cat Externals`; do |
---|
704 | if test "$ext_name" = ""; then |
---|
705 | ext_name="$i" |
---|
706 | else |
---|
707 | ext_url=$i |
---|
708 | if (echo $ext_url | grep -E 'stable/' >/dev/null); then |
---|
709 | echo "Determining release replacement for $ext_name:" |
---|
710 | ext_stable=`echo $ext_url | sed -e 's|\(.*/stable/[0-9\.]*\).*|\1|'` |
---|
711 | ext_latest=`determine_release $ext_stable 1` |
---|
712 | ext_rel_url=`echo $ext_url | sed -e "s|stable/[0-9.]*|releases/$ext_latest|"` |
---|
713 | echo " $ext_rel_url" |
---|
714 | else |
---|
715 | ext_rel_url=$ext_url |
---|
716 | fi |
---|
717 | echo "$ext_name $ext_rel_url" >>Externals.releases |
---|
718 | ext_name= |
---|
719 | fi |
---|
720 | done |
---|
721 | mv Externals.releases Externals |
---|
722 | svn propset -F Externals svn:externals . |
---|
723 | fi |
---|
724 | |
---|
725 | |
---|
726 | if test -r Externals; then |
---|
727 | echo '' |
---|
728 | echo 'Also, please confirm the Externals are correct:' |
---|
729 | svn propget svn:externals |
---|
730 | fi |
---|
731 | |
---|
732 | echo '' |
---|
733 | echo 'After reviewing the output above, you can create a new release by going into' |
---|
734 | echo 'the directory' |
---|
735 | echo '' |
---|
736 | echo " $coDir" |
---|
737 | echo '' |
---|
738 | echo "and run the commit_new_release script" |
---|
739 | |
---|
740 | cat >.new_release_data <<EOF |
---|
741 | isData=$isData |
---|
742 | coDir=$coDir |
---|
743 | buildBase=$buildBase |
---|
744 | releaseURL=$releaseURL |
---|
745 | stableURL=$stableURL |
---|
746 | new_ver=$new_ver |
---|
747 | stableBranch=$stableBranch |
---|
748 | EOF |
---|