1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
#!/bin/sh
# Copyright (C) 2007 International Business Machines and
# Copyright (c) 2009 Lehigh University
# All Rights Reserved.
# This file is distributed under the Eclipse Public License.
# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
#
# $Id$
#
# Adapted from prepare_new_release by Ted Ralphs, Lehigh Univ., 2009-07-07
# Modified: Lou Hafer SFU 2010-06-02
#set -x -v
set -e
# Know thy self. If there are no '/' chars in the command name, we're running
# in the currrent directory. Otherwise, strip the command name, leaving the
# prefix. Coin-functions is expected to live in the same directory.
if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then
cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'`
else
cmdDir='.'
fi
if test -r $cmdDir/coin-functions ; then
. $cmdDir/coin-functions
else
echo "Cannot find utility functions file coin-functions; exiting."
fi
printHelp=0
exitValue=0
depFile=
# stableExternals specifies externals which we do not want to convert to
# releases, for whatever reason.
stableExternals=
if test "$#" -eq 0; then
printHelp=1
else
# Process the parameters. A parameter without an opening `-' is assumed to be
# the dependency file.
while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do
case "$1" in
-h* | --h*) printHelp=1 ;;
-s* | --s*)
if expr "$1" : '.*-s.*=.*' 2>&1 >/dev/null ; then
stableExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'`
else
shift
stableExternals=$1
fi
;;
-*) echo "$0: unrecognised command line switch '"$1"'."
printHelp=1
exitValue=1
;;
*) depFile=$1
;;
esac
shift
done
fi
# Find the most recent release for each stable external. Allow for the
# possibility that a stable branch has no associated release, or that the
# user has asked to keep the stable external.
if test $printHelp = 0 && test $exitValue = 0; then
if test -r $depFile; then
rm -f Externals.releases
echo ''
echo '===> Converting stable externals to releases ...'
echo ''
ext_name=
ext_url=
for i in `cat $depFile`; do
if test "$ext_name" = ""; then
ext_name="$i"
else
ext_url=$i
if expr "$ext_name" : '#.*' >/dev/null 2>&1 ; then
echo "Skipping $ext_name."
ext_name=
continue
fi
if expr "$stableExternals" : '.*'"$ext_name"'.*' 2>&1 >/dev/null ; then
echo " $ext_name $ext_url unchanged"
else
extType=`extractTypeFromURL $ext_url`
if test "$extType" = invalid ; then
echo ''
echo "The external URL $ext_url appears to be invalid. Exiting."
echo ''
exit 3
fi
if test "$extType" = stable ; then
ext_majVer=`extractMajorFromURL $ext_url`
ext_minVer=`extractMinorFromURL $ext_url`
ext_rel_url=`bestRelease $ext_url $ext_majVer $ext_minVer`
if test -z "$ext_rel_url" ; then
echo "There is no release for $ext_url"
echo "Keeping $ext_url"
else
# Normal (not BuildTools/ThirdParty/Data) need a directory name,
# and it may differ from the project name. Carefully preserve it.
# ThirdParty URLs include BuildTools ; both named for emphasis
case $ext_rel_url in
*/BuildTools/* | */ThirdParty/* | */Data/* ) ;;
*) ext_tail=`extractTailFromExt $ext_url`
ext_rel_url=${ext_rel_url}${ext_tail}
;;
esac
echo "Replacing $ext_url with $ext_rel_url"
ext_url=$ext_rel_url
fi
else
echo "Keeping $ext_url"
fi
fi
echo "$ext_name $ext_url" >>Externals.releases
ext_name=
fi
done
echo ''
echo '===> Updating svn:externals property...'
echo ''
svn propset svn:externals -F Externals.releases .
svn propget svn:externals .
rm Externals.releases
else # if test -r depFile
echo ""
echo "Dependency file does not exist or is unspecified..."
echo ""
printHelp=1
exitvalue=2
fi
fi
if test $printHelp = 1 ; then
cat <<EOF
Usage: set_externals <Dependency File>
Options:
-s <projectlist> Suppress conversion from stable to release for the
listed externals (comma-separated list of project
names, e.g., -s Osi,Cbc).
This script takes as input a dependency file containing a list of stable
versions of COIN projects on separate lines in the form
<name> <URL of stable version>
Recommended practice is to keep the set of stable externals in a file
called "Dependencies" in the project's root directory. A temporary file
called "Externals.releases" in the same form, but with the URL of each
stable version replaced by the URL of the latest associated release is
produced. From this file, the script will set the svn:externals variable. It
does not do an update or commit the change. After the script runs, do an
update and test build, then commit the change if you are happy.
EOF
else
cat <<EOF
Externals set successfully. Please verify that the change is OK and then
commit to make the change permanent.
EOF
fi
exit $exitValue
|