source: trunk/set_externals @ 1556

Last change on this file since 1556 was 1556, checked in by lou, 11 years ago

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!

  • Property svn:executable set to *
File size: 4.2 KB
Line 
1#!/bin/sh
2
3# Copyright (C) 2007 International Business Machines and
4# Copyright (c) 2009 Lehigh University
5# All Rights Reserved.
6# This file is distributed under the Common Public License.
7# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
8#
9# $Id$
10#
11
12# Adapted from prepare_new_release by Ted Ralphs, Lehigh Univ., 2009-07-07
13# Modified: Lou Hafer          SFU      2010-06-02
14
15#set -x -v
16set -e
17
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.
21
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
32
33
34printHelp=0
35exitValue=0
36depFile=
37
38if test "$#" -eq 0; then
39  printHelp=1
40else
41
42# Process the parameters. A parameter without an opening `-' is assumed to be
43# the spec for the stable branch.
44
45  while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do
46    case "$1" in
47      -h* | --h*) printHelp=1 ;;
48           
49       -*) echo "$0: unrecognised command line switch '"$1"'."
50           printHelp=1
51           exitValue=1
52           ;;
53        *) depFile=$1
54           ;;
55    esac
56    shift
57  done
58fi
59
60# Find the most recent release for each stable external. Allow for the
61# possibility that a stable branch has no associated release.
62
63if test $printHelp = 0 && test $exitValue = 0; then
64  if test -r $depFile; then
65
66    rm -f Externals.releases
67
68    echo ''
69    echo '===> Converting stable externals to releases ...'
70    echo ''
71
72    ext_name=
73    ext_url=
74    for i in `cat $depFile`; do
75      if test "$ext_name" = ""; then
76        ext_name="$i"
77      else
78        ext_url=$i
79        if expr "$ext_name" : '#.*' >/dev/null 2>&1 ; then
80          echo "Skipping $ext_name."
81          ext_name=
82          continue
83        fi                                   
84        extType=`extractTypeFromURL $ext_url`
85        if test "$extType" = invalid ; then
86          echo ''
87          echo "The external URL $ext_url appears to be invalid. Exiting."
88          echo ''
89          exit 3
90        fi
91
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
114
115        echo "$ext_name  $ext_url" >>Externals.releases
116        ext_name=
117      fi
118    done
119
120    echo ''
121    echo '===> Updating svn:externals property...'
122    echo ''
123
124    svn propset svn:externals -F Externals.releases .
125    svn propget svn:externals .
126   
127    rm Externals.releases
128
129  else # if test -r depFile
130    echo ""
131    echo "Dependency file does not exist or is unspecified..."
132    echo ""
133    printHelp=1
134    exitvalue=2
135  fi
136fi
137
138if test $printHelp = 1 ; then
139  cat <<EOF
140Usage: set_externals <Dependency File>
141
142This script takes as input a dependency file containing a list of stable
143versions of COIN projects on separate lines in the form
144
145 <name> <URL of stable version>
146
147Recommended practice is to keep this list in a file called "Dendencies" in the
148project's root directory. A temporary file called "Externals.releases" in the
149same form, but with the URL of each stable version replaced by the URL of the
150latest associated release is produced. From this file, the script will set the
151svn:externals variable. It does not do an update or commit the change. After
152the script runs, do an update and test build, then commit the change if you
153are happy.
154
155EOF
156else
157cat <<EOF
158Externals set successfully. Please verify that the change is OK and then
159commit to make the change permanent.
160EOF
161
162fi
163
164exit $exitValue
Note: See TracBrowser for help on using the repository browser.