Ignore:
Timestamp:
Oct 30, 2010 6:24:42 PM (11 years ago)
Author:
tkr
Message:

Syncing stable/0.6 with trunk

Location:
stable/0.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable/0.6

  • stable/0.6/prepare_new_release

    r1367 r1695  
    66# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
    77#
    8 ## $Id$
     8# $Id$
    99#
    1010# Author: Andreas Waechter     IBM      2007-06-21
     
    1414# Modified: Ted Ralphs         Lehigh University 2009-07-10
    1515#       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.
    1619
    1720#set -x -v
    1821set -e
    1922
    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 }
     23# You can think of this script as having two sections: parameter parsing and
     24# validation, followed by generation of the release candidate. See the help
     25# message for a good description of the actions taken to generate the release
     26# candidate.
     27
     28# Know thy self. If there are no '/' chars in the command name, we're running
     29# in the currrent directory. Otherwise, strip the command name, leaving the
     30# prefix.  Coin-functions is expected to live in the same directory.
     31
     32if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then
     33  cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'`
     34else
     35  cmdDir='.'
     36fi
     37cmdDir=`cd $cmdDir ; pwd`
     38if test -r $cmdDir/coin-functions ; then
     39  . $cmdDir/coin-functions
     40else
     41  echo "Cannot find utility functions file coin-functions; exiting."
     42fi
     43
     44# Note that plain sh does not accept negative exit values
     45
     46exitValue=0
    20947
    21048# Specify the COIN URL base for convenience.
     
    21553
    21654printHelp=0
    217 exitValue=0
    21855ignoreBuildToolsMismatch=0
     56suppressCheckout=0
    21957
    22058# stableURL will be the stable branch that is the parent for the release we
    22159# 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.
     60# builds, and BuildTools itself; they require special handling. If a project
     61# is not BuildTools, ThirdParty, or Data, it's `normal'.
    22662
    22763stableURL=
    22864isThirdParty=no
    22965isData=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 Dependencies
    235 # file to specify a (nonexistent) release of the external at the last moment.
     66isBuildTools=no
     67isNormal=yes
     68
     69# cmdBTURL is required when stableURL specifies a ThirdParty or Data
     70# project --- we'll need to assemble a temporary package while creating the
     71# release candidate.
     72
     73cmdBTURL=
     74
     75# stableExternals specifies externals for which we are doing simultaneous
     76# releases. We will use the stable branch of the external while preparing and
     77# testing this release candidate, changing the Dependencies file to specify a
     78# (nonexistent) release of the external at the last moment.
    23679
    23780stableExternals=
     81
     82# exciseExternals specifies externals that should be removed when creating the
     83# new release.
     84
     85exciseExternals=
    23886
    23987# We need at least one parameter.
     
    25098      -h* | --h*) printHelp=1 ;;
    25199      -i* | --i*) ignoreBuildToolsMismatch=1 ;;
     100      -p* | --p*) suppressCheckout=1 ;;
    252101      -s* | --s*)
    253102           if expr "$1" : '.*-s.*=.*' 2>&1 >/dev/null ; then
     
    258107           fi
    259108           ;;
     109      -x* | --x*)
     110           if expr "$1" : '.*-x.*=.*' 2>&1 >/dev/null ; then
     111             exciseExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
     112           else
     113             shift
     114             exciseExternals=$1
     115           fi
     116           ;;
    260117       -b* | --b*)
    261118           if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then
    262              buildToolsURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
     119             cmdBTURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
    263120           else
    264121             shift
    265              buildToolsURL=$1
     122             cmdBTURL=$1
    266123           fi
    267            if expr "$buildToolsURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then
    268              case $buildToolsURL in
     124           if expr "$cmdBTURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then
     125             case $cmdBTURL in
    269126               http*) ;;
    270                    *) buildToolsURL=${coinURL}/$buildToolsURL
     127                   *) cmdBTURL=${coinURL}/$cmdBTURL
    271128                      ;;
    272129             esac
    273130           else
    274131             echo ''
    275              echo "URL $buildToolsURL does not point to BuildTools."
     132             echo "URL $cmdBTURL does not point to BuildTools."
    276133             echo ''
    277134             printHelp=1
    278              exitValue=-3
     135             exitValue=3
    279136            fi
    280137           ;;
     
    282139       -*) echo "$0: unrecognised command line switch '"$1"'."
    283140           printHelp=1
    284            exitValue=-1
     141           exitValue=1
    285142           ;;
    286143        *) stableURL=$1
     
    288145             case $stableURL in
    289146               http*) ;;
    290                    *) stableURL=${coinURL}/$stableURL
    291                       ;;
     147               BuildTools/ThirdParty/* )
     148                 stableURL=${coinURL}/$stableURL
     149                 ;;
     150               ThirdParty/* )
     151                 stableURL=${coinURL}/BuildTools/$stableURL
     152                 ;;
     153               CoinAll/* )
     154                 stableURL=${coinURL}/CoinBinary/$stableURL
     155                 ;;
     156               *) stableURL=${coinURL}/$stableURL
     157                 ;;
    292158             esac
    293159           else
     
    296162             echo ''
    297163             printHelp=1
    298              exitValue=-2
     164             exitValue=2
    299165           fi
    300166           ;;
     
    312178      echo "Stable URL $stableURL does not seem to exist."
    313179      printHelp=1
    314       exitValue=-5
     180      exitValue=5
    315181    fi
    316182  fi
     
    319185      *ThirdParty/* )
    320186        isThirdParty=yes
     187        isNormal=no
    321188        ;;
    322189      *Data/* )
    323190        isData=yes
     191        isNormal=no
     192        ;;
     193      *BuildTools/* )
     194        isBuildTools=yes
     195        isNormal=no
    324196        ;;
    325197      *)
     
    327199    esac
    328200    if test $isThirdParty = yes || test $isData = yes ; then
    329       if test -z $buildToolsURL ; then
     201      if test -z $cmdBTURL ; then
    330202        echo "You must provide a BuildTools URL to build a ThirdParty or Data project."
    331203        printHelp=1
    332         exitValue=-4
     204        exitValue=4
    333205      else
    334         if svn list $buildToolsURL 2>&1 >/dev/null ; then
     206        if svn list $cmdBTURL 2>&1 >/dev/null ; then
    335207          :
    336208        else
    337           echo "BuildTools URL $buildToolsURL does not seem to exist."
     209          echo "BuildTools URL $cmdBTURL does not seem to exist."
    338210          printHelp=1
    339           exitValue=-6
     211          exitValue=6
    340212        fi
    341213      fi
    342214    fi
    343215  fi
    344 fi
     216fi  # if "$#" .eq 0
    345217
    346218if test $printHelp = 1 ; then
    347219  cat <<EOF
    348 Usage: prepare_new_release <stableBranch> [options]
     220Usage: prepare_new_release <stableVer> [options]
    349221
    350222COIN standard practice is to generate periodic releases by taking a snapshot
     
    352224a new release based on the specified stable branch.
    353225
    354 Stable_branch specifies the stable branch of your project to be used to
     226<stableVer> specifies the stable branch of your project to be used to
    355227create the new release.  You can specify the entire URL, or you just enter
    356228what comes after "https://projects.coin-or.org/svn".  A typical example is
     
    361233  -b <BuildToolsURL>    URL for BuildTools; required to generate a release
    362234                        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.
    368235  -i                    Ignore BuildTools version mismatches in externals.
     236  -p                    Suppress checkout (useful for testing)
     237  -s <projectlist>      Suppress conversion from stable to release for the
     238                        listed externals (comma-separated list of project
     239                        names, e.g., -s Osi,Cbc).
     240  -x <projectlist>      Remove the listed projects from the list of externals
     241                        (comma-separated list of project names).
    369242
    370243This script will do the following:
     
    374247    release)
    375248  - Check out a clean copy of the specified stable branch, without externals
    376   - Make sure that the svn:externals property points to releases
     249  - Make sure that the svn:externals property points to releases, with the
     250    exception of projects in the list specified with -s.
    377251  - Create a new package configure.ac file with the release version number
    378252    specified in the AC_INIT macro.
     
    381255    the most recent release of BuildTools.
    382256  - Run the configure script, compile the code, and run the unit test.
    383   - Replace any stable branches in externals (specified with -s) with the
     257  - Replace stable externals for projects specified with -s with the
    384258    appropriate (yet to be committed) release.
    385259
     
    406280
    407281stableURL=`echo $stableURL | sed -e 's|/$||'`
    408 if test $isData = yes ; then
    409   stableProj=`echo $stableURL | sed -n -e 's|.*/[^/]*/stable/[0-9.]*/\(.*\)|\1|p'`
    410   baseURL=`echo $stableURL | sed -e 's|\(.*\)/stable/[0-9.]*/\(.*\)|\1/_BB_/_RR_/\2|'`
    411   stableBranch=`echo $stableURL | sed -e 's|.*/stable/\([0-9.]*\)/.*|\1|'`
     282stableProj=`extractProjFromURL $stableURL`
     283majVer=`extractMajorFromURL $stableURL`
     284minVer=`extractMinorFromURL $stableURL`
     285stableVer=$majVer.$minVer
     286echo "Stable URL..........: $stableURL"
     287echo "Stable project......: $stableProj"
     288echo "Stable branch.......: $stableVer"
     289if test -n "$stableExternals" ; then
     290  echo "Stable externals....: $stableExternals."
     291fi
     292
     293# Find out the most recent release (if any) for the stable branch, then
     294# construct the revision number of the new release. If there are existing
     295# releases, it's a matter of bumping the revision number and inserting the
     296# new revision in the URL. Otherwise, we know the new revision is 0 and we
     297# can simply tweak the stable URL.
     298
     299releaseURL=`bestRelease $stableURL $majVer $minVer | sed -e 's|/$||'`
     300if test -n "$releaseURL" ; then
     301  curRel=`extractReleaseFromURL $releaseURL`
     302  existingURL=$releaseURL
     303  newRel=`expr $curRel + 1`
    412304else
    413   stableProj=`echo $stableURL | sed -n -e 's|.*/\([^/]*\)/stable/.*|\1|p'`
    414   baseURL=`echo $stableURL | sed -e 's|/stable/[0-9.]*||'`
    415   stableBranch=`echo $stableURL | sed -e 's|.*/stable/||'`
    416 fi
    417 echo "StableProj: $stableProj"
    418 echo "Base URL..........: $baseURL"
    419 echo "Stable URL........: $stableURL"
    420 echo "Stable branch.....: $stableBranch"
    421 if test -n "$stableExternals" ; then
    422   echo "Stable externals..: $stableExternals."
    423 fi
    424 
    425 # Find out the most recent release (if any) for the stable branch. List the
    426 # existing releases and screen for releases matching stableBranch. The new
    427 # release should be one greater than any existing release, or 0 if the stable
    428 # branch has no releases.
    429 
    430 echo ''
    431 echo "===> Checking releases for stable branch $stableBranch ..."
    432 
    433 echo $stableURL
    434 new_current=`determine_current "$stableURL" 1`
    435 new_revision=`determine_revision "$stableURL" 1`
    436 new_age=`determine_age "$stableURL" 1`
    437 new_ver="$stableBranch.$new_revision"
    438 
    439 echo ''
    440 echo "New current.......: $new_current"
    441 echo "New revision......: $new_revision"
    442 echo "New age...........: $new_age"
    443 echo "New release.......: $new_ver"
    444 buildBase="${stableProj}-$new_ver"
    445 echo "Build directory...: $buildBase"
    446 if test $isData = yes ; then
    447   releaseURL=`echo $baseURL | sed -e s/_BB_/releases/ -e s/_RR_/$new_ver/`
     305  curRel=-1
     306  releaseURL=`echo $stableURL | sed -e s/stable/releases/`
     307  existingURL="none"
     308  newRel=0
     309fi
     310newVer=$majVer.$minVer.$newRel
     311releaseURL=`replaceVersionInURL $releaseURL $majVer $minVer $newRel`
     312
     313echo "Top release URL.....: $existingURL"
     314echo "New release URL.....: $releaseURL"
     315
     316# Relevant only if we're building ThirdParty or Data
     317
     318if test $isThirdParty = yes || test $isData = yes ; then
     319  echo "BuildTools URL......: $cmdBTURL"
     320fi
     321
     322# We need a libtool version number only for normal projects
     323
     324if test $isNormal = yes ; then
     325  newLTCurrent=`calcLibtoolAge $stableURL -1`
     326  newLTRevision=$newRel
     327  newLTAge=`calcLibtoolAge $stableURL $majVer`
     328  newLTVer=${newLTCurrent}:${newLTRevision}:${newLTAge}
     329  echo "Libtool version.....: $newLTVer"
     330fi
     331
     332# Now decide where to build and check out code. If the stable project name
     333# contains a '/', strip it out to make the build and checkout directories.
     334
     335topBuildDir=`echo $stableProj | sed -e 's|.*/\([^/]*\)$|\1|'`
     336topBuildDir="${topBuildDir}-${newVer}"
     337if test $isThirdParty = yes; then
     338  coDir=$topBuildDir/Thirdparty/$stableProj
     339elif test $isData = yes; then
     340  coDir=$topBuildDir/Data/$stableProj
    448341else
    449   releaseURL="$baseURL/releases/$new_ver"
    450 fi
    451 echo "Release URL.......: $releaseURL"
     342  coDir=$topBuildDir
     343fi
     344echo "Build directory.....: $topBuildDir"
     345echo "Checkout directory..: $coDir"
    452346
    453347# Check out the stable branch that'll be the base of the new release. No
     
    457351
    458352echo ''
    459 echo "===> Checking out stable release $stableBranch without externals..."
     353echo "===> Checking out stable release $stableVer without externals..."
    460354echo ''
    461355
    462 if test $isThirdParty = yes; then
    463   coDir=$buildBase/a/b
    464 elif test $isData = yes; then
    465   coDir=$buildBase/a/b
     356rm -rf $topBuildDir
     357cmd="svn co --ignore-externals $stableURL $coDir"
     358if test $suppressCheckout = 1 ; then
     359  echo "Pretending to do: $cmd"
    466360else
    467   coDir=$buildBase
    468 fi
    469 echo "Checkout directory: $coDir"
    470 
    471 rm -rf $buildBase
    472 cmd="svn co --ignore-externals $stableURL $coDir"
    473 echo $cmd
    474 eval $cmd
    475 
    476 if test $isThirdParty = yes || test $isData = yes; then
    477   echo ''
    478   echo '===> Checking out BuildTools for ThirdParty project...'
    479   echo ''
    480   cmd="svn co $buildToolsURL $buildBase/BuildTools"
     361  rm -rf $topBuildDir
    481362  echo $cmd
    482363  eval $cmd
    483364fi
    484365
     366if test $isThirdParty = yes || test $isData = yes; then
     367  echo ''
     368  echo '===> Checking out BuildTools (Data or ThirdParty) ...'
     369  echo ''
     370  cmd="svn co $cmdBTURL $topBuildDir/BuildTools"
     371  if test $suppressCheckout = 1 ; then
     372    echo "Pretending to do: $cmd"
     373  else
     374    echo $cmd
     375    eval $cmd
     376  fi
     377fi
     378
     379startDir=`pwd`
    485380coDir=`cd $coDir; pwd`
    486 buildBase=`cd $buildBase; pwd`
     381topBuildDir=`cd $topBuildDir; pwd`
    487382
    488383cd $coDir
    489384
    490385# Find configure.ac files for the package and project and update the version.
    491 # We have no externals at this point, so there will be two files for a
    492 # standard project, one for a ThirdParty project, and none for a Data project.
     386# We have no externals or third-party code at this point, so there will be
     387# two files for a normal project, one for a ThirdParty or Data project, and
     388# none for BuildTools.
    493389
    494390echo ''
    495 conf_ac_files=`find . -name 'configure.ac' | grep -v -E 'ThirdParty/.*/.*/configure.ac'`
    496 echo "===> Creating backup (.bak) for configure.ac files..."
    497 for i in $conf_ac_files; do
    498   cp $i $i.bak
     391echo "===> Checking for configure.ac files ..."
     392bak_files=`find . -name 'configure.ac'`
     393
     394if test -n "$bak_files" ; then
     395  for i in $bak_files; do
     396    cp $i $i.bak
     397  done
     398
     399# Take the attitude that [] around parameters in AC_INIT is optional,
     400# it's the commas that count. This does make for a surpassing ugly regular
     401# expression.  A comma in the version string will cause a spectacular failure.
     402# In AC_COIN_PROJECTDIR_INIT, take the attitude that the existing parameters
     403# don't matter, we know what the release parameters should be.
     404
     405  echo ''
     406  echo "===> Updating version numbers in configure.ac files ..."
     407  for i in $bak_files; do
     408    sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVer\3,\4|" $i > bla
     409    mv bla $i
     410    sed -e "s|AC_COIN_PROJECTDIR_INIT(.*)|AC_COIN_PROJECTDIR_INIT\($stableProj,$newLTCurrent:$newLTRevision:$newLTAge\)|" $i > bla
     411    mv bla $i
     412    svn diff $i
     413  done
     414else
     415  echo "    ... none to process."
     416fi
     417
     418# Find ProjConfig.h. If there's a definition for PROJ_VERSION, adjust it and
     419# add ProjConfig.h.bak to the list of files to be restored.
     420
     421stableProjUC=`echo $stableProj | tr '[a-z]' '[A-Z]'`
     422configFileLoc=`find . -name '*Config.h' -print`
     423if test -n "$configFileLoc" ; then
     424  versionSym=${stableProjUC}_VERSION
     425  echo ''
     426  echo "===> Updating $versionSym in $configFileLoc (if present)"
     427  echo ''
     428  mv $configFileLoc $configFileLoc.bak
     429  bak_files="$bak_files $configFileLoc"
     430  sed -e "s/# *define $versionSym.*\$/#define $versionSym \"$newVer\"/" <$configFileLoc.bak >$configFileLoc
     431  svn diff $configFileLoc
     432fi
     433
     434# Look for a file specifying externals.
     435
     436srcDepFile=
     437for file in Dependencies Externals ; do
     438  if test -r $file ; then
     439    srcDepFile=$file
     440    break
     441  fi
    499442done
    500443
    501 echo ''
    502 echo "===> Updating version numbers in configure.ac files"
    503 for i in $conf_ac_files; do
    504   sed -e "s|AC_INIT\(.*\)\[[0-9A-Za-z\.]*\],\(.*\)|AC_INIT\1[$new_ver],\2|" $i > bla
    505   mv bla $i
    506   sed -e "s|AC_COIN_PROJECTDIR_INIT\(.*\)|AC_COIN_PROJECTDIR_INIT\($new_current:$new_revision:$new_age\)|" $i > bla
    507   mv bla $i
    508   svn di $i
    509 done
    510 
    511 # Now fix up the Dependencies file, if it exists. References to stable branches
    512 # will be converted to references to releases unless the reference is to a
    513 # project in the stableExternals list. Each line in a Dependencies file has the
    514 # format <ext_name> <ext_url>. The reference must be to a stable branch.
    515 
    516 if test -r Dependencies; then
    517 
    518   echo ''
    519   echo '===> Checking externals for releases and buildtools version...'
    520   echo ''
    521 
    522   buildtools_stable=`svn pget svn:externals $stableURL | grep -e "BuildTools/releases" | sed -e 's|.*/releases/\([0-9]*.[0-9]*\).[0-9]*|\1|'`
    523 
    524   echo "$stableProj uses build tools stable version $buildtools_stable"
    525   echo ''
    526 
    527   rm -f Externals.releases
     444# Now generate a proper Dependencies file for the release.  Each line
     445# in a Dependencies file has the format <ext_name> <ext_url>.  Normally,
     446# each <ext_url> should be a stable branch.  References to stable branches
     447# will be converted to references to releases unless the reference is to
     448# a project in the stableExternals list (in which case it'll be converted
     449# at the very end). References to releases are not changed. References to
     450# trunk are an error. Failure to find a release for an external not in the
     451# stableExternals list is an error. Save the existing externals and srcDepFile,
     452# as we'll probably change both.
     453
     454if test -n "$srcDepFile" ; then
     455
     456  svn propget svn:externals . > .Externals.original
     457  bak_files="$bak_files $srcDepFile"
     458  cp $srcDepFile $srcDepFile.bak
     459
     460  echo ''
     461  echo "===> Checking externals in $srcDepFile ..."
     462  echo ''
     463
     464# Because we're working directly from command output, the regular expression
     465# must check for lines.
     466
     467  ourBTURL=`svn propget svn:externals . | \
     468            sed -n -e 's/^BuildTools *https:\([^ ]*\)$/https:\1/p'`
     469  if test -z "$ourBTURL" ; then
     470    ourBTURL=none
     471  fi
     472  echo "Our BuildTools...:    $ourBTURL"
     473
     474  rm -f Dependencies
    528475  ext_name=
    529476  ext_url=
    530   for i in `cat Dependencies`; do
     477  buildtoolsMismatch=0
     478  for i in `cat $srcDepFile.bak`; do
    531479    if test "$ext_name" = ""; then
    532480      ext_name="$i"
    533481    else
    534       echo "Now checking $ext_name..."
    535       echo ''
    536482      ext_url=$i
    537       if (echo $ext_name | grep -E '^#' >/dev/null); then
    538         echo "===> Skip $ext_name $ext_url."
     483      if expr "$ext_name" : '#.*' 2>&1 >/dev/null ; then
     484        echo "    $ext_name $ext_url ==> skipped"
    539485        ext_name=
    540486        continue
    541       fi                                   
    542       if (echo $ext_url | grep -E 'stable/|releases/' >/dev/null); then
    543         :;
    544       else
     487      fi
     488      ext_urltype=`extractTypeFromURL $ext_url`
     489      ext_proj=`extractProjFromURL $ext_url`
     490
     491# See if this external should be dropped.
     492
     493      if expr "$exciseExternals" : '.*'$ext_proj'.*' 2>&1 > /dev/null ; then
     494        echo "    $ext_name $ext_url ==> excised"
     495        ext_name=
     496        continue
     497      fi
     498
     499# External must be a stable or a release.
     500
     501      if test $ext_urltype != stable && test $ext_urltype != release ; then
    545502        echo ''
    546503        echo "===> The external URL $ext_url is not a stable branch or release. Exiting."
    547504        echo ''
    548         exit -2
     505        exit 2
    549506      fi
    550507
    551 #      buildtools_version=`svn pget svn:externals $ext_url | grep -e "BuildTools/releases" | sed -e 's|.*/releases/\([0-9]*.[0-9]*\).[0-9]*|\1|'`
    552       ext_stable=`echo $ext_url | sed -e 's|\(.*/stable/[0-9]*.[0-9]*/\).*|\1|'`
    553       buildtools_version=`svn pget svn:externals $ext_stable | grep -e "BuildTools/stable" | sed -e 's|.*/stable/\([0-9]*.[0-9]*\)|\1|'`
    554 
    555       if test "$buildtools_stable" = "$buildtools_version"; then
    556         echo '===> Build tools consistency check OK'
    557       elif test "$buildtools_version" = ""; then
    558         echo "===> Skipping build tools version check for $ext_name"
     508      ext_isNormal=`isNormalURL $ext_url`
     509
     510# Convert stable branches to releases unless listed in stableExternals.
     511# Existing releases are unchanged.
     512
     513      if test $ext_urltype = stable ; then
     514        if expr "$stableExternals" : '.*'"$ext_proj"'.*' 2>&1 >/dev/null ; then
     515          echo "    $ext_name $ext_url unchanged"
     516          ext_rel_url=$ext_url
     517        else
     518          ext_majVer=`extractMajorFromURL $ext_url`
     519          ext_minVer=`extractMinorFromURL $ext_url`
     520          ext_rel_url=`bestRelease $ext_url $ext_majVer $ext_minVer`
     521          if test -z "$ext_rel_url" ; then
     522            echo ''
     523            echo "===> No release for $ext_url. Exiting."
     524            echo ''
     525            exit 2
     526          fi
     527          # Normal (not BuildTools/ThirdParty/Data) need a directory name,
     528          # and it may differ from the project name. Carefully preserve it.
     529          if test $ext_isNormal = yes ; then
     530            ext_tail=`extractTailFromExt $ext_url`
     531            ext_rel_url=${ext_rel_url}${ext_tail}
     532          fi
     533          echo "    $ext_name $ext_url ==> $ext_rel_url"
     534        fi
    559535      else
    560         echo $ext_name >>problems.ext
     536        ext_rel_url=$ext_url
     537        echo "    $ext_name $ext_url ==> unchanged"
    561538      fi
    562539
    563       if test -r problems.ext; then
    564         echo ''
    565         echo 'PROBLEM DURING CONSISTENCY CHECK:'
    566         echo ''
    567         echo ''
    568         echo "External $ext_name uses stable version $buildtools_version of the build tools"
    569         echo "$stableProj uses stable version $buildtools_stable of the build tools"
    570         echo ''
    571         cat problems.ext
    572         echo ''
    573         rm -f problems.ext
    574         if test $ignoreBuildToolsMismatch = 0 ; then
    575            exit -2
    576         else
    577           echo "Continuing in spite of BuildTools mismatch."
    578         fi
    579       fi
    580 
    581       ext_base_front=`echo $ext_url | sed -e 's|/stable/.*||'`
    582       ext_proj=`echo $ext_base_front | sed -e 's|.*/\([^/]*\)|\1|'`
    583 
    584       if expr "$stableExternals" : '.*'"$ext_proj"'.*' 2>&1 >/dev/null ; then
    585         echo "===> Using stable reference for $ext_name."
    586         ext_rel_url=$ext_url
    587       elif expr "$ext_url" : '.*releases/.*' 2>&1 >/dev/null ; then
    588         echo "===> Using specified release for $ext_name."
    589         ext_rel_url=$ext_url
    590       else
    591         ext_stable=`echo $ext_url | sed -e 's|\(.*/stable/[0-9\.]*\).*|\1|'`
    592         ext_base_end=`echo $ext_url | sed -e 's|.*/stable/[0-9\.]*||'`
    593         ext_stable_branch=`echo $ext_stable | sed -e 's|.*/stable/||'`
    594 
    595         echo "===> Determining release replacement for $ext_name:"
    596         ext_latest=$ext_stable_branch.`determine_revision $ext_stable 0`
    597 
    598         if test "$ext_base_end" = ""; then
    599           ext_rel_url=$ext_base_front/releases/$ext_latest
    600         else
    601           ext_rel_url=$ext_base_front/releases/$ext_latest$ext_base_end
     540# Get the BuildTools URL for the external and compare to the BuildTools URL
     541# for the source, assuming we have one and the external has one. We only need
     542# to do this for normal URLs, and we need to strip the tail.
     543
     544      if test $ext_isNormal = yes &&
     545         test $ext_proj != BuildTools && test $ourBTURL != none ; then
     546        ext_rel_url_notail=`echo $ext_rel_url | sed -e 's,/[^/]*$,,'`
     547        extBTURL=`svn propget svn:externals $ext_rel_url_notail`
     548        extBTURL=`echo $extBTURL | \
     549          sed -n -e 's/.*BuildTools https:\([^ ]*\) .*/https:\1/p'`
     550        if test -n "$extBTURL" ; then
     551          testResult=`compareURLVersions "$ourBTURL" "$extBTURL"`
     552          if test $testResult = no ; then
     553            echo "    WARNING: BuildTools mismatch: $ext_rel_url_notail uses $extBTURL"
     554            if test $ignoreBuildToolsMismatch = 0 ; then
     555               buildtoolsMismatch=1
     556            fi
     557          fi
    602558        fi
    603559      fi
    604560
    605       echo "     $ext_rel_url"
    606       echo "$ext_name  $ext_rel_url" >>Externals.releases
     561      echo "$ext_name  $ext_rel_url" >>Dependencies
    607562      ext_name=
    608563      echo ''
     
    610565  done
    611566
    612   echo ''
    613   echo '===> Updating svn:externals properties, and checking out externals...'
    614   echo ''
    615 
    616   svn pset svn:externals -F Externals.releases .
    617 
     567# If we have a BuildTools mismatch, and mismatch is not permitted, exit.
     568
     569  if test $buildtoolsMismatch -gt $ignoreBuildToolsMismatch ; then
     570    echo "Exiting due to BuildTools mismatches; use -i to ignore."
     571    exit 2
     572  fi
     573
     574  echo ''
     575  echo '===> Updating svn:externals property and checking out externals ...'
     576  echo ''
     577
     578  svn propset svn:externals -F Dependencies .
    618579  svn update
    619580
    620   echo ''
    621   echo '===> If there are ThirdParty externals, run the download scripts...'
    622   echo ''
    623 
    624   ext_name=
    625   ext_url=
    626   for i in `cat Externals.releases`; do
    627     if test "$ext_name" = ""; then
    628       ext_name="$i"
    629     else
    630       ext_url=$i
    631 
    632       case $ext_name in
    633         ThirdParty/*)
    634           pkg=`echo $ext_name | sed -e 's|ThirdParty/||' -e 's|/||g'`
    635           getfile=get.$pkg
    636           if test -r $ext_name/$getfile; then
    637             curdir=`pwd`
    638             cd $ext_name
    639             echo "Running $getfile -patch in `pwd`"
    640             eval ./$getfile -patch
    641             cd "$curdir"
    642           fi
    643           ;;
    644       esac
    645       ext_name=
    646     fi
    647   done
    648 fi # if test -r Externals.releases
    649 
    650 if test $isThirdParty = yes; then
    651   pkg=`echo $baseURL | sed -e 's|.*/||g'`
    652   if test -r get.$pkg; then
     581  if test -d ThirdParty ; then
    653582    echo ''
    654     echo '===> Download third party code...'
     583    echo '===> Downloading ThirdParty code ...'
    655584    echo ''
    656     ./get.$pkg
    657   fi
    658 fi
    659 
    660 echo ''
    661 echo '===> Running the autotools...'
    662 echo ''
    663 
    664 if test $isThirdParty = yes; then
    665   curdir=`pwd`
    666   cd ../..
    667   BuildTools/run_autotools
    668   cd "$curdir"
    669 elif test $isData = yes; then
    670   curdir=`pwd`
    671   cd ../..
    672   BuildTools/run_autotools
    673   cd "$curdir"
    674 else
    675   BuildTools/run_autotools
    676 fi
    677 
    678 if test $isThirdParty != yes && test $isData != yes; then
     585
     586    ext_name=
     587    ext_url=
     588    for i in `svn propget svn:externals .` ; do
     589      if test -z "$ext_name" ; then
     590        ext_name="$i"
     591      else
     592        ext_url=$i
     593        if expr "$ext_name" : 'ThirdParty/.*' 2>&1 >/dev/null ; then
     594          cd $ext_name
     595          ext_proj=`extractProjFromURL $ext_url`
     596          getScript=get.$ext_proj
     597          if test -x "$getScript" ; then
     598            ./$getScript -patch
     599          fi
     600          cd $coDir
     601        fi
     602        ext_name=
     603      fi
     604    done
     605  fi
     606fi
     607
     608# Finally! Done processing externals. If this is a ThirdParty project, we
     609# still have to run the get script.
     610
     611if test $isThirdParty = yes ; then
     612  if test -x get.$stableProj ; then
     613    echo ''
     614    echo '===> Downloading third party code ...'
     615    echo ''
     616    ./get.$stableProj
     617  fi
     618fi
     619
     620# Don't run run_autotools for BuildTools!
     621
     622if test $isBuildTools = no ; then
     623  echo ''
     624  echo '===> Running BuildTools/run_autotools ...'
     625  echo ''
     626  if test $isThirdParty = yes || test $isData = yes ; then
     627    cd ../..
     628    ./BuildTools/run_autotools
     629    cd "$coDir"
     630  elif test $isNormal = yes ; then
     631    ./BuildTools/run_autotools
     632  fi
     633fi
     634
     635# Let's see if it works. We only run tests for normal projects. DO NOT turn
     636# on --enable-maintainer-mode in the initial configure command. At the least,
     637# it's not needed. At the worst, as of 100526, it'll undo all the careful
     638# work above to set externals.
     639
     640if test $isNormal = yes ; then
    679641  (set -e
    680642   echo ''
     
    683645   mkdir build
    684646   cd build
    685    cmd="$coDir/configure -C --enable-maintainer-mode"
     647   cmd="$coDir/configure -C"
    686648   echo $cmd
    687649   eval $cmd
     
    715677    echo 'Error during build or test'
    716678    echo ''
    717     exit -3
    718   fi
     679    exit 3
     680  fi
     681  echo ''
     682  echo '===> ALL TESTS PASSED'
    719683fi
    720684
    721685echo ''
    722 echo '===> ALL TESTS PASSED'
    723 if test $isThirdParty != yes && test $isData != yes; then
    724   echo ''
    725   echo 'Please review the output above, particularly the one of make test'
    726 fi
     686if test $isNormal = yes ; then
     687  echo 'Please review the output above, particularly the one of make test.'
     688else
     689  echo 'Please review the output above.'
     690fi
     691echo ''
    727692
    728693# Do we need to plug in nonexistent releases for circular dependencies tested
    729 # with the stable versions? If so, generate a new Externals.release. This is
    730 # the only reason stable references should appear in the Externals file for a
    731 # release, so we don't need to check further before removing them.
     694# with the stable versions? If so, generate a new Dependencies. This is the
     695# only reason stable references should appear in the externals for a release,
     696# so we don't need to check further before removing them.
    732697
    733698if test -n "$stableExternals" ; then
    734   echo "Grooming Externals to remove stable references used for testing."
    735   mv Externals.releases Externals
     699  echo "===> Grooming externals to remove stable externals used for testing ..."
     700  mv Dependencies Dependencies.temp.$$
    736701  ext_name=
    737702  ext_url=
    738   for i in `cat Externals`; do
     703  for i in `cat Dependencies.temp.$$`; do
    739704    if test "$ext_name" = ""; then
    740705      ext_name="$i"
    741706    else
    742707      ext_url=$i
    743       if (echo $ext_url | grep -E 'stable/' >/dev/null); then
    744         echo "Determining release replacement for $ext_name:"
    745         ext_stable=`echo $ext_url | sed -e 's|\(.*/stable/[0-9\.]*\).*|\1|'`
    746         ext_latest=`determine_release $ext_stable 1`
    747         ext_rel_url=`echo $ext_url | sed -e "s|stable/[0-9.]*|releases/$ext_latest|"`
    748         echo "  $ext_rel_url"
     708      ext_urltype=`extractTypeFromURL $ext_url`
     709      ext_proj=`extractProjFromURL $ext_url`
     710      if test $ext_urltype = stable ; then
     711        ext_rel_url=$ext_url
     712        ext_majVer=`extractMajorFromURL $ext_url`
     713        ext_minVer=`extractMinorFromURL $ext_url`
     714        ext_rel_url=`echo $ext_url | sed -e 's,/stable/,/releases/,'`
     715        ext_rel_url=`replaceVersionInURL $ext_rel_url $ext_majVer $ext_minVer 0`
     716        echo "    $ext_name $ext_url ==> $ext_rel_url"
    749717      else
    750718        ext_rel_url=$ext_url
    751719      fi
    752       echo "$ext_name  $ext_rel_url" >>Externals.releases
     720      echo "$ext_name  $ext_rel_url" >>Dependencies
    753721      ext_name=
    754722    fi
    755723  done
    756   svn propset -F Externals.releases svn:externals .
    757   rm -rf Externals
    758 fi
    759 
    760 
    761 if test -r Externals.releases; then
    762   echo ''
    763   echo 'Also, please confirm the Externals are correct:'
     724  rm -f Dependencies.temp.$$
     725  svn propset -F Dependencies svn:externals .
     726  echo ''
     727fi
     728
     729if test -r Dependencies ; then
     730  echo 'Also, please confirm the externals are correct:'
    764731  svn propget svn:externals
    765732fi
     
    769736echo 'the directory'
    770737echo ''
    771 echo "          $coDir"
     738echo "          $startDir"
    772739echo ''
    773740echo "and run the commit_new_release script"
    774741
    775 rm -rf Externals.releases
     742cd $topBuildDir
    776743
    777744cat >.new_release_data <<EOF
    778 isData=$isData
     745coinURL=$coinURL
     746startDir=$startDir
     747topBuildDir=$topBuildDir
    779748coDir=$coDir
    780 buildBase=$buildBase
    781749releaseURL=$releaseURL
    782750stableURL=$stableURL
    783 new_ver=$new_ver
    784 stableBranch=$stableBranch
     751newVer=$newVer
     752bak_files="$bak_files"
    785753EOF
Note: See TracChangeset for help on using the changeset viewer.