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

Syncing stable/0.6 with trunk

Location:
stable/0.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable/0.6

  • stable/0.6/set_externals

    r1370 r1695  
    77# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
    88#
    9 ## $Id: prepare_new_release 1302 2009-06-07 18:17:53Z stefan $
     9# $Id$
    1010#
    11 # This script is based on prepare_new_release, which is authored by
    12 # Author: Andreas Waechter     IBM      2007-06-21
    13 # Modified: Lou Hafer          SFU      2008-01-20
    14 #
    15 # The modifications to set_externals were made by
    16 # Ted Ralphs Lehigh University          2009-07-07
    17 #
     11
     12# Adapted from prepare_new_release by Ted Ralphs, Lehigh Univ., 2009-07-07
     13# Modified:     Lou Hafer    SFU    2010-06-02
    1814
    1915#set -x -v
    2016set -e
    2117
    22 determine_release ()
    23 {
    24   drtmp_stableBranch=`echo $1 | sed -e 's|.*/stable/||'`
    25   drtmp_baseURL=`echo $1 | sed -e 's|/stable/[0-9.]*||'`
    26   drtmp_returnVal=
     18# Know thy self. If there are no '/' chars in the command name, we're running
     19# in the currrent directory. Otherwise, strip the command name, leaving the
     20# prefix.  Coin-functions is expected to live in the same directory.
    2721
    28   # List the existing releases and screen for releases matching stableBranch.
     22if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then
     23  cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'`
     24else
     25  cmdDir='.'
     26fi
     27if test -r $cmdDir/coin-functions ; then
     28  . $cmdDir/coin-functions
     29else
     30  echo "Cannot find utility functions file coin-functions; exiting."
     31fi
    2932
    30   drtmp_svnlst=`svn list $drtmp_baseURL/releases/`
    31 
    32   drtmp_release_vers=
    33   for drtmp_i in $drtmp_svnlst ; do
    34     case $drtmp_i in
    35       $drtmp_stableBranch.*)
    36         drtmp_i=`echo $drtmp_i | sed -e 's|/$||'`
    37         drtmp_release_vers="$drtmp_release_vers $drtmp_i";;
    38     esac;
    39   done
    40 
    41   # Are there any existing releases? If not, and the user didn't ask for the
    42   # next release, we have an error.
    43 
    44   if test -z "$drtmp_release_vers" ; then
    45     if test $2 = 1 ; then
    46       drtmp_returnVal="$drtmp_stableBranch.0"
    47     else
    48       drtmp_returnVal="Error"
    49     fi
    50   else
    51 
    52   # There are releases. If we don't have one after the loop, we're confused.
    53 
    54     drtmp_new_rel=-10000
    55     for drtmp_i in $drtmp_release_vers; do
    56       drtmp_rel=`echo $drtmp_i | sed -e "s|^$drtmp_stableBranch.||"`
    57       if test $drtmp_rel -gt $drtmp_new_rel; then
    58         drtmp_new_rel=$drtmp_rel
    59       fi
    60     done
    61 
    62     if test $drtmp_new_rel = -10000; then
    63       drtmp_new_rel="Error"
    64     elif test $2 = 1 ; then
    65       drtmp_new_rel=`expr $drtmp_new_rel + 1`
    66     fi
    67       drtmp_returnVal="$drtmp_stableBranch.$drtmp_new_rel"
    68   fi
    69 
    70   echo $drtmp_returnVal
    71 }
    7233
    7334printHelp=0
    7435exitValue=0
    75 Dependencies=
     36depFile=
    7637
    7738if test "$#" -eq 0; then
     
    8041
    8142# Process the parameters. A parameter without an opening `-' is assumed to be
    82 # the spec for the stable branch.
     43# the dependency file.
    8344
    8445  while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do
     
    8849       -*) echo "$0: unrecognised command line switch '"$1"'."
    8950           printHelp=1
    90            exitValue=-1
     51           exitValue=1
    9152           ;;
    92         *) Dependencies=$1
     53        *) depFile=$1
    9354           ;;
    9455    esac
     
    9758fi
    9859
    99 # End of parameter parsing. We have a stable URL to work with.  Tell the
    100 # user what we've seen.
    101 
    102 # Find out the most recent release (if any) for the stable branch. List the
    103 # existing releases and screen for releases matching stableBranch. The new
    104 # release should be one greater than any existing release, or 0 if the stable
    105 # branch has no releases.
     60# Find the most recent release for each stable external. Allow for the
     61# possibility that a stable branch has no associated release.
    10662
    10763if test $printHelp = 0 && test $exitValue = 0; then
    108   if test -r $Dependencies; then
     64  if test -r $depFile; then
    10965
    11066    rm -f Externals.releases
    11167
    11268    echo ''
    113     echo '===> Creating new externals file with pointers to releases...'
     69    echo '===> Converting stable externals to releases ...'
    11470    echo ''
    11571
    11672    ext_name=
    11773    ext_url=
    118     for i in `cat $Dependencies`; do
     74    for i in `cat $depFile`; do
    11975      if test "$ext_name" = ""; then
    12076        ext_name="$i"
    12177      else
    12278        ext_url=$i
    123         if (echo $ext_name | grep -E '^#' >/dev/null); then
    124           echo "Skip $ext_name."
     79        if expr "$ext_name" : '#.*' >/dev/null 2>&1 ; then
     80          echo "Skipping $ext_name."
    12581          ext_name=
    12682          continue
    12783        fi                                   
    128         if (echo $ext_url | grep -E 'trunk|stable/|releases/' >/dev/null); then
    129           :;
    130         else
     84        extType=`extractTypeFromURL $ext_url`
     85        if test "$extType" = invalid ; then
    13186          echo ''
    132           echo "The external URL $ext_url is not valid. Exiting."
     87          echo "The external URL $ext_url appears to be invalid. Exiting."
    13388          echo ''
    134           exit -2
     89          exit 3
    13590        fi
    13691
    137         ext_base_front=`echo $ext_url | sed -e 's|/stable/.*||'`
    138         ext_proj=`echo $ext_base_front | sed -e 's|.*/\([^/]*\)|\1|'`
     92        if test "$extType" = stable ; then
     93          ext_majVer=`extractMajorFromURL $ext_url`
     94          ext_minVer=`extractMinorFromURL $ext_url`
     95          ext_rel_url=`bestRelease $ext_url $ext_majVer $ext_minVer`
     96          if test -z "$ext_rel_url" ; then
     97            echo "There is no release for $ext_url"
     98            echo "Keeping $ext_url"
     99          else
     100            # Normal (not BuildTools/ThirdParty/Data) need a directory name,
     101            # and it may differ from the project name. Carefully preserve it.
     102            # ThirdParty URLs include BuildTools ; both named for emphasis
     103            case $ext_rel_url in
     104              */BuildTools/* | */ThirdParty/* | */Data/* ) ;;
     105              *) ext_tail=`extractTailFromExt $ext_url`
     106                 ext_rel_url=${ext_rel_url}${ext_tail}
     107                 ;;
     108            esac
     109            echo "Replacing $ext_url with $ext_rel_url"
     110            ext_url=$ext_rel_url
     111          fi
     112        else
     113          echo "Keeping $ext_url"
     114        fi
    139115
    140         if expr "$ext_url" : '.*releases/.*' 2>&1 >/dev/null ; then
    141           echo "Using specified release for $ext_name."
    142           ext_rel_url=$ext_url
    143         elif expr "$ext_url" : '.*trunk.*' 2>&1 >/dev/null; then
    144           echo "Using specified trunk for $ext_name."
    145           ext_rel_url=$ext_url
    146         else
    147           ext_stable=`echo $ext_url | sed -e 's|\(.*/stable/[0-9\.]*\).*|\1|'`
    148           ext_base_end=`echo $ext_url | sed -e 's|.*/stable/[0-9\.]*||'`
    149 
    150           echo "Determining release for $ext_name:"
    151           ext_latest=`determine_release $ext_stable 0`
    152  
    153           if test "$ext_base_end" = ""; then
    154             ext_rel_url=$ext_base_front/releases/$ext_latest
    155           else
    156             ext_rel_url=$ext_base_front/releases/$ext_latest$ext_base_end
    157           fi
    158         fi
    159 
    160         echo "  $ext_rel_url"
    161         echo "$ext_name  $ext_rel_url" >>Externals.releases
     116        echo "$ext_name  $ext_url" >>Externals.releases
    162117        ext_name=
    163118      fi
     
    168123    echo ''
    169124
    170     svn pset svn:externals -F Externals.releases .
     125    svn propset svn:externals -F Externals.releases .
     126    svn propget svn:externals .
    171127   
    172128    rm Externals.releases
    173129
    174   else # if test -r Dependencies
     130  else # if test -r depFile
    175131    echo ""
    176132    echo "Dependency file does not exist or is unspecified..."
    177133    echo ""
    178134    printHelp=1
    179     exitvalue=-2
     135    exitvalue=2
    180136  fi
    181137fi
     
    190146 <name> <URL of stable version>
    191147
    192 Recommended practice is to keep this list in a file called "Dendencies" in the
    193 project's root directory. A temporary file called "Externals.releases" in the
    194 same form, but with the URL of each stable version replaced by the URL of the
    195 latest associated release is produced. From this file, the script will set the
    196 svn:externals variable. It does not do an update or commit the change. After
    197 the script runs, do an update and test build, then commit the change if you
    198 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.
    199155
    200156EOF
Note: See TracChangeset for help on using the changeset viewer.