Changeset 1556


Ignore:
Timestamp:
Jun 2, 2010 6:52:07 PM (10 years ago)
Author:
lou
Message:

New scripts for generating stable versions. Significantly different
architecture; see the BuildTools? posting 100602. set_externals is modified to
conform to the new architecture. Be careful!

Location:
trunk
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/set_externals

    r1369 r1556  
    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
     
    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 project name
     101            # ThirdParty URLs include BuildTools ; both named for emphasis
     102            case $ext_rel_url in
     103              *BuildTools* | *ThirdParty* | *Data* ) ;;
     104              *) ext_proj=`extractProjFromURL $ext_rel_url`
     105                 ext_rel_url=${ext_rel_url}${ext_proj}
     106                 ;;
     107            esac
     108            echo "Replacing $ext_url with $ext_rel_url"
     109            ext_url=$ext_rel_url
     110          fi
     111        else
     112          echo "Keeping $ext_url"
     113        fi
    139114
    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
     115        echo "$ext_name  $ext_url" >>Externals.releases
    162116        ext_name=
    163117      fi
     
    168122    echo ''
    169123
    170     svn pset svn:externals -F Externals.releases .
     124    svn propset svn:externals -F Externals.releases .
     125    svn propget svn:externals .
    171126   
    172127    rm Externals.releases
    173128
    174   else # if test -r Dependencies
     129  else # if test -r depFile
    175130    echo ""
    176131    echo "Dependency file does not exist or is unspecified..."
    177132    echo ""
    178133    printHelp=1
    179     exitvalue=-2
     134    exitvalue=2
    180135  fi
    181136fi
Note: See TracChangeset for help on using the changeset viewer.