source: stable/0.5/prepare_new_release @ 1024

Last change on this file since 1024 was 1024, checked in by ladanyi, 12 years ago

changed default opt level to -O from -O3 for xlc

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 10.9 KB
Line 
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 1024 2008-06-20 14:14:32Z ladanyi $
9#
10# Author: Andreas Waechter     IBM      2007-06-21
11
12#set -x -v
13
14set -e
15echo ''
16
17if test "$#" -eq 0; then
18  cat <<EOF
19Usage: prepare_new_release stable_repos
20
21stable_repos is the URL for the stable branch of your project, for which
22you want to create a new release.  You can specify the entire URL, or you
23just enter what comes after "https://projects.coin-or.org/svn".  A typical
24example is
25
26  prepare_new_release Ipopt/stable/3.3
27
28You can use this script to prepare a new release based on the specified
29stable branch.
30
31This script will do the following:
32
33- automatically determine the next release number
34- check out a clean copy of the stable version specified
35- update the externals to point to the latest releases in the dependencies
36  (for the same stable branch as specified in the Externals script)
37- update the version number in your configure.ac files
38- receive the code for the externals
39- use the "get.*" scripts to download ThirdParty code (if there are any)
40- rerun the autotools
41- check if all dependencies are using the same version of the BuildTools
42- run the configure script and compile the code
43- run the unit test
44
45If there is any error during these tasks the script will stop and you should
46examine the output.
47
48If the script terminates successfully, you could have a look at the output,
49particularly at the output of the unit test ('make test') and the
50chosen Externals.
51
52So far, no changes will have been made to the repository.  If you want to
53commit the new release, run the "commit_new_release" script, as described
54at the end of the output.
55
56EOF
57  exit 0
58fi
59
60stable_url=$1
61if (echo $stable_url | grep -E 'stable/' >/dev/null); then :; else
62  echo ''
63  echo 'This URL is not for a stable release. Exiting.'
64  echo ''
65  exit -2
66fi
67
68case $stable_url in
69  http*) ;;
70  *)
71    stable_url=https://projects.coin-or.org/svn/$stable_url
72    ;;
73esac
74
75base_url=`echo $stable_url | sed -e 's|/stable/[0-9\.]*||'`
76echo "Base URL..........: $base_url"
77echo "Stable URL........: $stable_url"
78stable_branch=`echo $stable_url | sed -e 's|.*/stable/]*||'`
79echo "Stable branch.....: $stable_branch"
80
81# finding out which releases already exist for that stable branch
82echo ''
83echo '===> Checking for current releases for this branch...'
84tmp=`svn list $base_url/releases/`
85release_vers=
86for i in $tmp; do
87  i=`echo $i | sed -e 's|/||g'`
88  case $i in
89    $stable_branch.*) release_vers="$release_vers $i";;
90  esac;
91done
92
93# Determine latest release number
94new_rel=-10000
95for i in $release_vers; do
96  echo "     $i"
97  rel=`echo $i | sed -e "s|^$stable_branch.||"`
98  if test $rel -gt $new_rel; then
99    new_rel=$rel
100  fi
101done
102
103if test $new_rel = -10000; then
104  new_rel=0
105elif test $new_rel = 0; then
106  new_rel=1
107else
108  new_rel=`(expr $new_rel + 1)`
109fi
110new_ver="$stable_branch.$new_rel"
111
112echo ''
113echo "New release.......: $new_ver"
114
115echo ''
116echo "===> Checking out stable release $stable_branch without externals..."
117echo ''
118
119case $base_url in
120  *ThirdParty/* )
121    is_thirdparty=yes
122    is_data=no
123    ;;
124  *Data )
125    is_thirdparty=no
126    is_data=yes
127    ;;
128  *)
129    is_thirdparty=no
130    is_data=no
131    ;;
132esac
133
134if test $is_thirdparty = yes || test $is_data = yes; then
135  buildtoolsurl=$2
136  if test "$buildtoolsurl" == ""; then
137    echo ''
138    echo 'For a ThirdParty project you need to provide a URL for BuildTools'
139    echo 'as second argument.  Exiting.'
140    echo ''
141    exit -3
142  fi
143  case $buildtoolsurl in
144    http*) ;;
145    *)
146      buildtoolsurl=https://projects.coin-or.org/svn/$buildtoolsurl
147      ;;
148  esac
149fi
150
151tmpbas=tmp_checkout
152if test $is_thirdparty = yes; then
153  tmpcodir=$tmpbas/a/b
154elif test $is_data = yes; then
155  tmpcodir=$tmpbas/a
156else
157  tmpcodir=$tmpbas
158fi
159
160rm -rf $tmpbas
161cmd="svn co --ignore-externals $stable_url $tmpcodir"
162echo $cmd
163eval $cmd
164
165if test $is_thirdparty = yes || test $is_data = yes; then
166  echo ''
167  echo '===> Checking out BuildTools for ThirdParty project...'
168  echo ''
169  cmd="svn co $buildtoolsurl $tmpbas/BuildTools"
170  echo $cmd
171  eval $cmd
172fi
173
174tmpcodir=`cd $tmpcodir; pwd`
175tmpbas=`cd $tmpbas; pwd`
176
177cd $tmpcodir
178
179echo ''
180conf_ac_files=`find . -name 'configure.ac' | grep -v -E 'ThirdParty/.*/.*/configure.ac'`
181echo "===> Creating backup (.bak) for configure.ac files..."
182for i in $conf_ac_files; do
183  cp $i $i.bak
184done
185
186echo ''
187echo "===> Updating version number ($new_ver) in configure.ac files"
188for i in $conf_ac_files; do
189  sed -e "s|AC_INIT\(.*\)\[[0-9A-Za-z\.]*\],\(.*\)|AC_INIT\1[$new_ver],\2|" $i > bla
190  mv bla $i
191  svn di $i
192done
193
194if test -r Externals; then
195
196  echo ''
197  echo '===> Creating new Externals file with pointers to releases...'
198  echo ''
199
200  rm -f Externals.releases
201  ext_name=
202  ext_url=
203  for i in `cat Externals`; do
204    if test "$ext_name" = ""; then
205      ext_name="$i"
206    else
207      ext_url=$i
208      if (echo $ext_url | grep -E 'stable/' >/dev/null); then :; else
209        echo ''
210        echo "The external URL $ext_url is not for a stable branch. Exiting."
211        echo ''
212        exit -2
213      fi
214   
215      ext_base_front=`echo $ext_url | sed -e 's|/stable/.*||'`
216      ext_base_end=`echo $ext_url | sed -e 's|.*/stable/[0-9\.]*||'`
217      ext_stable_branch=`echo $ext_url | sed -e 's|.*/stable/]*||' -e s"|$ext_base_end||"`
218
219      echo "Determining release replacement for $ext_name:"
220      tmp=`svn list $ext_base_front/releases/`
221      ext_release_vers=
222      for i in $tmp; do
223        i=`echo $i | sed -e 's|/||g'`
224        case $i in
225          $ext_stable_branch.*) ext_release_vers="$ext_release_vers $i";;
226        esac;
227      done
228      # Determine latest release number
229      ext_latest=-10000
230      for i in $ext_release_vers; do
231        rel=`echo $i | sed -e "s|^$ext_stable_branch.||"`
232        if test $rel -gt $ext_latest; then
233          ext_latest=$rel
234        fi
235      done
236      if test $ext_latest = -10000; then
237        echo ''
238        echo "Error: No release for $ext_name for its stable defined in External"
239        echo ''
240        exit -5
241      fi
242
243      if test "$ext_base_end" = ""; then
244        ext_rel_url=$ext_base_front/releases/$ext_stable_branch.$ext_latest
245      else
246        ext_rel_url=$ext_base_front/releases/$ext_stable_branch.$ext_latest$ext_base_end
247      fi
248
249      echo "  $ext_rel_url"
250      echo "$ext_name  $ext_rel_url" >> Externals.releases
251      ext_name=
252    fi
253  done
254
255  echo '===> Creating backup (.bak) for Externals'
256  mv Externals Externals.bak
257  mv Externals.releases Externals
258
259  echo ''
260  echo '===> Updating svn:externals properties, and checking out externals...'
261  echo ''
262
263  svn pset svn:externals -F Externals .
264
265  svn update
266
267  echo ''
268  echo '===> If there are ThirdParty externals, run the download scripts...'
269  echo ''
270
271  ext_name=
272  ext_url=
273  for i in `cat Externals`; do
274    if test "$ext_name" = ""; then
275      ext_name="$i"
276    else
277      ext_url=$i
278
279      case $ext_name in
280        ThirdParty/*)
281          pkg=`echo $ext_name | sed -e 's|ThirdParty/||' -e 's|/||g'`
282          getfile=get.$pkg
283          if test -r $ext_name/$getfile; then
284            curdir=`pwd`
285            cd $ext_name
286            echo "Running $getfile -patch in `pwd`"
287#           mv $getfile $getfile.orig
288#           sed -e 's+ftp://+http://+g' $getfile.orig > $getfile
289#           chmod +x $getfile
290            eval ./$getfile -patch
291#           mv $getfile.orig $getfile
292            cd "$curdir"
293          fi
294          ;;
295      esac
296      ext_name=
297    fi
298  done
299fi # if test -r Externals
300
301if test $is_thirdparty = yes; then
302  pkg=`echo $base_url | sed -e 's|.*/||g'`
303  if test -r get.$pkg; then
304    echo ''
305    echo '===> Download third party code...'
306    echo ''
307    ./get.$pkg
308  fi
309fi
310
311echo ''
312echo '===> Running the autotools...'
313echo ''
314
315if test $is_thirdparty = yes; then
316  curdir=`pwd`
317  cd ../..
318  BuildTools/run_autotools
319  cd "$curdir"
320elif test $is_data = yes; then
321  curdir=`pwd`
322  cd ..
323  BuildTools/run_autotools
324  cd "$curdir"
325else
326  BuildTools/run_autotools
327fi
328
329if test -r Externals; then
330
331  echo '===> Verifying consistency of the BuildTools versions...'
332  echo ''
333
334  ext_name=
335  ext_url=
336  rm -f problems.ext
337  for i in `cat Externals`; do
338    if test "$ext_name" = ""; then
339      ext_name="$i"
340    else
341      ext_url=$i
342
343      echo "  checking $ext_name"
344
345      num_M=`svn status $ext_name | grep -E '^M' | wc -l`
346
347      if test $num_M -ne 0; then
348        echo $ext_name >>problems.ext
349        echo '    ... BuildTools not consistent!'
350      else
351        echo '    ... Ok'
352      fi
353      ext_name=
354    fi
355  done
356
357  if test -r problems.ext; then
358    echo ''
359    echo 'PROBLEM DURING CONSITENCY CHECK:'
360    echo ''
361    echo 'Please contact the project manager(s) for the following project(s).'
362    echo 'A new release needs to be made with your stable branch of BuildTools.'
363    echo ''
364    cat problems.ext
365    echo ''
366    rm -f problems.ext
367    exit -2
368  fi
369  rm -f problems.ext
370fi # if test -r Externals
371
372if test $is_thirdparty != yes && test $is_data != yes; then
373  (set -e
374   echo ''
375   echo '===> Creating build directory and running the configuration script...'
376   echo ''
377   mkdir build
378   cd build
379   cmd="$tmpcodir/configure -C --enable-maintainer-mode"
380   echo $cmd
381   eval $cmd
382   echo ''
383   echo '===> Compiling code...'
384   echo ''
385   cmd='make install'
386   echo $cmd
387   eval $cmd
388   echo ''
389   echo '===> Running the unit test...'
390   echo ''
391   echo '*******************************************************************************'
392   echo '***                                                                         ***'
393   echo '***                       BEGIN OUTPUT OF MAKE TEST                         ***'
394   echo '***                                                                         ***'
395   echo '*******************************************************************************'
396   echo ''
397   cmd='make test'
398   echo $cmd
399   eval $cmd
400   echo ''
401   echo '*******************************************************************************'
402   echo '***                                                                         ***'
403   echo '***                        END OUTPUT OF MAKE TEST                          ***'
404   echo '***                                                                         ***'
405   echo '*******************************************************************************'
406  )
407  if test $? != 0; then
408    echo ''
409    echo 'Error during build or test'
410    echo ''
411    exit -3
412  fi
413fi
414
415echo ''
416echo '===> ALL TESTS PASSED'
417if test $is_thirdparty != yes && test $is_data != yes; then
418  echo ''
419  echo 'Please review the output above, particularly the one of make test'
420fi
421if test -r Externals; then
422  echo ''
423  echo 'Also, please check the Externals:'
424  cat Externals
425fi
426
427echo ''
428echo 'After reviewing the output above, you can create a new release by going into'
429echo 'the directory'
430echo ''
431echo "          $tmpcodir"
432echo ''
433echo "and run the commit_new_release script"
434
435cat >.new_release_data <<EOF
436tmpcodir=$tmpcodir
437tmpbas=$tmpbas
438base_url=$base_url
439stable_url=$stable_url
440new_ver=$new_ver
441stable_branch=$stable_branch
442EOF
Note: See TracBrowser for help on using the repository browser.