Changeset 1561


Ignore:
Timestamp:
Jun 10, 2010 8:50:32 PM (10 years ago)
Author:
lou
Message:

Correctly handle case where directory used for external does not match the
project name, e.g., FlopC++/trunk/FlopCpp. Also add libtool library version
functions in coin-functions and correct output redirection.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin-functions

    r1556 r1561  
    6666}
    6767
     68# Extract the tail (directory) from an external URL. Relevant only for normal
     69# projects, where the external will be a subdirectory of the project. Returns
     70# null for Data/ThirdParty/BuildTools.
     71# usage: projName=`extractTailFromExt $extURL`
     72
     73extractTailFromExt ()
     74{
     75  etfe_tail=
     76  case "$1" in
     77    */Data/* )
     78        ;;
     79    */BuildTools/ThirdParty/* )
     80        ;;
     81    */BuildTools/* )
     82        ;;
     83    *)
     84        etfe_pfxPat=
     85        case "$1" in
     86          */trunk/* )
     87              etfe_pfxPat='.*/trunk/'
     88              ;;
     89          */stable/* )
     90              etfe_pfxPat='.*/stable/[0-9][0-9.]*/'
     91              ;;
     92          */releases/* )
     93              etfe_pfxPat='.*/releases/[0-9][0-9.]*/'
     94              ;;
     95        esac
     96        etfe_tail=`echo $1 | sed -n -e 's|'$etfe_pfxPat'\(.*\)|\1|p'`
     97        ;;
     98  esac
     99  echo "$etfe_tail"
     100}
     101
    68102
    69103# Extract the entire version string from a stable or release URL. Returns a
     
    73107extractVersionFromURL ()
    74108{
    75   if expr "$1" : '.*/stable/.*' 2>&1 >/dev/null ||
    76      expr "$1" : '.*/releases/.*' 2>&1 >/dev/null ; then
     109  if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ||
     110     expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
    77111    evfu_verPat='\([0-9.][0-9.]*\)'
    78112    evfu_sfxPat='.*$'
     
    102136replaceVersionInURL ()
    103137{
    104   if expr "$1" : '.*/stable/.*' 2>&1 >/dev/null ; then
     138  if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ; then
    105139    rviu_newVersion=$2.$3
    106   elif expr "$1" : '.*/releases/.*' 2>&1 >/dev/null ; then
     140  elif expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
    107141    rviu_newVersion=$2.$3.$4
    108142  else
     
    122156extractMajorFromURL ()
    123157{
    124   if expr "$1" : '.*/stable/.*' 2>&1 >/dev/null ||
    125      expr "$1" : '.*/releases/.*' 2>&1 >/dev/null ; then
     158  if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ||
     159     expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
    126160    ejfu_majPat='\([0-9][0-9]*\)'
    127161    ejfu_sfxPat='\.[0-9][0-9]*.*$'
     
    150184extractMinorFromURL ()
    151185{
    152   if expr "$1" : '.*/stable/.*' 2>&1 >/dev/null ||
    153      expr "$1" : '.*/releases/.*' 2>&1 >/dev/null ; then
     186  if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ||
     187     expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
    154188    emfu_minPat='[0-9][0-9]*\.\([0-9][0-9]*\)'
    155189    emfu_sfxPat='.*$'
     
    178212extractReleaseFromURL ()
    179213{
    180   if expr "$1" : '.*/releases/.*' 2>&1 >/dev/null ; then
     214  if expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then
    181215    erfu_relPat='[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)'
    182216    erfu_sfxPat='.*$'
     
    241275  bstb_filter=
    242276  for bstb_ver in $bstb_rawls ; do
    243     if  expr "$bstb_ver" : $bstb_verPat 2>&1 >/dev/null ; then
     277    if  expr "$bstb_ver" : $bstb_verPat >/dev/null 2>&1 ; then
    244278      bstb_filter="$bstb_filter $bstb_ver"
    245279    fi
     
    257291    # project.
    258292
    259     if expr "$bstb_URL" : '.*/Data/.*' 2>&1 >/dev/null ; then
     293    if expr "$bstb_URL" : '.*/Data/.*' >/dev/null 2>&1 ; then
    260294      bstb_projPat='.*'$bstb_proj'/.*'
    261295      # echo "Pattern: $bstb_projPat"
    262296      for bstb_ver in $bstb_filter ; do
    263         if  expr "$bstb_ver" : $bstb_verPat 2>&1 >/dev/null ; then
     297        if  expr "$bstb_ver" : $bstb_verPat >/dev/null 2>&1 ; then
    264298          # echo "  url: $bstb_listURL/$bstb_ver"
    265299          bstb_svnls2="`svn list $bstb_listURL/$bstb_ver`"
    266300          # echo "  result: $bstb_svnls2"
    267           if expr "$bstb_svnls2" : $bstb_projPat 2>&1 >/dev/null ; then
     301          if expr "$bstb_svnls2" : $bstb_projPat >/dev/null 2>&1 ; then
    268302            bstb_best=$bstb_ver
    269303            # echo "  best: $bstb_best"
     
    330364  bstb_filter=
    331365  for bstb_ver in $bstb_rawls ; do
    332     if  expr "$bstb_ver" : $bstb_verPat 2>&1 >/dev/null ; then
     366    if  expr "$bstb_ver" : $bstb_verPat >/dev/null 2>&1 ; then
    333367      bstb_filter="$bstb_filter $bstb_ver"
    334368    fi
     
    346380    # project.
    347381
    348     if expr "$bstb_URL" : '.*/Data/.*' 2>&1 >/dev/null ; then
     382    if expr "$bstb_URL" : '.*/Data/.*' >/dev/null 2>&1 ; then
    349383      bstb_projPat='.*'$bstb_proj'/.*'
    350384      # echo "Pattern: $bstb_projPat"
    351385      for bstb_ver in $bstb_filter ; do
    352         if  expr "$bstb_ver" : $bstb_verPat 2>&1 >/dev/null ; then
     386        if  expr "$bstb_ver" : $bstb_verPat >/dev/null 2>&1 ; then
    353387          # echo "  url: $bstb_listURL/$bstb_ver"
    354388          bstb_svnls2="`svn list $bstb_listURL/$bstb_ver`"
    355389          # echo "  result: $bstb_svnls2"
    356           if expr "$bstb_svnls2" : $bstb_projPat 2>&1 >/dev/null ; then
     390          if expr "$bstb_svnls2" : $bstb_projPat >/dev/null 2>&1 ; then
    357391            bstb_best=$bstb_ver
    358392            # echo "  best: $bstb_best"
     
    371405  echo $bstb_bestURL
    372406}
     407
     408# Count the total number of stable branches for the project for the specified
     409# major version number (libtool age). A major version number of -1 means all
     410# stable branches (libtool current; see next function). Returns 0 if handed
     411# a trunk url, or if the url is Data or BuildTools itself.
     412# usage: calcLibtoolAge <svnURL> <major>
     413
     414calcLibtoolAge ()
     415{ cltc_URL=$1
     416  cltc_majVer=$2
     417
     418  # Construct a URL to send to the repository to list the stable branches.
     419
     420  cltc_baseURL=`extractBaseURL $cltc_URL`
     421  cltc_proj=`extractProjFromURL $cltc_URL`
     422
     423  case "$cltc_URL" in
     424    */Data/* )
     425        cltc_listURL=
     426        ;;
     427    */ThirdParty/* )
     428        cltc_listURL=$cltc_baseURL/BuildTools/ThirdParty/$cltc_proj/stable
     429        ;;
     430    */BuildTools/* )
     431        cltc_listURL=
     432        ;;
     433    * )
     434        cltc_listURL=$cltc_baseURL/$cltc_proj/stable
     435        ;;
     436  esac
     437
     438  # Run an ls and filter for standard stable branches (M.m)
     439  if test -n "$cltc_listURL" ; then
     440    cltc_rawls=`svn list $cltc_listURL | sed -n -e '/[0-9]\.[0-9]/p'`
     441
     442    # echo "Raw ls: $cltc_rawls"
     443
     444    # Filter the list of stable branches to remove any that do not match the
     445    # requested major version. -1 means `any major version', hence no filter.
     446
     447    cltc_verPat='[0-9][0-9]*/'
     448    if test "$cltc_majVer" != "-1" ; then
     449      cltc_verPat=$cltc_majVer'\.[0-9][0-9]*'
     450    else
     451      cltc_verPat='[0-9][0-9.]*'
     452    fi
     453    cltc_filter=
     454    for cltc_ver in $cltc_rawls ; do
     455      if  expr "$cltc_ver" : $cltc_verPat >/dev/null 2>&1 ; then
     456        cltc_filter="$cltc_filter $cltc_ver"
     457      fi
     458    done
     459
     460    # echo "Filtered ls: $cltc_filter"
     461
     462    cltc_cnt=`echo $cltc_filter | wc -w | sed -e 's/ //g'`
     463  else
     464    cltc_cnt=0
     465  fi
     466
     467  echo $cltc_cnt
     468}
     469
     470# Count the total number of stable branches (libtool current). See comments
     471# above for calcLibtoolAge.
     472# usage: calcLibtoolCurrent <url>
     473calcLibtoolCurrent ()
     474{ calcLibtoolAge $1 -1
     475}
     476
  • trunk/prepare_new_stable

    r1556 r1561  
    469469          ext_oldurl=$ext_url
    470470          ext_url=`bestStable $ext_url -1`
    471           case "$ext_url" in
    472             */Data/* | */BuildTools/* ) ;;
    473             *) ext_url="${ext_url}${ext_proj}"
     471          # Normal (not BuildTools/ThirdParty/Data) need a directory name,
     472          # 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               ;;
    474479          esac
    475480          echo "    $ext_name $ext_oldurl ==> $ext_url"
  • trunk/set_externals

    r1556 r1561  
    4141
    4242# Process the parameters. A parameter without an opening `-' is assumed to be
    43 # the spec for the stable branch.
     43# the dependency file.
    4444
    4545  while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do
     
    9898            echo "Keeping $ext_url"
    9999          else
    100             # Normal (not BuildTools/ThirdParty/Data) need a project name
     100            # Normal (not BuildTools/ThirdParty/Data) need a directory name,
     101            # and it may differ from the project name. Carefully preserve it.
    101102            # ThirdParty URLs include BuildTools ; both named for emphasis
    102103            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}
     104              */BuildTools/* | */ThirdParty/* | */Data/* ) ;;
     105              *) ext_tail=`extractTailFromExt $ext_url`
     106                 ext_rel_url=${ext_rel_url}${ext_tail}
    106107                 ;;
    107108            esac
Note: See TracChangeset for help on using the changeset viewer.