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