Changeset 2202


Ignore:
Timestamp:
Apr 13, 2011 6:15:13 PM (9 years ago)
Author:
lou
Message:

Modify coin-functions to properly calculate libtool 'current' and 'age' for an
arbitrary stable version. Modify calcLibtoolAge, add calcLibtoolCurrent. Tweak
prepare_new_release to use them properly.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin-functions

    r2201 r2202  
    535535
    536536# Count the total number of stable branches for the project for the specified
    537 # major version number (libtool age). A major version number of -1 means all
    538 # stable branches (libtool current; see next function). Returns 0 if handed
    539 # a trunk url, or if the url is Data or BuildTools itself.
    540 # usage: calcLibtoolAge <svnURL> <major>
     537# major version number, up to the specified minor version number (libtool age).
     538# Returns 0 if handed a trunk url, or if the url is Data or BuildTools itself.
     539# usage: calcLibtoolAge <svnURL> <major> <minor>
    541540
    542541calcLibtoolAge ()
    543542{ cltc_URL=$1
    544543  cltc_majVer=$2
     544  cltc_minVer=$3
    545545
    546546  # Construct a URL to send to the repository to list the stable branches.
     
    572572
    573573    # Filter the list of stable branches to remove any that do not match the
    574     # requested major version. -1 means `any major version', hence no filter.
    575 
    576     if test "$cltc_majVer" != "-1" ; then
    577       if expr "$cltc_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
    578         cltc_verPat=$cltc_majVer
    579       else
    580         cltc_verPat=$cltc_majVer'\.[0-9][0-9]*/'
    581       fi
     574    # requested major version.
     575
     576    if expr "$cltc_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then
     577      cltc_verPat=$cltc_majVer
    582578    else
    583       cltc_verPat='[0-9][0-9.]*/'
    584     fi
    585     cltc_filter=
     579      cltc_verPat=$cltc_majVer'\.[0-9][0-9]*/'
     580    fi
     581    cltc_majfilter=
    586582    for cltc_ver in $cltc_rawls ; do
    587583      if  expr "$cltc_ver" : $cltc_verPat >/dev/null 2>&1 ; then
    588         cltc_filter="$cltc_filter $cltc_ver"
     584        cltc_majfilter="$cltc_majfilter $cltc_ver"
    589585      fi
    590586    done
    591587
    592     # echo "Filtered ls: $cltc_filter"
    593 
    594     cltc_cnt=`echo $cltc_filter | wc -w | sed -e 's/ //g'`
     588    # echo "Filtered ls (major version): $cltc_majfilter"
     589
     590    # For the specific major version, filter the list that matched on major
     591    # version to remove any that exceed the minor version.
     592
     593    cltc_minfilter=
     594    for cltc_ver in $cltc_majfilter ; do
     595      cltc_min=`echo $cltc_ver | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/'`
     596      if expr $cltc_min '<=' $cltc_minVer >/dev/null 2>&1 ; then
     597        cltc_minfilter="$cltc_minfilter $cltc_ver"
     598      fi
     599    done
     600
     601    # echo "Filtered ls (minor version): $cltc_minfilter"
     602
     603    cltc_cnt=`echo $cltc_minfilter | wc -w | sed -e 's/ //g'`
    595604  else
    596605    cltc_cnt=0
     
    599608  echo $cltc_cnt
    600609}
     610
     611# Count the total number of stable branches for the project up to the
     612# specified major.minor version number (libtool current).  Returns 0 if
     613# handed a trunk url, or if the url is Data or BuildTools itself.
     614# usage: calcLibtoolCurrent <svnURL> <major> <minor>
     615
     616calcLibtoolCurrent ()
     617{ cltc_URL=$1
     618  cltc_majVer=$2
     619  cltc_minVer=$3
     620
     621  # Construct a URL to send to the repository to list the stable branches.
     622
     623  cltc_baseURL=`extractBaseURL $cltc_URL`
     624  cltc_proj=`extractProjFromURL $cltc_URL`
     625
     626  case "$cltc_URL" in
     627    */Data/* )
     628        cltc_listURL=
     629        ;;
     630    */ThirdParty/* )
     631        cltc_listURL=$cltc_baseURL/BuildTools/ThirdParty/$cltc_proj/stable
     632        ;;
     633    */BuildTools/* )
     634        cltc_listURL=
     635        ;;
     636    * )
     637        cltc_listURL=$cltc_baseURL/$cltc_proj/stable
     638        ;;
     639  esac
     640
     641  # Run an ls and filter for standard stable branches (M.m or YYYYMMDD)
     642
     643  if test -n "$cltc_listURL" ; then
     644    cltc_rawls=`svn list $cltc_listURL | sed -n -e '/[0-9][0-9.]/p'`
     645
     646    # echo "Raw ls: $cltc_rawls"
     647
     648    # Filter the list of stable branches to find those with standard version
     649    # numbers.
     650
     651    cltc_verPat='[0-9][0-9.]*/'
     652
     653    cltc_stdfilter=
     654    for cltc_ver in $cltc_rawls ; do
     655      if  expr "$cltc_ver" : $cltc_verPat >/dev/null 2>&1 ; then
     656        cltc_stdfilter="$cltc_stdfilter $cltc_ver"
     657      fi
     658    done
     659
     660    # echo "Filtered ls (standard): $cltc_stdfilter"
     661
     662    # Filter to remove major versions that exceed the specified version.
     663
     664    cltc_majfilter=
     665    for cltc_ver in $cltc_stdfilter ; do
     666      cltc_maj=`echo $cltc_ver | sed -e 's/\([0-9][0-9]*\)\.[0-9].*/\1/'`
     667      if expr $cltc_maj '<=' $cltc_majVer >/dev/null 2>&1 ; then
     668        cltc_majfilter="$cltc_majfilter $cltc_ver"
     669      fi
     670    done
     671
     672    # echo "Filtered ls (major version): $cltc_majfilter"
     673
     674    # For the specific major version, filter the list that matched on major
     675    # version to remove any that exceed the minor version.
     676
     677    cltc_minfilter=
     678    cltc_verPat='s/'$cltc_majVer'\.\([0-9][0-9]*\).*/\1/'
     679    for cltc_ver in $cltc_majfilter ; do
     680      cltc_min=`echo $cltc_ver | sed -e $cltc_verPat`
     681      if expr $cltc_min '<=' $cltc_minVer >/dev/null 2>&1 ; then
     682        cltc_minfilter="$cltc_minfilter $cltc_ver"
     683      fi
     684    done
     685
     686    # echo "Filtered ls (minor version): $cltc_minfilter"
     687
     688    cltc_cnt=`echo $cltc_minfilter | wc -w | sed -e 's/ //g'`
     689  else
     690    cltc_cnt=0
     691  fi
     692
     693  echo $cltc_cnt
     694}
     695
    601696
    602697# Function to compare the versions in a pair of URLs for equality. The criteria
  • trunk/prepare_new_release

    r2127 r2202  
    341341
    342342if test $isNormal = yes ; then
    343   newLTCurrent=`calcLibtoolAge $stableURL -1`
     343  newLTCurrent=`calcLibtoolCurrent $stableURL $majVer $minVer`
    344344  newLTRevision=$newRel
    345   newLTAge=`calcLibtoolAge $stableURL $majVer`
     345  newLTAge=`calcLibtoolAge $stableURL $majVer $minVer`
    346346  newLTAge=`expr $newLTAge - 1`
    347347  newLTVer=${newLTCurrent}:${newLTRevision}:${newLTAge}
Note: See TracChangeset for help on using the changeset viewer.