Changeset 1593


Ignore:
Timestamp:
Jul 4, 2010 11:22:15 PM (9 years ago)
Author:
lou
Message:

Release scripts *_new_release rewritten for new script architecture. Upgrades
and bug fixes for coin-functions, *_new_stable, set_externals. Correctly handle
multilevel project names (e.g., CHiPPS/Alps), CppAD version numbering.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin-functions

    r1563 r1593  
    99# $Id$
    1010
    11 # Functions to disassemble svn URLs and extract relevant bits. Complicated
    12 # because we have to account for trunk/stable/release and for the variant
    13 # syntax of Data and ThirdParty URLs. For your normal project, it's
     11# Functions to disassemble svn URLs and extract relevant bits, and utilities
     12# to find the best (most recent) stable and release URLs, calculate libtool
     13# version numbers, and compare URLs for compatibility based on major and minor
     14# version. Complicated because we have to account for trunk/stable/release and
     15# for the variant syntax of Data and ThirdParty URLs. For your normal project,
     16# it's
    1417#   https://projects.coin-or.org/svn/ProjName/trunk
    1518#   https://projects.coin-or.org/svn/ProjName/stable/M.m
    1619#   https://projects.coin-or.org/svn/ProjName/releases/M.m.r
     20# with the proviso that sometimes it's
     21#   https://projects.coin-or.org/svn/ProjName/SubProj/trunk
     22# etc.
    1723# For ThirdParty, it's just like a normal project, except the prefix string
    1824# is longer:
     
    4753}
    4854
    49 
    50 # Extract the project from a svn URL
     55# Determine if this is a `normal' URL, defined as not Data, ThirdParty, or
     56# BuildTools itself. ThirdParty lives in BuildTools as of 100628, so the
     57# condition is redundant. Returns yes or no.
     58# usage: isNormal=`isNormalURL $svnURL`
     59
     60isNormalURL ()
     61{ case $1 in
     62    */BuildTools/* | */ThirdParty/* | */Data/* )
     63       echo "no"
     64       ;;
     65    *) echo "yes"
     66       ;;
     67  esac
     68}
     69
     70# Extract the project from a svn URL. The trick, for `normal' projects, is to
     71# handle CHiPPS, which has CHiPPS/Alps, Bcps, Blis. We can't assume the
     72# project name does not contain '/'. The heuristic is to look for everything
     73# between svn and one of trunk, stable, releases, or end of line.
    5174# usage: projName=`extractProjFromURL $svnURL`
    5275
    5376extractProjFromURL ()
    5477{
     78  epfu_URL="$1"
    5579  epfu_projPat='\([^/][^/]*\)'
    5680  epfu_sfxPat='.*$'
    57   case "$1" in
     81  case "$epfu_URL" in
    5882    */Data/trunk/* )
    5983        epfu_pfxPat=svn/Data/trunk/
     
    6589        epfu_pfxPat=svn/BuildTools/ThirdParty/
    6690        ;;
    67     *)
    68         epfu_pfxPat=svn/
    69         ;;
    70   esac
    71   epfu_projName=`echo $1 | sed -n -e 's|.*/'$epfu_pfxPat$epfu_projPat$epfu_sfxPat'|\1|p'`
     91    *)  epfu_type=`extractTypeFromURL $epfu_URL`
     92        epfu_pfxPat='svn/'
     93        epfu_projPat='\(.*\)'
     94        case $epfu_type in
     95          trunk | stable | releases )
     96              epfu_sfxPat=$epfu_type'.*$'
     97              ;;
     98          * )
     99              epfu_sfxPat='$'
     100              ;;
     101        esac
     102        ;;
     103  esac
     104  epfu_projName=`echo $epfu_URL | sed -n -e 's|.*/'$epfu_pfxPat$epfu_projPat$epfu_sfxPat'|\1|p'`
     105  epfu_projName=`echo $epfu_projName | sed -e 's|/$||'`
    72106  echo "$epfu_projName"
    73107}
    74108
    75 # Extract the tail (directory) from an external URL. Relevant only for normal
    76 # projects, where the external will be a subdirectory of the project. Returns
    77 # null for Data/ThirdParty/BuildTools.
     109# Extract the tail (directory) from a URL that specifies an external. Relevant
     110# only for normal projects, where the external will be a subdirectory
     111# of the project. Returns null for Data / ThirdParty / BuildTools.
    78112# usage: projName=`extractTailFromExt $extURL`
    79113
     
    108142
    109143
     144# CppAD uses a version string of the form YYYMMDD.rr. What a pain in the ass.
     145# Hence the scattered exceptions below.
    110146# Extract the entire version string from a stable or release URL. Returns a
    111 # null string if handed a trunk URL or if there's no version in the URL.
     147# null string if handed a trunk URL or if there's no version in the URL. The
     148# version number must have at least major.minor to match.
    112149# usage: version=`extractVersionFromURL $svnURL`
    113150
    114151extractVersionFromURL ()
    115152{
    116   if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ||
    117      expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
    118     evfu_verPat='\([0-9.][0-9.]*\)'
     153  evfu_URL="$1"
     154  if expr "$evfu_URL" : '.*/stable/.*' >/dev/null 2>&1 ||
     155     expr "$evfu_URL" : '.*/releases/.*' >/dev/null 2>&1 ; then
     156    if expr "$evfu_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     157      evfu_verPat='\([0-9][0-9.]*\)'
     158    else
     159      evfu_verPat='\([0-9][0-9]*\.[0-9][0-9.]*\)'
     160    fi
    119161    evfu_sfxPat='.*$'
    120     case "$1" in
     162    evfu_proj=`extractProjFromURL $evfu_URL`
     163    case "$evfu_URL" in
    121164      */Data/stable/* | */Data/releases/* )
    122165          evfu_pfxPat='svn/Data/[^/][^/]*/'
     
    126169          ;;
    127170      *)
    128           evfu_pfxPat='svn/[^/][^/]*/[^/][^/]*/'
     171          evfu_pfxPat='svn/'$evfu_proj'/[^/][^/]*/'
    129172          ;;
    130173    esac
     
    138181# Replace the entire version string from a stable or release URL. A trunk
    139182# URL will be unmodified. newRev will not be accessed unless the URL is a
    140 # release.
     183# release. The version must have at least major.minor to match.
    141184# usage: newURL=`replaceVersionInURL $oldURL $newMajor $newMinor $newRev`
     185# and just for CppAD,
     186# usage: newURL=`replaceVersionInURL $oldURL $newMajor $newRev`
    142187
    143188replaceVersionInURL ()
    144189{
     190  if expr "$1" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     191    isCppAD=yes
     192  else
     193    isCppAD=no
     194  fi
     195  if test $isCppAD = no ; then
     196    rviu_verPat='[0-9][0-9]*\.[0-9][0-9.]*'
     197  else
     198    rviu_verPat='[0-9][0-9.]*'
     199  fi
     200
    145201  if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ; then
    146     rviu_newVersion=$2.$3
     202    if test $isCppAD = no ; then
     203      rviu_newVersion=$2.$3
     204    else
     205      rviu_newVersion=$2
     206    fi
    147207  elif expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
    148     rviu_newVersion=$2.$3.$4
     208    if test $isCppAD = no ; then
     209      rviu_newVersion=$2.$3.$4
     210    else
     211      rviu_newVersion=$2.$3
     212    fi
    149213  else
    150214    rviu_newVersion=
     
    152216  fi
    153217  if test -n "$rviu_newVersion" ; then
    154     rviu_newURL=`echo $1 | sed -n -e 's|^\(.*\)/[0-9][0-9.]*\(.*\)$|\1/'$rviu_newVersion'\2|p'`
     218    rviu_newURL=`echo $1 | sed -n -e 's|^\(.*\)/'$rviu_verPat'\(.*\)$|\1/'$rviu_newVersion'\2|p'`
    155219  fi
    156220  echo $rviu_newURL
     
    163227extractMajorFromURL ()
    164228{
    165   if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ||
    166      expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
     229  ejfu_URL="$1"
     230  if expr "$ejfu_URL" : '.*/stable/.*' >/dev/null 2>&1 ||
     231     expr "$ejfu_URL" : '.*/releases/.*' >/dev/null 2>&1 ; then
    167232    ejfu_majPat='\([0-9][0-9]*\)'
    168     ejfu_sfxPat='\.[0-9][0-9]*.*$'
    169     case "$1" in
     233    if expr "$ejfu_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     234      ejfu_sfxPat='.*$'
     235    else
     236      ejfu_sfxPat='\.[0-9][0-9]*.*$'
     237    fi
     238    ejfu_proj=`extractProjFromURL $ejfu_URL`
     239    case "$ejfu_URL" in
    170240      */Data/stable/* | */Data/releases/* )
    171241          ejfu_pfxPat='svn/Data/[^/][^/]*/'
     
    175245          ;;
    176246      *)
    177           ejfu_pfxPat='svn/[^/][^/]*/[^/][^/]*/'
     247          ejfu_pfxPat='svn/'$ejfu_proj'/[^/][^/]*/'
    178248          ;;
    179249    esac
    180     ejfu_majVer=`echo $1 | sed -n -e 's|.*/'$ejfu_pfxPat$ejfu_majPat$ejfu_sfxPat'|\1|p'`
     250    ejfu_majVer=`echo $ejfu_URL | sed -n -e 's|.*/'$ejfu_pfxPat$ejfu_majPat$ejfu_sfxPat'|\1|p'`
    181251    echo "$ejfu_majVer"
    182252  else
     
    187257# Extract the minor version number from a stable or release URL. Returns -1 if
    188258# handed a trunk URL or if there's no version in the URL.
     259# The CppAD form (YYYYMMDD.rr) doesn't have a minor version number.
    189260# usage: minVer=`extractMinorFromURL $svnURL`
    190261
    191262extractMinorFromURL ()
    192263{
    193   if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ||
    194      expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
     264  emfu_URL="$1"
     265  if expr "$emfu_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     266    echo "-1"
     267  elif expr "$emfu_URL" : '.*/stable/.*' >/dev/null 2>&1 ||
     268       expr "$emfu_URL" : '.*/releases/.*' >/dev/null 2>&1 ; then
    195269    emfu_minPat='[0-9][0-9]*\.\([0-9][0-9]*\)'
    196270    emfu_sfxPat='.*$'
    197     case "$1" in
     271    emfu_proj=`extractProjFromURL $emfu_URL`
     272    case "$emfu_URL" in
    198273      */Data/stable/* | */Data/releases/* )
    199274          emfu_pfxPat='svn/Data/[^/][^/]*/'
     
    203278          ;;
    204279      *)
    205           emfu_pfxPat='svn/[^/][^/]*/[^/][^/]*/'
     280          emfu_pfxPat='svn/'$emfu_proj'/[^/][^/]*/'
    206281          ;;
    207282    esac
    208     emfu_minVer=`echo $1 | sed -n -e 's|.*/'$emfu_pfxPat$emfu_minPat$emfu_sfxPat'|\1|p'`
     283    emfu_minVer=`echo $emfu_URL | sed -n -e 's|.*/'$emfu_pfxPat$emfu_minPat$emfu_sfxPat'|\1|p'`
    209284    echo "$emfu_minVer"
    210285  else
     
    219294extractReleaseFromURL ()
    220295{
    221   if expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
    222     erfu_relPat='[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)'
     296  erfu_URL="$1"
     297  if expr "$erfu_URL" : '.*/releases/.*' >/dev/null 2>&1 ; then
     298    if expr "$erfu_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     299      erfu_relPat='[0-9][0-9]*\.\([0-9][0-9]*\)'
     300    else
     301      erfu_relPat='[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)'
     302    fi
    223303    erfu_sfxPat='.*$'
    224     case "$1" in
     304    erfu_proj=`extractProjFromURL $erfu_URL`
     305    case "$erfu_URL" in
    225306      */Data/releases/* )
    226307          erfu_pfxPat='svn/Data/[^/][^/]*/'
     
    230311          ;;
    231312      *)
    232           erfu_pfxPat='svn/[^/][^/]*/[^/][^/]*/'
     313          erfu_pfxPat='svn/'$erfu_proj'/[^/][^/]*/'
    233314          ;;
    234315    esac
    235     erfu_relVer=`echo $1 | sed -n -e 's|.*/'$erfu_pfxPat$erfu_relPat$erfu_sfxPat'|\1|p'`
     316    erfu_relVer=`echo $erfu_URL | sed -n -e 's|.*/'$erfu_pfxPat$erfu_relPat$erfu_sfxPat'|\1|p'`
    236317    echo "$erfu_relVer"
    237318  else
     
    244325# Return the URL of the most recent stable branch matching the parameters.
    245326# A value of -1 for major or minor version is interpreted as `highest number'
     327# Returns an empty string if no suitable stable branch exists.
    246328# usage: stableURL=`bestStable <URL> <major>`
    247329
     
    272354
    273355  # Filter the list of stable branches to remove any that do not match the
    274   # requested major version.
    275 
    276   bstb_verPat='[0-9][0-9]*/'
    277   if test "$bstb_majVer" != "-1" ; then
     356  # requested major version. Note that there's a / at the end of each URL.
     357
     358  if test "$bstb_majVer" = "-1" ; then
     359    bstb_verPat='[0-9][0-9.]*/'
     360  elif expr "$bstb_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     361    bstb_verPat=$bstb_majVer'/'
     362  else
    278363    bstb_verPat=$bstb_majVer'\.[0-9][0-9]*'
    279   else
    280     bstb_verPat='[0-9][0-9.]*'
    281364  fi
    282365  bstb_filter=
     
    324407}
    325408
    326 # Return the URL of the most recent release matching the parameters.
     409# Return the URL of the most recent release matching the parameters. Returns
     410# null if no suitable release exists.
    327411# A value of -1 for major or minor version is interpreted as `highest number'
     412# A value of -1 for major version means that minor version is ignored.
    328413# usage: releaseURL=`bestRelease <URL> <major> <minor>`
    329414
     
    357442  # requested major and minor version.
    358443
    359   if test "$bstb_majVer" != "-1" ; then
    360     bstb_verPat=$bstb_majVer'\.'
    361   else
    362     bstb_verPat='[0-9][0-9]*\.'
    363   fi
    364   if test "$bstb_minVer" != "-1" ; then
    365     bstb_verPat="${bstb_verPat}$bstb_minVer"
    366   else
    367     bstb_verPat="${bstb_verPat}"'[0-9][0-9]*'
    368   fi
    369   bstb_verPat="${bstb_verPat}"'\.[0-9][0-9]*'
     444  if expr "$bstb_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     445    isCppAD=yes
     446  else
     447    isCppAD=no
     448  fi
     449
     450  if test "$bstb_majVer" = "-1" ; then
     451    bstb_verPat='[0-9][0-9.]*/'
     452  else
     453    bstb_verPat=$bstb_majVer
     454    if test $isCppAD = no &&
     455       test "$bstb_minVer" != "-1" ; then
     456      bstb_verPat="${bstb_verPat}\.$bstb_minVer"
     457    fi
     458    bstb_verPat="${bstb_verPat}"'\.[0-9][0-9]*/'
     459  fi
     460
    370461  # echo "Version pattern: $bstb_verPat"
    371462  bstb_filter=
     
    443534  esac
    444535
    445   # Run an ls and filter for standard stable branches (M.m)
     536  # Run an ls and filter for standard stable branches (M.m or YYYYMMDD)
     537
    446538  if test -n "$cltc_listURL" ; then
    447     cltc_rawls=`svn list $cltc_listURL | sed -n -e '/[0-9]\.[0-9]/p'`
     539    cltc_rawls=`svn list $cltc_listURL | sed -n -e '/[0-9][0-9.]/p'`
    448540
    449541    # echo "Raw ls: $cltc_rawls"
     
    452544    # requested major version. -1 means `any major version', hence no filter.
    453545
    454     cltc_verPat='[0-9][0-9]*/'
    455546    if test "$cltc_majVer" != "-1" ; then
    456       cltc_verPat=$cltc_majVer'\.[0-9][0-9]*'
     547      if expr "$cltc_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     548        cltc_verPat=$cltc_majVer
     549      else
     550        cltc_verPat=$cltc_majVer'\.[0-9][0-9]*'
     551      fi
    457552    else
    458553      cltc_verPat='[0-9][0-9.]*'
     
    475570}
    476571
    477 # Count the total number of stable branches (libtool current). See comments
    478 # above for calcLibtoolAge.
    479 # usage: calcLibtoolCurrent <url>
    480 calcLibtoolCurrent ()
    481 { calcLibtoolAge $1 -1
    482 }
    483 
     572# Function to compare the versions in a pair of URLs for equality. The criteria
     573# is that the major and minor versions match. In theory, the release should
     574# not matter. Probably should be a parameter.
     575# usage: compareURLVersions <url1> <url2>
     576
     577compareURLVersions ()
     578{
     579  url1_major=`extractMajorFromURL $1`
     580  url1_minor=`extractMinorFromURL $1`
     581  url2_major=`extractMajorFromURL $2`
     582  url2_minor=`extractMinorFromURL $2`
     583
     584  if test $url1_major = $url2_major &&
     585     test $url1_minor = $url2_minor ; then
     586    echo "yes"
     587  else
     588    echo "no"
     589  fi
     590}
     591
  • trunk/commit_new_release

    r1590 r1593  
    11#!/bin/sh
    22
    3 # Copyright (C) 2007  International Business Machines.
     3# Copyright (C) 2010  International Business Machines and others.
    44# All Rights Reserved.
    55# This file is distributed under the Common Public License.
    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
    1111# Modified by: Lou Hafer       SFU      2008-04-17
     12#              Lou Hafer       SFU      2010-06-29      major rewrite
    1213
    1314#set -x -v
     
    1516set -e
    1617
    17 # Remember what was done during release generation.
    18 
    19 if test -r .new_release_data; then
    20   . ./.new_release_data
    21 else
    22   echo ''
    23   echo 'Error: You need to run prepare_new_release first.'
    24   echo ''
    25   exit -1;
    26 fi
     18# Know thy self. If there are no '/' chars in the command name, we're running
     19# in the current directory. Otherwise, strip the command name, leaving the
     20# prefix.  Coin-functions is expected to live in the same directory.  As of
     21# the original version (100602), this script doesn't need coin-functions,
     22# but this still has some value as a consistency check.
     23
     24if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then
     25  cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'`
     26else
     27  cmdDir='.'
     28fi
     29if test -r $cmdDir/coin-functions ; then
     30  . $cmdDir/coin-functions
     31else
     32  echo "Cannot find utility functions file coin-functions; exiting."
     33fi
     34
     35# We need at least one parameter. The default is a dry run (dryRun = 1).
     36
     37printHelp=0
     38dryRun=1
     39dirToCommit=
     40
     41if test "$#" -eq 0; then
     42  printHelp=1
     43else
     44
     45# Process the parameters. A parameter without an opening `-' is assumed to be
     46# the spec for the directory to be committed.
     47
     48  while test $# -gt 0 && test $printHelp = 0 ; do
     49    case "$1" in
     50      -h* | --h*)
     51           printHelp=1
     52           ;;
     53      -c* | --c*)
     54           dryRun=0
     55           ;;
     56       -*) echo "$0: unrecognised command line switch '"$1"'."
     57           printHelp=1
     58           ;;
     59        *) dirToCommit="$1"
     60           ;;
     61    esac
     62    shift
     63  done
     64fi
     65
     66# What are we committing?
     67
     68if test -z "$dirToCommit" ; then
     69  printHelp=1
     70fi
     71
     72if test $printHelp = 1 ; then
     73  cat <<EOF
     74usage: commit_new_release [-c] <directory_to_commit>
     75
     76  By default, commit_new_release is a dry run, printing the commands that
     77  will be executed. When you're confident that everything looks right, use
     78  the -c (--commit) flag to commit the release.
     79EOF
     80  exit 1
     81fi
     82
     83# Remember what was done during generation of the new release.
     84
     85if test -r $dirToCommit/.new_release_data; then
     86  . $dirToCommit/.new_release_data
     87else
     88  echo ''
     89  echo "Error: the file .new_release_data is not present in $dirToCommit."
     90  echo 'Are you running commit_new_release in the same directory where you'
     91  echo 'ran prepare_new_release?'
     92  echo ''
     93  exit 1
     94fi
     95
     96# Confirm that we're in the proper directory.
     97
     98currDir=`pwd`
     99if test "$currDir/$dirToCommit" != "$topBuildDir" ; then
     100  echo "According to $dirToCommit/.new_release_data, the release candidate was assembled"
     101  echo "in $topBuildDir."
     102  echo "You have asked to commit $currDir/$dirToCommit."
     103  echo "There is some confusion. Repository is unchanged."
     104  exit 1
     105fi
     106
     107if test $dryRun = 1 ; then
     108  echo "Dry run; testing commit of $dirToCommit."
     109else
     110  echo "Committing $dirToCommit."
     111fi
     112
     113# Change to the checkout directory.
     114
     115cd $coDir
     116
     117# If there are externals set on this directory, confirm that
     118# .Externals.original is present so that we can restore them later.
     119
     120releaseExternals=`svn propget svn:externals .`
     121if test -n "$releaseExternals" ; then
     122  if test -r .Externals.original ; then
     123    :
     124  else
     125    echo "This project has externals, but no .Externals.original file"
     126    echo "is present to restore them. Repository is unchanged."
     127    exit 1
     128  fi
     129fi
     130
     131# Make some short-form URLs by stripping the COIN URL base.
     132
     133stableURLshort=`echo $stableURL | sed -e "s,$coinURL/\(.*\),\1,"`
     134releaseURLshort=`echo $releaseURL | sed -e "s,$coinURL/\(.*\),\1,"`
     135
     136# Do we have to svn add Dependencies? If this query comes up with a leading
     137# `?', the answer is yes. If Dependencies is entirely absent or unchanged,
     138# we'll get a null string. If it's modified, we'll have a leading `M'.
     139
     140dependStatus=`svn status Dependencies`
     141if expr "$dependStatus" : '?.*Dependencies.*' >/dev/null 2>&1 ; then
     142  cmd='svn add Dependencies'
     143  echo $cmd
     144  if test $dryRun = 0 ; then
     145    eval $cmd
     146  fi
     147fi
     148
     149# Now, do we really need to to a temporary commit? BuildTools is the poster
     150# child, there are no changes at time of writing (100629). Do an svn status
     151# on the checkout directory and see if anything comes up as modified.
     152
     153if svn status $coDir | egrep '^M' 2>&1 >/dev/null ; then
     154  doCommit=yes
     155else
     156  doCommit=no
     157fi
     158
     159if test $doCommit = yes ; then
    27160
    28161# Commit the release to stable so we can do a repository-side copy to create
    29162# the release.
    30163
    31 echo ''
    32 echo '===> Temporarily committing changed version of stable...'
    33 echo ''
    34 
    35 rev_num_before=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
    36 echo "Revision number before commit: $rev_num_before"
    37 
    38 cmd="svn ci -m \"temporarily committing release candidate to stable\""
     164  echo ''
     165  echo "===> Temporarily committing release candidate to $stableURLshort ..."
     166  echo ''
     167
     168  rev_num_before=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
     169  echo "Revision number before commit: $rev_num_before"
     170
     171  cmd="svn ci -m \"temporarily committing release candidate\""
     172  echo $cmd
     173  if test $dryRun = 0 ; then
     174    eval $cmd
     175  fi
     176
     177# Update to confirm the commit. Avoid pulling in externals --- if we're doing
     178# multiple commits of new releases, they may not exist. As it stands, the
     179# main purpose of this call is to allow us to easily obtain the current
     180# revision.
     181# It might be useful to strengthen this and check that the value
     182# is what we're expecting --- one greater than the revision before
     183# commit. `--ignore-externals' could be made provisional on the existence
     184# of all externals by passing a boolean through .new_release_data. This
     185# would strengthen the update, in that the update would confirm existence
     186# of the externals.
     187
     188  cmd='svn update --ignore-externals'
     189  echo $cmd
     190  if test $dryRun = 0 ; then
     191    eval $cmd
     192  fi
     193
     194  rev_num=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
     195  echo "Current revision number is: $rev_num"
     196
     197fi
     198
     199# End preparatory commit.
     200
     201# Create the release with a repository-side copy.
     202
     203echo ''
     204echo "===> Creating new release $releaseURLshort from $stableURLshort (rev $rev_num) ..."
     205echo ''
     206
     207cmd="svn copy -m \"creating $releaseURLshort from $stableURLshort (rev $rev_num)\" $stableURL $releaseURL"
    39208echo $cmd
    40 eval $cmd
    41 
    42 # Update to confirm the commit. Avoid pulling in externals --- if we're doing
    43 # circular dependencies, they may not exist. As it stands, the main purpose of
    44 # this call is to allow us to easily obtain the current revision. It might be
    45 # useful to strengthen this and check that the value is what we're expecting
    46 # --- one greater than the revision before commit. `--ignore-externals' could
    47 # be made provisional on the existence of circular dependency by passing a
    48 # boolean through .new_release_data. This would strengthen the update, in that
    49 # the update would confirm existence of the externals.
    50 
    51 cmd='svn update --ignore-externals'
    52 echo $cmd
    53 eval $cmd
    54 
    55 rev_num=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
    56 echo "Current revision number is: $rev_num"
    57 
    58 # Create the release with a repository-side copy.
    59 
    60 echo ''
    61 echo "===> Creating new release $new_ver from stable $stableBranch (rev $rev_num)..."
    62 echo ''
    63 
    64 cmd="svn copy -m \"creating releases/$new_ver from stable/$stableBranch (rev $rev_num)\" $stableURL $releaseURL"
    65 echo $cmd
    66 eval $cmd
    67 
    68 # And restore the stable branch to it's original condition. Start by reverting
     209if test $dryRun = 0 ; then
     210  eval $cmd
     211fi
     212
     213# Restore the original stable branch.
     214
     215if test $doCommit = yes ; then
     216
     217# And restore the stable branch to its original condition. Start by reverting
    69218# to the original externals.
    70219
    71 if test -r Externals; then
    72   echo ''
    73   echo '===> Restoring original externals...'
    74   echo ''
    75 
    76   mv Externals.bak Externals
    77   svn pset svn:externals -F Externals .
    78 fi
    79 
    80 # Revert the package id in configure.ac and propagate with run_autotools.  Note
    81 # that this does not exclude configure.ac for externals in the normal place.
    82 # But since changes to externals are not swept up by the commit, it doesn't
    83 # matter. On the other hand, if this whole checkout is a temporary for the
    84 # purpose of release generation, I'm not entirely convinced we need to bother
    85 # to exclude configure.ac in the actual ThirdParty code base. Comments from
    86 # ThirdParty maintainers welcome.
    87 
    88 conf_ac_files=`find . -name 'configure.ac' | grep -v -E 'ThirdParty/.*/.*/configure.ac'`
    89 
    90 echo ''
    91 echo "===> Restoring version number (${stableBranch}stable) in configure.ac files"
    92 for i in $conf_ac_files; do
    93   sed -e "s|AC_INIT\(.*\)\[[0-9\.]*\],\(.*\)|AC_INIT\1[${stableBranch}],\2|" $i > bla
    94   mv bla $i
    95   svn di $i
    96 done
    97 
    98 echo ''
    99 echo '===> Running the autotools'
    100 echo ''
    101 curdir=`pwd`
    102 cd $buildBase
    103 BuildTools/run_autotools
    104 cd "$curdir"
     220  if test -r .Externals.original ; then
     221    echo ''
     222    echo '===> Restoring original externals ...'
     223    echo ''
     224    cmd="svn propset -F .Externals.original svn:externals ."
     225    echo $cmd
     226    if test $dryRun = 0 ; then
     227      eval $cmd
     228      rm .Externals.original
     229    fi
     230  fi
     231
     232# For every .bak file that we created, revert it.
     233
     234  if test -n "$bak_files" ; then
     235    echo ''
     236    echo '===> Restoring modified files ...'
     237    echo ''
     238    for i in $bak_files; do
     239      cmd="cp $i.bak $i ; rm $i.bak"
     240      if test $dryRun = 1 ; then
     241        echo "$cmd"
     242      else
     243        eval $cmd
     244      fi
     245    done
     246  fi
     247
     248# Rebuild configure and Makefile.in files.
     249
     250  echo ''
     251  echo '===> Executing run_autotools to restore configuration files ...'
     252  echo ''
     253  curdir=`pwd`
     254  cd $topBuildDir
     255  cmd="./BuildTools/run_autotools"
     256  echo $cmd
     257  if test $dryRun = 0 ; then
     258    eval $cmd
     259  fi
     260  cd "$curdir"
    105261
    106262# Commit the restored stable branch.
    107263
    108 echo ''
    109 echo '===> Committing restored stable...'
    110 echo ''
    111 
    112 cmd="svn ci -m \"restoring stable/$stableBranch\""
    113 echo $cmd
    114 eval $cmd
    115 
    116 echo ''
    117 echo "Done, new release $releaseURL created"
    118 echo ''
    119 echo "You can now delete the directory $buildBase including subdirectories"
    120 
    121 rm .new_release_data
     264  echo ''
     265  echo "===> Committing restored $stableURLshort ..."
     266  echo ''
     267
     268  cmd="svn ci -m \"restoring $stableURLshort\""
     269  echo $cmd
     270  if test $dryRun = 0 ; then
     271    eval $cmd
     272  fi
     273
     274fi
     275
     276# End restorative commit.
     277
     278cd $topBuildDir
     279cmd="rm .new_release_data"
     280if test $dryRun = 0 ; then
     281  eval $cmd
     282fi
     283
     284cd $startDir
     285echo ''
     286echo "Done, new release $releaseURLshort created."
     287echo ''
     288echo "You can now delete the directory $topBuildDir including subdirectories"
     289
  • trunk/commit_new_stable

    r1557 r1593  
    1010# Adapted from commit_new_release by Lou Hafer, SFU, 100507.
    1111
    12 # Set to 1 to suppress actions that actually modify the repository side.
    13 
    14 debug=1
    15 
    16 if test $debug = 1 ; then
    17   echo "Dry run by default. Commands that would modify the repository are"
    18   echo "echoed but not executed. Edit the script and set debug to 1 when"
    19   echo "you're confident you're ready."
    20 fi
    21 
    2212#set -x -v
    2313
     
    2515
    2616# Know thy self. If there are no '/' chars in the command name, we're running
    27 # in the currrent directory. Otherwise, strip the command name, leaving the
    28 # prefix.  Coin-functions is expected to live in the same directory.
    29 # As of the original version (100602), this script doesn't need coin-functions,
     17# in the current directory. Otherwise, strip the command name, leaving the
     18# prefix.  Coin-functions is expected to live in the same directory.  As of
     19# the original version (100602), this script doesn't need coin-functions,
    3020# but this still has some value as a consistency check.
    3121
     
    4131fi
    4232
     33# We need at least one parameter. The default is a dry run (dryRun = 1).
     34
     35printHelp=0
     36dryRun=1
     37dirToCommit=
     38
     39if test "$#" -eq 0; then
     40  printHelp=1
     41else
     42
     43# Process the parameters. A parameter without an opening `-' is assumed to be
     44# the spec for the directory to be committed.
     45
     46  while test $# -gt 0 && test $printHelp = 0 ; do
     47    case "$1" in
     48      -h* | --h*)
     49           printHelp=1
     50           ;;
     51      -c* | --c*)
     52           dryRun=0
     53           ;;
     54       -*) echo "$0: unrecognised command line switch '"$1"'."
     55           printHelp=1
     56           ;;
     57        *) dirToCommit="$1"
     58           ;;
     59    esac
     60    shift
     61  done
     62fi
    4363
    4464# What are we committing?
    4565
    46 dirToCommit="$1"
    47 
    4866if test -z "$dirToCommit" ; then
    49   echo "usage: commit_new_stable <directory to commit>"
     67  printHelp=1
     68fi
     69
     70if test $printHelp = 1 ; then
     71  cat <<EOF
     72usage: commit_new_stable [-c] <directory_to_commit>
     73
     74  By default, commit_new_stable is a dry run, printing the commands that
     75  will be executed. When you're confident that everything looks right, use
     76  the -c (--commit) flag to commit the new stable branch.
     77EOF
    5078  exit 1
    5179fi
    5280
    53 # Remember what was done during release generation.
     81# Remember what was done during generation of the new stable.
    5482
    5583if test -r $dirToCommit/.new_stable_data; then
     
    106134  cmd='svn add Dependencies'
    107135  echo $cmd
    108   if test $debug = 0 ; then
    109     eval $cmd
    110   fi
    111 fi
     136  if test $dryRun = 0 ; then
     137    eval $cmd
     138  fi
     139fi
     140
     141# Now, do we really need to to a temporary commit? BuildTools is the poster
     142# child, there are no changes at time of writing (100629). Do an svn status
     143# on the checkout directory and see if anything comes up as modified.
     144
     145if svn status $coDir | egrep '^M' 2>&1 >/dev/null ; then
     146  doCommit=yes
     147else
     148  doCommit=no
     149fi
     150
     151if test $doCommit = yes ; then
    112152
    113153# Commit the stable back to its source URL so we can do a repository-side copy
    114154# to create the release.
    115155
    116 echo ''
    117 echo "===> Temporarily committing stable candidate to $srcURLshort ..."
    118 echo ''
    119 
    120 rev_num_before=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
    121 echo "Revision number before commit: $rev_num_before"
    122 
    123 cmd="svn ci -m \"temporarily committing stable candidate\""
    124 echo $cmd
    125 if test $debug = 0 ; then
    126   eval $cmd
    127 fi
    128 
    129 # Update to confirm the commit. Avoid pulling in externals --- if we're doing
    130 # circular dependencies, they may not exist. As it stands, the main purpose of
    131 # this call is to allow us to easily obtain the current revision. It might be
    132 # useful to strengthen this and check that the value is what we're expecting
    133 # --- one greater than the revision before commit. `--ignore-externals' could
    134 # be made provisional on the existence of circular dependency by passing a
    135 # boolean through .new_release_data. This would strengthen the update, in that
    136 # the update would confirm existence of the externals.
    137 
    138 cmd='svn update --ignore-externals'
    139 echo $cmd
    140 if test $debug = 0 ; then
    141   eval $cmd
    142 fi
    143 
    144 rev_num=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
    145 echo "Current revision number is: $rev_num"
     156  echo ''
     157  echo "===> Temporarily committing stable candidate to $srcURLshort ..."
     158  echo ''
     159
     160  rev_num_before=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
     161  echo "Revision number before commit: $rev_num_before"
     162
     163  cmd="svn ci -m \"temporarily committing stable candidate\""
     164  echo $cmd
     165  if test $dryRun = 0 ; then
     166    eval $cmd
     167  fi
     168
     169# Update to confirm the commit. Avoid pulling in externals --- if we're
     170# doing multiple commits of new stable branches, they may not exist. As it
     171# stands, the main purpose of this call is to allow us to easily obtain the
     172# current revision.
     173# It might be useful to strengthen this and check that the value
     174# is what we're expecting --- one greater than the revision before
     175# commit. `--ignore-externals' could be made provisional on the existence
     176# of all externals by passing a boolean through .new_release_data. This
     177# would strengthen the update, in that the update would confirm existence
     178# of the externals.
     179
     180  cmd='svn update --ignore-externals'
     181  echo $cmd
     182  if test $dryRun = 0 ; then
     183    eval $cmd
     184  fi
     185
     186  rev_num=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
     187  echo "Current revision number is: $rev_num"
     188
     189fi
     190
     191# End of preparatory commit.
    146192
    147193# Create the new stable branch with a repository-side copy.
    148194
    149195echo ''
    150 echo "===> Creating new stable branch $newStableURLshort from $srcURLshort (r$rev_num)..."
     196echo "===> Creating new stable branch $newStableURLshort from $srcURLshort (r$rev_num) ..."
    151197echo ''
    152198
    153199cmd="svn copy -m \"creating $newStableURLshort from $srcURLshort (r$rev_num).\" $srcURL $newStableURL"
    154200echo $cmd
    155 if test $debug = 0 ; then
     201if test $dryRun = 0 ; then
    156202  eval $cmd
    157203fi
    158204
    159 # And restore the stable branch to its original condition. Start by reverting
     205# Now restore the original stable branch.
     206
     207if test $doCommit = yes ; then
     208
     209# And restore the source to its original condition. Start by reverting
    160210# to the original externals.
    161211
    162 if test -r .Externals.original ; then
    163   echo ''
    164   echo '===> Restoring original externals ...'
    165   echo ''
    166   cmd="svn propset -F .Externals.original svn:externals ."
    167   echo $cmd
    168   if test $debug = 0 ; then
    169     eval $cmd
    170     rm .Externals.original
    171   fi
    172 fi
     212  if test -r .Externals.original ; then
     213    echo ''
     214    echo '===> Restoring original externals ...'
     215    echo ''
     216    cmd="svn propset -F .Externals.original svn:externals ."
     217    echo $cmd
     218    if test $dryRun = 0 ; then
     219      eval $cmd
     220      rm .Externals.original
     221    fi
     222  fi
    173223
    174224# For every .bak file that we created, revert it.
    175225
    176 for i in $bak_files; do
    177   cmd="cp $i.bak $i ; rm $i.bak"
    178   if test $debug = 1 ; then
    179     echo "$cmd"
    180   else
    181     eval $cmd
    182   fi
    183 done
    184 
    185 echo ''
    186 echo '===> Executing run_autotools to restore configuration files.'
    187 echo ''
    188 curdir=`pwd`
    189 cd $topBuildDir
    190 cmd="BuildTools/run_autotools"
    191 echo $cmd
    192 if test $debug = 0 ; then
    193   eval $cmd
    194 fi
    195 cd "$curdir"
     226  if test -n "$bak_files" ; then
     227    echo ''
     228    echo '===> Restoring modified files ...'
     229    echo ''
     230    for i in $bak_files; do
     231      cmd="cp $i.bak $i ; rm $i.bak"
     232      if test $dryRun = 1 ; then
     233        echo "$cmd"
     234      else
     235        eval $cmd
     236      fi
     237    done
     238  fi
     239
     240# Rebuild configure and Makefile.in files
     241
     242  echo ''
     243  echo '===> Executing run_autotools to restore configuration files ...'
     244  echo ''
     245  curdir=`pwd`
     246  cd $topBuildDir
     247  cmd="./BuildTools/run_autotools"
     248  echo $cmd
     249  if test $dryRun = 0 ; then
     250    eval $cmd
     251  fi
     252  cd "$curdir"
    196253
    197254# Commit the restored source URL.
    198255
    199 echo ''
    200 echo "===> Committing restored $srcURLshort ..."
    201 echo ''
    202 
    203 cmd="svn ci -m \"restoring $srcURLshort\""
    204 echo $cmd
    205 if test $debug = 0 ; then
    206   eval $cmd
    207 fi
     256  echo ''
     257  echo "===> Committing restored $srcURLshort ..."
     258  echo ''
     259
     260  cmd="svn ci -m \"restoring $srcURLshort\""
     261  echo $cmd
     262  if test $dryRun = 0 ; then
     263    eval $cmd
     264  fi
     265
     266fi
     267
     268# End of restorative commit.
    208269
    209270cd $topBuildDir
    210271cmd="rm .new_stable_data"
    211272echo $cmd
    212 if test $debug = 0 ; then
     273if test $dryRun = 0 ; then
    213274  eval $cmd
    214275fi
     
    217278
    218279echo ''
    219 echo "Done, new stable $newStableURLshort created"
     280echo "Done, new stable $newStableURLshort created."
    220281echo ''
    221282echo "You can now delete the directory $topBuildDir including subdirectories"
  • trunk/prepare_new_release

    r1505 r1593  
    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
     37if test -r $cmdDir/coin-functions ; then
     38  . $cmdDir/coin-functions
     39else
     40  echo "Cannot find utility functions file coin-functions; exiting."
     41fi
     42
     43# Note that plain sh does not accept negative exit values
     44
     45exitValue=0
    20946
    21047# Specify the COIN URL base for convenience.
     
    21552
    21653printHelp=0
    217 exitValue=0
    21854ignoreBuildToolsMismatch=0
     55suppressCheckout=0
    21956
    22057# stableURL will be the stable branch that is the parent for the release we
    22158# 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.
     59# builds, and BuildTools itself; they require special handling. If a project
     60# is not BuildTools, ThirdParty, or Data, it's `normal'.
    22661
    22762stableURL=
    22863isThirdParty=no
    22964isData=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.
     65isBuildTools=no
     66isNormal=yes
     67
     68# cmdBTURL is required when stableURL specifies a ThirdParty or Data
     69# project --- we'll need to assemble a temporary package while creating the
     70# release candidate.
     71
     72cmdBTURL=
     73
     74# stableExternals specifies externals for which we are doing simultaneous
     75# releases. We will use the stable branch of the external while preparing and
     76# testing this release candidate, changing the Dependencies file to specify a
     77# (nonexistent) release of the external at the last moment.
    23678
    23779stableExternals=
     80
     81# exciseExternals specifies externals that should be removed when creating the
     82# new release.
     83
     84exciseExternals=
    23885
    23986# We need at least one parameter.
     
    25097      -h* | --h*) printHelp=1 ;;
    25198      -i* | --i*) ignoreBuildToolsMismatch=1 ;;
     99      -p* | --p*) suppressCheckout=1 ;;
    252100      -s* | --s*)
    253101           if expr "$1" : '.*-s.*=.*' 2>&1 >/dev/null ; then
     
    258106           fi
    259107           ;;
     108      -x* | --x*)
     109           if expr "$1" : '.*-x.*=.*' 2>&1 >/dev/null ; then
     110             exciseExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
     111           else
     112             shift
     113             exciseExternals=$1
     114           fi
     115           ;;
    260116       -b* | --b*)
    261117           if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then
    262              buildToolsURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
     118             cmdBTURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
    263119           else
    264120             shift
    265              buildToolsURL=$1
     121             cmdBTURL=$1
    266122           fi
    267            if expr "$buildToolsURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then
    268              case $buildToolsURL in
     123           if expr "$cmdBTURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then
     124             case $cmdBTURL in
    269125               http*) ;;
    270                    *) buildToolsURL=${coinURL}/$buildToolsURL
     126                   *) cmdBTURL=${coinURL}/$cmdBTURL
    271127                      ;;
    272128             esac
    273129           else
    274130             echo ''
    275              echo "URL $buildToolsURL does not point to BuildTools."
     131             echo "URL $cmdBTURL does not point to BuildTools."
    276132             echo ''
    277133             printHelp=1
    278              exitValue=-3
     134             exitValue=3
    279135            fi
    280136           ;;
     
    282138       -*) echo "$0: unrecognised command line switch '"$1"'."
    283139           printHelp=1
    284            exitValue=-1
     140           exitValue=1
    285141           ;;
    286142        *) stableURL=$1
     
    288144             case $stableURL in
    289145               http*) ;;
    290                    *) stableURL=${coinURL}/$stableURL
    291                       ;;
     146               BuildTools/ThirdParty/* )
     147                 stableURL=${coinURL}/$stableURL
     148                 ;;
     149               ThirdParty/* )
     150                 stableURL=${coinURL}/BuildTools/$stableURL
     151                 ;;
     152               CoinAll/* )
     153                 stableURL=${coinURL}/CoinBinary/$stableURL
     154                 ;;
     155               *) stableURL=${coinURL}/$stableURL
     156                 ;;
    292157             esac
    293158           else
     
    296161             echo ''
    297162             printHelp=1
    298              exitValue=-2
     163             exitValue=2
    299164           fi
    300165           ;;
     
    312177      echo "Stable URL $stableURL does not seem to exist."
    313178      printHelp=1
    314       exitValue=-5
     179      exitValue=5
    315180    fi
    316181  fi
     
    319184      *ThirdParty/* )
    320185        isThirdParty=yes
     186        isNormal=no
    321187        ;;
    322188      *Data/* )
    323189        isData=yes
     190        isNormal=no
     191        ;;
     192      *BuildTools/* )
     193        isBuildTools=yes
     194        isNormal=no
    324195        ;;
    325196      *)
     
    327198    esac
    328199    if test $isThirdParty = yes || test $isData = yes ; then
    329       if test -z $buildToolsURL ; then
     200      if test -z $cmdBTURL ; then
    330201        echo "You must provide a BuildTools URL to build a ThirdParty or Data project."
    331202        printHelp=1
    332         exitValue=-4
     203        exitValue=4
    333204      else
    334         if svn list $buildToolsURL 2>&1 >/dev/null ; then
     205        if svn list $cmdBTURL 2>&1 >/dev/null ; then
    335206          :
    336207        else
    337           echo "BuildTools URL $buildToolsURL does not seem to exist."
     208          echo "BuildTools URL $cmdBTURL does not seem to exist."
    338209          printHelp=1
    339           exitValue=-6
     210          exitValue=6
    340211        fi
    341212      fi
    342213    fi
    343214  fi
    344 fi
     215fi  # if "$#" .eq 0
    345216
    346217if test $printHelp = 1 ; then
    347218  cat <<EOF
    348 Usage: prepare_new_release <stableBranch> [options]
     219Usage: prepare_new_release <stableVer> [options]
    349220
    350221COIN standard practice is to generate periodic releases by taking a snapshot
     
    352223a new release based on the specified stable branch.
    353224
    354 Stable_branch specifies the stable branch of your project to be used to
     225<stableVer> specifies the stable branch of your project to be used to
    355226create the new release.  You can specify the entire URL, or you just enter
    356227what comes after "https://projects.coin-or.org/svn".  A typical example is
     
    361232  -b <BuildToolsURL>    URL for BuildTools; required to generate a release
    362233                        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.
    368234  -i                    Ignore BuildTools version mismatches in externals.
     235  -p                    Suppress checkout (useful for testing)
     236  -s <projectlist>      Suppress conversion from stable to release for the
     237                        listed externals (comma-separated list of project
     238                        names, e.g., -s Osi,Cbc).
     239  -x <projectlist>      Remove the listed projects from the list of externals
     240                        (comma-separated list of project names).
    369241
    370242This script will do the following:
     
    374246    release)
    375247  - Check out a clean copy of the specified stable branch, without externals
    376   - Make sure that the svn:externals property points to releases
     248  - Make sure that the svn:externals property points to releases, with the
     249    exception of projects in the list specified with -s.
    377250  - Create a new package configure.ac file with the release version number
    378251    specified in the AC_INIT macro.
     
    381254    the most recent release of BuildTools.
    382255  - Run the configure script, compile the code, and run the unit test.
    383   - Replace any stable branches in externals (specified with -s) with the
     256  - Replace stable externals for projects specified with -s with the
    384257    appropriate (yet to be committed) release.
    385258
     
    406279
    407280stableURL=`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|'`
     281stableProj=`extractProjFromURL $stableURL`
     282majVer=`extractMajorFromURL $stableURL`
     283minVer=`extractMinorFromURL $stableURL`
     284stableVer=$majVer.$minVer
     285echo "Stable URL..........: $stableURL"
     286echo "Stable project......: $stableProj"
     287echo "Stable branch.......: $stableVer"
     288if test -n "$stableExternals" ; then
     289  echo "Stable externals....: $stableExternals."
     290fi
     291
     292# Find out the most recent release (if any) for the stable branch, then
     293# construct the revision number of the new release. If there are existing
     294# releases, it's a matter of bumping the revision number and inserting the
     295# new revision in the URL. Otherwise, we know the new revision is 0 and we
     296# can simply tweak the stable URL.
     297
     298releaseURL=`bestRelease $stableURL $majVer $minVer | sed -e 's|/$||'`
     299if test -n "$releaseURL" ; then
     300  curRel=`extractReleaseFromURL $releaseURL`
     301  existingURL=$releaseURL
     302  newRel=`expr $curRel + 1`
    412303else
    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/`
     304  curRel=-1
     305  releaseURL=`echo $stableURL | sed -e s/stable/releases/`
     306  existingURL="none"
     307  newRel=0
     308fi
     309newVer=$majVer.$minVer.$newRel
     310releaseURL=`replaceVersionInURL $releaseURL $majVer $minVer $newRel`
     311
     312echo "Top release URL.....: $existingURL"
     313echo "New release URL.....: $releaseURL"
     314
     315# Relevant only if we're building ThirdParty or Data
     316
     317if test $isThirdParty = yes || test $isData = yes ; then
     318  echo "BuildTools URL......: $cmdBTURL"
     319fi
     320
     321# We need a libtool version number only for normal projects
     322
     323if test $isNormal = yes ; then
     324  newLTCurrent=`calcLibtoolAge $stableURL -1`
     325  newLTRevision=$newRel
     326  newLTAge=`calcLibtoolAge $stableURL $majVer`
     327  newLTVer=${newLTCurrent}:${newLTRevision}:${newLTAge}
     328  echo "Libtool version.....: $newLTVer"
     329fi
     330
     331# Now decide where to build and check out code. If the stable project name
     332# contains a '/', strip it out to make the build and checkout directories.
     333
     334topBuildDir=`echo $stableProj | sed -e 's|.*/\([^/]*\)$|\1|'`
     335topBuildDir="${topBuildDir}-${newVer}"
     336if test $isThirdParty = yes; then
     337  coDir=$topBuildDir/Thirdparty/$stableProj
     338elif test $isData = yes; then
     339  coDir=$topBuildDir/Data/$stableProj
    448340else
    449   releaseURL="$baseURL/releases/$new_ver"
    450 fi
    451 echo "Release URL.......: $releaseURL"
     341  coDir=$topBuildDir
     342fi
     343echo "Build directory.....: $topBuildDir"
     344echo "Checkout directory..: $coDir"
    452345
    453346# Check out the stable branch that'll be the base of the new release. No
     
    457350
    458351echo ''
    459 echo "===> Checking out stable release $stableBranch without externals..."
     352echo "===> Checking out stable release $stableVer without externals..."
    460353echo ''
    461354
    462 if test $isThirdParty = yes; then
    463   coDir=$buildBase/a/b
    464 elif test $isData = yes; then
    465   coDir=$buildBase/a/b
     355rm -rf $topBuildDir
     356cmd="svn co --ignore-externals $stableURL $coDir"
     357if test $suppressCheckout = 1 ; then
     358  echo "Pretending to do: $cmd"
    466359else
    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"
     360  rm -rf $topBuildDir
    481361  echo $cmd
    482362  eval $cmd
    483363fi
    484364
     365if test $isThirdParty = yes || test $isData = yes; then
     366  echo ''
     367  echo '===> Checking out BuildTools (Data or ThirdParty) ...'
     368  echo ''
     369  cmd="svn co $cmdBTURL $topBuildDir/BuildTools"
     370  if test $suppressCheckout = 1 ; then
     371    echo "Pretending to do: $cmd"
     372  else
     373    echo $cmd
     374    eval $cmd
     375  fi
     376fi
     377
     378startDir=`pwd`
    485379coDir=`cd $coDir; pwd`
    486 buildBase=`cd $buildBase; pwd`
     380topBuildDir=`cd $topBuildDir; pwd`
    487381
    488382cd $coDir
    489383
    490384# 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.
     385# We have no externals or third-party code at this point, so there will be
     386# two files for a normal project, one for a ThirdParty or Data project, and
     387# none for BuildTools.
    493388
    494389echo ''
    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
     390echo "===> Checking for configure.ac files ..."
     391bak_files=`find . -name 'configure.ac'`
     392
     393if test -n "$bak_files" ; then
     394  for i in $bak_files; do
     395    cp $i $i.bak
     396  done
     397
     398# Take the attitude that [] around parameters in AC_INIT is optional,
     399# it's the commas that count. This does make for a surpassing ugly regular
     400# expression.  A comma in the version string will cause a spectacular failure.
     401# In AC_COIN_PROJECTDIR_INIT, take the attitude that the existing parameters
     402# don't matter, we know what the release parameters should be.
     403
     404  echo ''
     405  echo "===> Updating version numbers in configure.ac files ..."
     406  for i in $bak_files; do
     407    sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVer\3,\4|" $i > bla
     408    mv bla $i
     409    sed -e "s|AC_COIN_PROJECTDIR_INIT(.*)|AC_COIN_PROJECTDIR_INIT\($stableProj,$newLTCurrent:$newLTRevision:$newLTAge\)|" $i > bla
     410    mv bla $i
     411    svn diff $i
     412  done
     413else
     414  echo "    ... none to process."
     415fi
     416
     417# Find ProjConfig.h. If there's a definition for PROJ_VERSION, adjust it and
     418# add ProjConfig.h.bak to the list of files to be restored.
     419
     420stableProjUC=`echo $stableProj | tr '[a-z]' '[A-Z]'`
     421configFileLoc=`find . -name '*Config.h' -print`
     422if test -n "$configFileLoc" ; then
     423  versionSym=${stableProjUC}_VERSION
     424  echo ''
     425  echo "===> Updating $versionSym in $configFileLoc (if present)"
     426  echo ''
     427  mv $configFileLoc $configFileLoc.bak
     428  bak_files="$bak_files $configFileLoc"
     429  sed -e "s/# *define $versionSym.*\$/#define $versionSym \"$newVer\"/" <$configFileLoc.bak >$configFileLoc
     430  svn diff $configFileLoc
     431fi
     432
     433# Look for a file specifying externals.
     434
     435srcDepFile=
     436for file in Dependencies Externals ; do
     437  if test -r $file ; then
     438    srcDepFile=$file
     439    break
     440  fi
    499441done
    500442
    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\($stableProj, $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
     443# Now generate a proper Dependencies file for the release.  Each line
     444# in a Dependencies file has the format <ext_name> <ext_url>.  Normally,
     445# each <ext_url> should be a stable branch.  References to stable branches
     446# will be converted to references to releases unless the reference is to
     447# a project in the stableExternals list (in which case it'll be converted
     448# at the very end). References to releases are not changed. References to
     449# trunk are an error. Failure to find a release for an external not in the
     450# stableExternals list is an error. Save the existing externals and srcDepFile,
     451# as we'll probably change both.
     452
     453if test -n "$srcDepFile" ; then
     454
     455  svn propget svn:externals . > .Externals.original
     456  bak_files="$bak_files $srcDepFile"
     457  cp $srcDepFile $srcDepFile.bak
     458
     459  echo ''
     460  echo "===> Checking externals in $srcDepFile ..."
     461  echo ''
     462
     463# Because we're working directly from command output, the regular expression
     464# must check for lines.
     465
     466  ourBTURL=`svn propget svn:externals . | \
     467            sed -n -e 's/^BuildTools *https:\([^ ]*\)$/https:\1/p'`
     468  if test -z "$ourBTURL" ; then
     469    ourBTURL=none
     470  fi
     471  echo "Our BuildTools...:    $ourBTURL"
     472
     473  rm -f Dependencies
    528474  ext_name=
    529475  ext_url=
    530   for i in `cat Dependencies`; do
     476  buildtoolsMismatch=0
     477  for i in `cat $srcDepFile.bak`; do
    531478    if test "$ext_name" = ""; then
    532479      ext_name="$i"
    533480    else
    534       echo "Now checking $ext_name..."
    535       echo ''
    536481      ext_url=$i
    537       if (echo $ext_name | grep -E '^#' >/dev/null); then
    538         echo "===> Skip $ext_name $ext_url."
     482      if expr "$ext_name" : '#.*' 2>&1 >/dev/null ; then
     483        echo "    $ext_name $ext_url ==> skipped"
    539484        ext_name=
    540485        continue
    541       fi                                   
    542       if (echo $ext_url | grep -E 'stable/|releases/' >/dev/null); then
    543         :;
    544       else
     486      fi
     487      ext_urltype=`extractTypeFromURL $ext_url`
     488      ext_proj=`extractProjFromURL $ext_url`
     489
     490# See if this external should be dropped.
     491
     492      if expr "$exciseExternals" : '.*'$ext_proj'.*' 2>&1 > /dev/null ; then
     493        echo "    $ext_name $ext_url ==> excised"
     494        ext_name=
     495        continue
     496      fi
     497
     498# External must be a stable or a release.
     499
     500      if test $ext_urltype != stable && test $ext_urltype != release ; then
    545501        echo ''
    546502        echo "===> The external URL $ext_url is not a stable branch or release. Exiting."
    547503        echo ''
    548         exit -2
     504        exit 2
    549505      fi
    550506
    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"
     507      ext_isNormal=`isNormalURL $ext_url`
     508
     509# Convert stable branches to releases unless listed in stableExternals.
     510# Existing releases are unchanged.
     511
     512      if test $ext_urltype = stable ; then
     513        if expr "$stableExternals" : '.*'"$ext_proj"'.*' 2>&1 >/dev/null ; then
     514          echo "    $ext_name $ext_url unchanged"
     515          ext_rel_url=$ext_url
     516        else
     517          ext_majVer=`extractMajorFromURL $ext_url`
     518          ext_minVer=`extractMinorFromURL $ext_url`
     519          ext_rel_url=`bestRelease $ext_url $ext_majVer $ext_minVer`
     520          if test -z "$ext_rel_url" ; then
     521            echo ''
     522            echo "===> No release for $ext_url. Exiting."
     523            echo ''
     524            exit 2
     525          fi
     526          # Normal (not BuildTools/ThirdParty/Data) need a directory name,
     527          # and it may differ from the project name. Carefully preserve it.
     528          if test $ext_isNormal = yes ; then
     529            ext_tail=`extractTailFromExt $ext_url`
     530            ext_rel_url=${ext_rel_url}${ext_tail}
     531          fi
     532          echo "    $ext_name $ext_url ==> $ext_rel_url"
     533        fi
    559534      else
    560         echo $ext_name >>problems.ext
     535        ext_rel_url=$ext_url
     536        echo "    $ext_name $ext_url ==> unchanged"
    561537      fi
    562538
    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
     539# Get the BuildTools URL for the external and compare to the BuildTools URL
     540# for the source, assuming we have one and the external has one. We only need
     541# to do this for normal URLs, and we need to strip the tail.
     542
     543      if test $ext_isNormal = yes &&
     544         test $ext_proj != BuildTools && test $ourBTURL != none ; then
     545        ext_rel_url_notail=`echo $ext_rel_url | sed -e 's,/[^/]*$,,'`
     546        extBTURL=`svn propget svn:externals $ext_rel_url_notail`
     547        extBTURL=`echo $extBTURL | \
     548          sed -n -e 's/.*BuildTools https:\([^ ]*\) .*/https:\1/p'`
     549        if test -n "$extBTURL" ; then
     550          testResult=`compareURLVersions "$ourBTURL" "$extBTURL"`
     551          if test $testResult = no ; then
     552            echo "    WARNING: BuildTools mismatch: $ext_rel_url_notail uses $extBTURL"
     553            if test $ignoreBuildToolsMismatch = 0 ; then
     554               buildtoolsMismatch=1
     555            fi
     556          fi
    602557        fi
    603558      fi
    604559
    605       echo "     $ext_rel_url"
    606       echo "$ext_name  $ext_rel_url" >>Externals.releases
     560      echo "$ext_name  $ext_rel_url" >>Dependencies
    607561      ext_name=
    608562      echo ''
     
    610564  done
    611565
    612   echo ''
    613   echo '===> Updating svn:externals properties, and checking out externals...'
    614   echo ''
    615 
    616   svn pset svn:externals -F Externals.releases .
    617 
     566# If we have a BuildTools mismatch, and mismatch is not permitted, exit.
     567
     568  if test $buildtoolsMismatch -gt $ignoreBuildToolsMismatch ; then
     569    echo "Exiting due to BuildTools mismatches; use -i to ignore."
     570    exit 2
     571  fi
     572
     573  echo ''
     574  echo '===> Updating svn:externals property and checking out externals ...'
     575  echo ''
     576
     577  svn propset svn:externals -F Dependencies .
    618578  svn update
    619579
    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
     580  if test -d ThirdParty ; then
    653581    echo ''
    654     echo '===> Download third party code...'
     582    echo '===> Downloading ThirdParty code ...'
    655583    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
     584
     585    ext_name=
     586    ext_url=
     587    for i in `svn propget svn:externals .` ; do
     588      if test -z "$ext_name" ; then
     589        ext_name="$i"
     590      else
     591        ext_url=$i
     592        if expr "$ext_name" : 'ThirdParty/.*' 2>&1 >/dev/null ; then
     593          cd $ext_name
     594          ext_proj=`extractProjFromURL $ext_url`
     595          getScript=get.$ext_proj
     596          if test -x "$getScript" ; then
     597            ./$getScript -patch
     598          fi
     599          cd $coDir
     600        fi
     601        ext_name=
     602      fi
     603    done
     604  fi
     605fi
     606
     607# Finally! Done processing externals. If this is a ThirdParty project, we
     608# still have to run the get script.
     609
     610if test $isThirdParty = yes ; then
     611  if test -x get.$stableProj ; then
     612    echo ''
     613    echo '===> Downloading third party code ...'
     614    echo ''
     615    ./get.$stableProj
     616  fi
     617fi
     618
     619# Don't run run_autotools for BuildTools!
     620
     621if test $isBuildTools = no ; then
     622  echo ''
     623  echo '===> Running BuildTools/run_autotools ...'
     624  echo ''
     625  if test $isThirdParty = yes || test $isData = yes ; then
     626    cd ../..
     627    ./BuildTools/run_autotools
     628    cd "$coDir"
     629  elif test $isNormal = yes ; then
     630    ./BuildTools/run_autotools
     631  fi
     632fi
     633
     634# Let's see if it works. We only run tests for normal projects. DO NOT turn
     635# on --enable-maintainer-mode in the initial configure command. At the least,
     636# it's not needed. At the worst, as of 100526, it'll undo all the careful
     637# work above to set externals.
     638
     639if test $isNormal = yes ; then
    679640  (set -e
    680641   echo ''
     
    683644   mkdir build
    684645   cd build
    685    cmd="$coDir/configure -C --enable-maintainer-mode"
     646   cmd="$coDir/configure -C"
    686647   echo $cmd
    687648   eval $cmd
     
    715676    echo 'Error during build or test'
    716677    echo ''
    717     exit -3
    718   fi
     678    exit 3
     679  fi
     680  echo ''
     681  echo '===> ALL TESTS PASSED'
    719682fi
    720683
    721684echo ''
    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
     685if test $isNormal = yes ; then
     686  echo 'Please review the output above, particularly the one of make test.'
     687else
     688  echo 'Please review the output above.'
     689fi
     690echo ''
    727691
    728692# 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.
     693# with the stable versions? If so, generate a new Dependencies. This is the
     694# only reason stable references should appear in the externals for a release,
     695# so we don't need to check further before removing them.
    732696
    733697if test -n "$stableExternals" ; then
    734   echo "Grooming Externals to remove stable references used for testing."
    735   mv Externals.releases Externals
     698  echo "===> Grooming externals to remove stable externals used for testing ..."
     699  mv Dependencies Dependencies.temp.$$
    736700  ext_name=
    737701  ext_url=
    738   for i in `cat Externals`; do
     702  for i in `cat Dependencies.temp.$$`; do
    739703    if test "$ext_name" = ""; then
    740704      ext_name="$i"
    741705    else
    742706      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"
     707      ext_urltype=`extractTypeFromURL $ext_url`
     708      ext_proj=`extractProjFromURL $ext_url`
     709      if test $ext_urltype = stable ; then
     710        ext_rel_url=$ext_url
     711        ext_majVer=`extractMajorFromURL $ext_url`
     712        ext_minVer=`extractMinorFromURL $ext_url`
     713        ext_rel_url=`echo $ext_url | sed -e 's,/stable/,/releases/,'`
     714        ext_rel_url=`replaceVersionInURL $ext_rel_url $ext_majVer $ext_minVer 0`
     715        echo "    $ext_name $ext_url ==> $ext_rel_url"
    749716      else
    750717        ext_rel_url=$ext_url
    751718      fi
    752       echo "$ext_name  $ext_rel_url" >>Externals.releases
     719      echo "$ext_name  $ext_rel_url" >>Dependencies
    753720      ext_name=
    754721    fi
    755722  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:'
     723  rm -f Dependencies.temp.$$
     724  svn propset -F Dependencies svn:externals .
     725  echo ''
     726fi
     727
     728if test -r Dependencies ; then
     729  echo 'Also, please confirm the externals are correct:'
    764730  svn propget svn:externals
    765731fi
     
    769735echo 'the directory'
    770736echo ''
    771 echo "          $coDir"
     737echo "          $startDir"
    772738echo ''
    773739echo "and run the commit_new_release script"
    774740
    775 rm -rf Externals.releases
     741cd $topBuildDir
    776742
    777743cat >.new_release_data <<EOF
    778 isData=$isData
     744coinURL=$coinURL
     745startDir=$startDir
     746topBuildDir=$topBuildDir
    779747coDir=$coDir
    780 buildBase=$buildBase
    781748releaseURL=$releaseURL
    782749stableURL=$stableURL
    783 new_ver=$new_ver
    784 stableBranch=$stableBranch
     750newVer=$newVer
     751bak_files="$bak_files"
    785752EOF
  • trunk/prepare_new_stable

    r1561 r1593  
    1414
    1515# Know thy self. If there are no '/' chars in the command name, we're running
    16 # in the currrent directory. Otherwise, strip the command name, leaving the
     16# in the current directory. Otherwise, strip the command name, leaving the
    1717# prefix.  Coin-functions is expected to live in the same directory.
    1818
     
    315315# Construct a build directory name.
    316316
    317 topBuildDir=${srcProj}-${newVersion}
     317topBuildDir=`echo $srcProj | sed -e 's|.*/\([^/]*\)$|\1|'`
     318topBuildDir=${topBuildDir}-${newVersion}
    318319echo "Build directory.....: $topBuildDir"
    319320
     
    328329fi
    329330echo "Checkout directory..: $coDir"
     331
     332exit
    330333
    331334echo ''
     
    362365
    363366# Find configure.ac files for the package and project and update the version.
    364 # We have no externals at this point, so there will be two files for a
    365 # standard project, one for a ThirdParty or Data project.
    366 
    367 echo ''
    368 bak_files=`find . -name 'configure.ac' | grep -v -E 'ThirdParty/.*/.*/configure.ac'`
     367# We have no externals at this point, and no third-party code, so there will
     368# be two files for a standard project, one for a ThirdParty or Data project.
     369
     370echo ''
     371bak_files=`find . -name 'configure.ac'`
    369372echo "===> Creating backup (.bak) for configure.ac files..."
    370373for i in $bak_files; do
     
    372375done
    373376
    374 echo ''
    375 echo "===> Updating version number in configure.ac files"
     377# Take the attitude that [] around parameters in AC_INIT is optional,
     378# it's the commas that count. This does make for a surpassing ugly regular
     379# expression.  A comma in the version string will cause a spectacular failure.
     380# In AC_COIN_PROJECTDIR_INIT, take the attitude that the existing parameters
     381# don't matter, we know what the release parameters should be.
     382
     383echo ''
     384echo "===> Updating version numbers in configure.ac files"
    376385for i in $bak_files; do
    377   sed -e "s|AC_INIT\(.*\),\[[^]]*\],\(.*\)|AC_INIT\1,[$newVersion],\2|" $i > bla
     386  sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVersion\3,\4|" $i > bla
    378387  mv bla $i
    379388  svn diff $i
     
    426435
    427436# We've just checked this out, no sense going back to the server for the
    428 # BuildTools version.
     437# BuildTools version. Because of the intermediate variable, newline has
     438# become space.
    429439
    430440  srcExternals=`svn propget svn:externals .`
    431441  srcBTURL=`echo $srcExternals | \
    432     sed -n -e 's/.*BuildTools https:\([^ ]*\) .*/https:\1/p'`
     442            sed -n -e 's/.*BuildTools *https:\([^ ]*\) .*/https:\1/p'`
    433443  if test -z "$srcBTURL" ; then
    434444    srcBTURL="none"
     
    461471      fi
    462472
     473      ext_isNormalURL=`isNormalURL $ext_url`
     474
    463475# Convert a trunk URL to stable unless it's listed in trunkExternals.
    464476
     
    471483          # Normal (not BuildTools/ThirdParty/Data) need a directory name,
    472484          # and it may differ from the project name. Carefully preserve it.
    473           # ThirdParty URLs include BuildTools ; both named for emphasis
    474           case $ext_url in
    475             */BuildTools/* | */ThirdParty/* | */Data/* ) ;;
    476             *) ext_tail=`extractTailFromExt $ext_oldurl`
    477                ext_url=${ext_url}${ext_tail}
    478                ;;
    479           esac
     485          if test $ext_isNormalURL = yes ; then
     486            ext_tail=`extractTailFromExt $ext_oldurl`
     487            ext_url=${ext_url}${ext_tail}
     488          fi
    480489          echo "    $ext_name $ext_oldurl ==> $ext_url"
    481490        fi
     
    487496# for the source, assuming we have one and the external has one.
    488497
    489       if test $ext_proj != BuildTools && test $srcBTURL != none ; then
    490         extBTURL=`svn propget svn:externals $ext_url`
     498      if test $ext_isNormalURL = yes &&
     499         test $ext_proj != BuildTools && test $srcBTURL != none ; then
     500        ext_url_notail=`echo $ext_url | sed -e 's,/[^/]*$,,'`
     501        extBTURL=`svn propget svn:externals $ext_url_notail`
    491502        extBTURL=`echo $extBTURL | \
    492503          sed -n -e 's/.*BuildTools https:\([^ ]*\) .*/https:\1/p'`
    493         if test -n "$extBTURL" && test "$srcBTURL" != "$extBTURL" ; then
    494           echo "    WARNING: BuildTools mismatch: $ext_url uses $extBTURL"
    495           if test $ignoreBuildToolsMismatch = 0 ; then
    496              buildtoolsMismatch=1
     504        if test -n "$extBTURL" ; then
     505          testResult=`compareURLVersions "$srcBTURL" "$extBTURL"`
     506          if test $testResult = no ; then
     507            echo "    WARNING: BuildTools mismatch: $ext_url_notail uses $extBTURL"
     508            if test $ignoreBuildToolsMismatch = 0 ; then
     509               buildtoolsMismatch=1
     510            fi
    497511          fi
    498512        fi
     
    504518    fi
    505519  done
     520
     521# If we have a BuildTools mismatch, and mismatch is not permitted, exit.
     522
    506523  if test $buildtoolsMismatch -gt $ignoreBuildToolsMismatch ; then
    507524    echo "Exiting due to BuildTools mismatches; use -i to ignore."
     
    568585if test $isThirdParty = yes || test $isData = yes ; then
    569586  cd ../..
    570   BuildTools/run_autotools
     587  ./BuildTools/run_autotools
    571588  cd "$coDir"
    572589else
    573   BuildTools/run_autotools
     590  ./BuildTools/run_autotools
    574591fi
    575592
     
    634651
    635652# Do we need to plug in nonexistent stable branches for circular dependencies
    636 # tested with the trunk? If so, generate a new Externals.release. This is
    637 # the only reason trunk references should appear in the externals for a
    638 # stable branch, so we don't need to check further before removing them.
     653# tested with the trunk? If so, generate a new Dependencies. This is the only
     654# reason trunk references should appear in the externals for a stable branch,
     655# so we don't need to check further before removing them.
    639656
    640657if test -n "$trunkExternals" ; then
  • trunk/set_externals

    r1561 r1593  
    1111
    1212# Adapted from prepare_new_release by Ted Ralphs, Lehigh Univ., 2009-07-07
    13 # Modified: Lou Hafer          SFU      2010-06-02
     13# Modified:     Lou Hafer    SFU    2010-06-02
    1414
    1515#set -x -v
     
    146146 <name> <URL of stable version>
    147147
    148 Recommended practice is to keep this list in a file called "Dendencies" in the
    149 project's root directory. A temporary file called "Externals.releases" in the
    150 same form, but with the URL of each stable version replaced by the URL of the
    151 latest associated release is produced. From this file, the script will set the
    152 svn:externals variable. It does not do an update or commit the change. After
    153 the script runs, do an update and test build, then commit the change if you
    154 are happy.
     148Recommended practice is to keep this list in a file called "Dependencies" in
     149the project's root directory. A temporary file called "Externals.releases" in
     150the same form, but with the URL of each stable version replaced by the URL of
     151the latest associated release is produced. From this file, the script will
     152set the svn:externals variable. It does not do an update or commit the
     153change. After the script runs, do an update and test build, then commit the
     154change if you are happy.
    155155
    156156EOF
Note: See TracChangeset for help on using the changeset viewer.