source: trunk/prepare_new_release @ 2841

Last change on this file since 2841 was 2841, checked in by stefan, 6 years ago

restore r2838, but fix issue with */* projects; also fix updating of config_*_default.h files for such projects

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