| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Copyright (C) 2007 International Business Machines. |
| 4 |
# All Rights Reserved. |
| 5 |
# This file is distributed under the Eclipse Public License. |
| 6 |
# It is part of the BuildTools project in COIN-OR (www.coin-or.org) |
| 7 |
# |
| 8 |
# $Id: prepare_new_stable 3946 2019-02-24 17:55:35Z stefan $ |
| 9 |
# |
| 10 |
# Adapted from prepare_new_release by Lou Hafer, SFU, 100507. |
| 11 |
|
| 12 |
#set -x -v |
| 13 |
set -e |
| 14 |
|
| 15 |
# Know thy self. If there are no '/' chars in the command name, we're running |
| 16 |
# in the current directory. Otherwise, strip the command name, leaving the |
| 17 |
# prefix. Coin-functions is expected to live in the same directory. |
| 18 |
|
| 19 |
if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then |
| 20 |
cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` |
| 21 |
else |
| 22 |
cmdDir='.' |
| 23 |
fi |
| 24 |
cmdDir=`cd $cmdDir ; pwd` |
| 25 |
if test -r $cmdDir/coin-functions ; then |
| 26 |
. $cmdDir/coin-functions |
| 27 |
else |
| 28 |
echo "Cannot find utility functions file coin-functions; exiting." |
| 29 |
fi |
| 30 |
#################### end of function definitions ########################## |
| 31 |
|
| 32 |
|
| 33 |
# Note that plain sh does not accept negative exit values |
| 34 |
|
| 35 |
exitValue=0 |
| 36 |
|
| 37 |
# Specify the COIN URL base for convenience. |
| 38 |
|
| 39 |
coinURL="https://projects.coin-or.org/svn" |
| 40 |
|
| 41 |
# Begin parameter processing. |
| 42 |
|
| 43 |
printHelp=0 |
| 44 |
ignoreBuildToolsMismatch=no |
| 45 |
mismatchBTExternals= |
| 46 |
bumpMajor=0 |
| 47 |
suppressCheckout=0 |
| 48 |
|
| 49 |
# srcURL will be the parent for the stable we are building. We'll need to be |
| 50 |
# able to distinguish ThirdParty and Data builds, and BuildTools itself; they |
| 51 |
# require special handling. cmdBTURL points to a BuildTools source and is |
| 52 |
# required when srcURL specifies a ThirdParty or Data project --- we'll need to |
| 53 |
# assemble a temporary package while creating the stable candidate. |
| 54 |
|
| 55 |
srcURL= |
| 56 |
isThirdParty=no |
| 57 |
isData=no |
| 58 |
isBuildTools=no |
| 59 |
cmdBTURL= |
| 60 |
|
| 61 |
# trunkExternals specifies externals for which we want to do simultaneous |
| 62 |
# creation of stable branches. We will use the trunk as the external while |
| 63 |
# preparing and testing the stable candidate, changing the Dependencies file |
| 64 |
# to specify a (nonexistent) stable branch of the external at the last moment. |
| 65 |
|
| 66 |
trunkExternals= |
| 67 |
|
| 68 |
# exciseExternals specifies externals that should be removed when creating the |
| 69 |
# new stable branch. |
| 70 |
|
| 71 |
exciseExternals= |
| 72 |
|
| 73 |
# We need at least one parameter. |
| 74 |
|
| 75 |
if test "$#" -eq 0; then |
| 76 |
printHelp=1 |
| 77 |
else |
| 78 |
|
| 79 |
# Process the parameters. A parameter without an opening `-' is assumed to be |
| 80 |
# the spec for the source branch. |
| 81 |
|
| 82 |
while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do |
| 83 |
case "$1" in |
| 84 |
-h* | --h*) printHelp=1 ;; |
| 85 |
-i* | --i*) |
| 86 |
if expr "$1" : '.*-i.*=.*' 2>&1 >/dev/null ; then |
| 87 |
mismatchBTExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
| 88 |
else |
| 89 |
shift |
| 90 |
mismatchBTExternals=$1 |
| 91 |
fi |
| 92 |
if test "x$mismatchBTExternals" = "xall" ; then |
| 93 |
ignoreBuildToolsMismatch=all |
| 94 |
else |
| 95 |
ignoreBuildToolsMismatch=partial |
| 96 |
fi |
| 97 |
;; |
| 98 |
-m* | --m*) bumpMajor=1 ;; |
| 99 |
-p* | --p*) suppressCheckout=1 ;; |
| 100 |
-t* | --t*) |
| 101 |
if expr "$1" : '.*-t.*=.*' 2>&1 >/dev/null ; then |
| 102 |
trunkExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
| 103 |
else |
| 104 |
shift |
| 105 |
trunkExternals=$1 |
| 106 |
fi |
| 107 |
;; |
| 108 |
-x* | --x*) |
| 109 |
if expr "$1" : '.*-x.*=.*' 2>&1 >/dev/null ; then |
| 110 |
exciseExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
| 111 |
else |
| 112 |
shift |
| 113 |
exciseExternals=$1 |
| 114 |
fi |
| 115 |
;; |
| 116 |
-b* | --b*) |
| 117 |
if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then |
| 118 |
cmdBTURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` |
| 119 |
else |
| 120 |
shift |
| 121 |
cmdBTURL=$1 |
| 122 |
fi |
| 123 |
if expr "$cmdBTURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then |
| 124 |
case $cmdBTURL in |
| 125 |
http*) ;; |
| 126 |
*) cmdBTURL=${coinURL}/$cmdBTURL |
| 127 |
;; |
| 128 |
esac |
| 129 |
else |
| 130 |
echo '' |
| 131 |
echo "URL $cmdBTURL does not point to BuildTools." |
| 132 |
echo '' |
| 133 |
printHelp=1 |
| 134 |
exitValue=3 |
| 135 |
fi |
| 136 |
;; |
| 137 |
-*) echo "$0: unrecognised command line switch '"$1"'." |
| 138 |
printHelp=1 |
| 139 |
exitValue=1 |
| 140 |
;; |
| 141 |
*) srcURL=$1 |
| 142 |
case $srcURL in |
| 143 |
http* ) ;; |
| 144 |
BuildTools/ThirdParty/* ) |
| 145 |
srcURL=${coinURL}/$srcURL |
| 146 |
;; |
| 147 |
ThirdParty/* ) |
| 148 |
srcURL=${coinURL}/BuildTools/$srcURL |
| 149 |
;; |
| 150 |
* ) srcURL=${coinURL}/$srcURL |
| 151 |
;; |
| 152 |
esac |
| 153 |
;; |
| 154 |
esac |
| 155 |
shift |
| 156 |
done |
| 157 |
|
| 158 |
# Consistency check: Make sure that the source URL exists. Note that it's not |
| 159 |
# possible to specify a Data URL without including trunk/stable/release in the |
| 160 |
# URL. For others, helpfully append `trunk'. |
| 161 |
|
| 162 |
srcURL=`echo $srcURL | sed -e 's/\/$//'` |
| 163 |
urlType=`extractTypeFromURL "$srcURL"` |
| 164 |
if test $printHelp = 0 && test $exitValue = 0 ; then |
| 165 |
if svn list $srcURL 2>&1 >/dev/null ; then |
| 166 |
: |
| 167 |
else |
| 168 |
echo "Source URL $srcURL does not seem to exist." |
| 169 |
printHelp=1 |
| 170 |
exitValue=5 |
| 171 |
fi |
| 172 |
if test "$urlType" = invalid ; then |
| 173 |
srcURL=$srcURL/trunk |
| 174 |
urlType=trunk |
| 175 |
fi |
| 176 |
fi |
| 177 |
|
| 178 |
# Just what are we building? Order is important; BuildTools without ThirdParty |
| 179 |
# means we're actually doing a BuildTools stable. |
| 180 |
|
| 181 |
if test $printHelp = 0 && test $exitValue = 0 ; then |
| 182 |
case $srcURL in |
| 183 |
*ThirdParty* ) |
| 184 |
isThirdParty=yes |
| 185 |
;; |
| 186 |
*BuildTools* ) |
| 187 |
isBuildTools=yes |
| 188 |
;; |
| 189 |
*Data* ) |
| 190 |
isData=yes |
| 191 |
;; |
| 192 |
*) |
| 193 |
;; |
| 194 |
esac |
| 195 |
|
| 196 |
# If we're building a ThirdParty or Data release, we need a BuildTools URL. |
| 197 |
|
| 198 |
if test $isThirdParty = yes || test $isData = yes ; then |
| 199 |
if test -z "$cmdBTURL" ; then |
| 200 |
cmdBTURL=`bestRelease $coinURL/BuildTools -1 -1` |
| 201 |
echo "A BuildTools URL is required for Data or ThirdParty projects." |
| 202 |
echo "Using $cmdBTURL; override with -b" |
| 203 |
else |
| 204 |
if svn list $cmdBTURL 2>&1 >/dev/null ; then |
| 205 |
: |
| 206 |
else |
| 207 |
echo "BuildTools URL $cmdBTURL does not seem to exist." |
| 208 |
printHelp=1 |
| 209 |
exitValue=6 |
| 210 |
fi |
| 211 |
fi |
| 212 |
fi |
| 213 |
fi |
| 214 |
fi # if "$#" .eq 0 |
| 215 |
|
| 216 |
if test $printHelp = 1 ; then |
| 217 |
cat <<EOF |
| 218 |
Usage: prepare_new_stable [options] <source URL> |
| 219 |
|
| 220 |
This script will create a new stable branch from the head of the specified |
| 221 |
URL. Typically this will be the trunk, but it can be an existing stable |
| 222 |
branch. You can specify the entire URL, or just enter what comes after |
| 223 |
"https://projects.coin-or.org/svn". A typical example is |
| 224 |
|
| 225 |
prepare_new_stable Ipopt/trunk |
| 226 |
|
| 227 |
Options: |
| 228 |
-b <BuildToolsURL> URL for BuildTools; required to generate a release |
| 229 |
for a ThirdParty or Data project. |
| 230 |
-i <projectlist> Ignore BuildTools version mismatches for the listed |
| 231 |
externals (comma-separated list of project names, |
| 232 |
e.g., -i Osi,Cbc). '-i all' ignores all mismatches. |
| 233 |
-p Suppress checkout (useful for testing) |
| 234 |
-m Bump the major version number. |
| 235 |
-t <project-list> Suppress conversion from trunk to stable for the |
| 236 |
listed externals (comma-separated list of project |
| 237 |
names). |
| 238 |
-x <project-list> Remove the listed projects from the list of externals |
| 239 |
(comma-separated list of project names). |
| 240 |
|
| 241 |
This script will do the following: |
| 242 |
|
| 243 |
- Set the new stable version number as the next minor version number in |
| 244 |
the current major version number. Use the -m flag to bump the major |
| 245 |
version number. |
| 246 |
|
| 247 |
- Convert externals from trunk to the top stable branch. Externals which |
| 248 |
are currently stable or release are left untouched. Use -t to suppress |
| 249 |
the change from trunk to stable. Set_externals is then invoked to set |
| 250 |
release externals where available. |
| 251 |
|
| 252 |
- Check out externals. The BuildTools version used by externals (if any) |
| 253 |
is checked, and the script issues a warning if it doesn't match the |
| 254 |
version used by the source URL. |
| 255 |
|
| 256 |
- Run the scripts to download any ThirdParty code. |
| 257 |
|
| 258 |
- Run run_autotools to rebuild configure and make files. |
| 259 |
|
| 260 |
- Run configure, make, and make test |
| 261 |
|
| 262 |
- Tweak the externals to upgrade trunk (-t) dependencies to stable (you |
| 263 |
won't get to release in this case). |
| 264 |
|
| 265 |
If there is any error during these tasks the script will stop and you should |
| 266 |
examine the output. |
| 267 |
|
| 268 |
If the script completes without error, examine the output, particularly the |
| 269 |
output of the unit test ('make test') and the set of externals specified in |
| 270 |
the Dependencies file. Whether you start with Externals or Dependencies, the |
| 271 |
stable will have a proper Dependencies. Externals will be unmodified. |
| 272 |
|
| 273 |
This script does not make any changes to the repository. If you want to |
| 274 |
commit the new stable branch, run the "commit_new_stable" script, as described |
| 275 |
at the end of the output. |
| 276 |
|
| 277 |
EOF |
| 278 |
fi |
| 279 |
|
| 280 |
if test $exitValue != 0 || test $printHelp = 1 ; then |
| 281 |
exit $exitValue |
| 282 |
fi |
| 283 |
|
| 284 |
# End of parameter parsing. We have a source URL to work with. Tell the |
| 285 |
# user what we've seen. |
| 286 |
|
| 287 |
srcURL=`echo $srcURL | sed -e 's|/$||'` |
| 288 |
srcProj=`extractProjFromURL $srcURL` |
| 289 |
|
| 290 |
echo "Source URL..........: $srcURL" |
| 291 |
echo "Base project........: $srcProj" |
| 292 |
if test $isThirdParty = yes || test $isData = yes ; then |
| 293 |
echo "BuildTools URL......: $cmdBTURL" |
| 294 |
fi |
| 295 |
|
| 296 |
# Figure out the URL of the new stable branch. Consider that there may not be |
| 297 |
# any existing stable branches. |
| 298 |
|
| 299 |
topStableURL=`bestStable $srcURL -1` |
| 300 |
echo "Top stable URL......: ${topStableURL:-none}" |
| 301 |
|
| 302 |
if test -z "$topStableURL" ; then |
| 303 |
majVer=0 |
| 304 |
minVer=1 |
| 305 |
case "$srcURL" in |
| 306 |
*/Data/* ) |
| 307 |
newStableURL=$coinURL/Data/stable/$majVer.$minVer/$srcProj |
| 308 |
;; |
| 309 |
*/ThirdParty/* ) |
| 310 |
newStableURL=$coinURL/BuildTools/ThirdParty/$srcProj/stable/$majVer.$minVer |
| 311 |
;; |
| 312 |
* ) |
| 313 |
newStableURL=$coinURL/$srcProj/stable/$majVer.$minVer |
| 314 |
;; |
| 315 |
esac |
| 316 |
else |
| 317 |
majVer=`extractMajorFromURL $topStableURL` |
| 318 |
if test $bumpMajor = 1 ; then |
| 319 |
majVer=`expr $majVer + 1` |
| 320 |
minVer=0 |
| 321 |
else |
| 322 |
minVer=`extractMinorFromURL $topStableURL` |
| 323 |
minVer=`expr $minVer + 1` |
| 324 |
fi |
| 325 |
newStableURL=`replaceVersionInURL $topStableURL $majVer $minVer` |
| 326 |
fi |
| 327 |
echo "New stable URL......: $newStableURL" |
| 328 |
newVersion=${majVer}.${minVer} |
| 329 |
|
| 330 |
# Construct a build directory name. |
| 331 |
|
| 332 |
topProjName=`echo $srcProj | sed -e 's|.*/\([^/]*\)$|\1|'` |
| 333 |
topBuildDir=${topProjName}-${newVersion} |
| 334 |
echo "Build directory.....: $topBuildDir" |
| 335 |
|
| 336 |
# Now decide where to check out code. |
| 337 |
|
| 338 |
if test $isThirdParty = yes; then |
| 339 |
coDir=$topBuildDir/Thirdparty/$srcProj |
| 340 |
elif test $isData = yes; then |
| 341 |
coDir=$topBuildDir/Data/$srcProj |
| 342 |
else |
| 343 |
coDir=$topBuildDir |
| 344 |
fi |
| 345 |
echo "Checkout directory..: $coDir" |
| 346 |
|
| 347 |
echo '' |
| 348 |
echo "===> Checking out source $srcURL without externals ..." |
| 349 |
echo '' |
| 350 |
|
| 351 |
cmd="svn co --ignore-externals $srcURL $coDir" |
| 352 |
if test $suppressCheckout = 1 ; then |
| 353 |
echo "Pretending to do: $cmd" |
| 354 |
else |
| 355 |
rm -rf $topBuildDir |
| 356 |
echo $cmd |
| 357 |
eval $cmd |
| 358 |
fi |
| 359 |
|
| 360 |
if test $isThirdParty = yes || test $isData = yes; then |
| 361 |
echo '' |
| 362 |
echo '===> Checking out BuildTools (Data or ThirdParty) ...' |
| 363 |
echo '' |
| 364 |
cmd="svn co $cmdBTURL $topBuildDir/BuildTools" |
| 365 |
if test $suppressCheckout = 1 ; then |
| 366 |
echo "Pretending to do: $cmd" |
| 367 |
else |
| 368 |
echo $cmd |
| 369 |
eval $cmd |
| 370 |
fi |
| 371 |
fi |
| 372 |
|
| 373 |
startDir=`pwd` |
| 374 |
coDir=`cd $coDir; pwd` |
| 375 |
topBuildDir=`cd $topBuildDir; pwd` |
| 376 |
|
| 377 |
cd $coDir |
| 378 |
|
| 379 |
# Find configure.ac files for the package and project and update the version. |
| 380 |
# We have no externals at this point, and no third-party code, so there will |
| 381 |
# be two files for a standard project, one for a ThirdParty or Data project. |
| 382 |
|
| 383 |
echo '' |
| 384 |
if test -d $topProjName ; then |
| 385 |
bak_files=`find $topProjName -name 'configure.ac'` |
| 386 |
fi |
| 387 |
if test -e configure.ac ; then |
| 388 |
bak_files="$bak_files configure.ac" |
| 389 |
fi |
| 390 |
echo "===> Creating backup (.bak) for configure.ac files..." |
| 391 |
for i in $bak_files; do |
| 392 |
cp $i $i.bak |
| 393 |
done |
| 394 |
|
| 395 |
# Take the attitude that [] around parameters in AC_INIT is optional, |
| 396 |
# it's the commas that count. This does make for a surpassing ugly regular |
| 397 |
# expression. A comma in the version string will cause a spectacular failure. |
| 398 |
# In AC_COIN_PROJECTDIR_INIT, take the attitude that the existing parameters |
| 399 |
# don't matter, we know what the release parameters should be. |
| 400 |
|
| 401 |
echo '' |
| 402 |
echo "===> Updating version numbers in configure.ac files" |
| 403 |
for i in $bak_files; do |
| 404 |
sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVersion\3,\4|" $i > bla |
| 405 |
mv bla $i |
| 406 |
svn diff $i |
| 407 |
done |
| 408 |
|
| 409 |
# Find config_proj_default.h. If there's a definition for PROJ_VERSION, adjust it and |
| 410 |
# add config_proj_default.h.bak to the list of files to be restored. |
| 411 |
|
| 412 |
topProjNameUC=`echo $topProjName | tr '[a-z]' '[A-Z]'` |
| 413 |
if test -d $topProjName ; then |
| 414 |
configFileLoc=`find $topProjName -name .svn -prune -o -name 'config_*_default.h' -print` |
| 415 |
fi |
| 416 |
echo "config File Loc: $configFileLoc" |
| 417 |
if test -n "$configFileLoc" ; then |
| 418 |
versionSym=${topProjNameUC}_VERSION |
| 419 |
echo '' |
| 420 |
echo "===> Updating $versionSym in $configFileLoc (if present)" |
| 421 |
echo '' |
| 422 |
mv $configFileLoc $configFileLoc.bak |
| 423 |
bak_files="$bak_files $configFileLoc" |
| 424 |
sed -e "s/# *define $versionSym .*\$/#define $versionSym \"$newVersion\"/" \ |
| 425 |
-e "s/# *define ${versionSym}_MAJOR .*\$/#define ${versionSym}_MAJOR $majVer/" \ |
| 426 |
-e "s/# *define ${versionSym}_MINOR .*\$/#define ${versionSym}_MINOR $minVer/" \ |
| 427 |
-e "s/# *define ${versionSym}_RELEASE .*\$/#define ${versionSym}_RELEASE 9999/" \ |
| 428 |
<$configFileLoc.bak >$configFileLoc |
| 429 |
svn diff $configFileLoc |
| 430 |
fi |
| 431 |
|
| 432 |
# Now generate a proper Dependencies file for the stable branch. References to |
| 433 |
# trunk will be converted to references to stable branches unless the reference |
| 434 |
# is to a project in the trunkExternals list (in which case it'll be converted |
| 435 |
# at the very end). References to releases are not changed. Each line in a |
| 436 |
# Dependencies file has the format <ext_name> <ext_url>. Normally, each entry |
| 437 |
# should be a stable branch. |
| 438 |
|
| 439 |
srcDepFile= |
| 440 |
for file in Dependencies Externals ; do |
| 441 |
if test -r $file ; then |
| 442 |
srcDepFile=$file |
| 443 |
break |
| 444 |
fi |
| 445 |
done |
| 446 |
|
| 447 |
if test -n "$srcDepFile" ; then |
| 448 |
|
| 449 |
# Save the externals property of the source, so we can just restore it after |
| 450 |
# the commit. Also save srcDepFile, because we may well modify it for the |
| 451 |
# stable branch, converting trunk externals to stable externals. |
| 452 |
|
| 453 |
svn propget svn:externals . > .Externals.original |
| 454 |
bak_files="$bak_files $srcDepFile" |
| 455 |
cp $srcDepFile $srcDepFile.bak |
| 456 |
|
| 457 |
echo '' |
| 458 |
echo "===> Checking externals in $srcDepFile ..." |
| 459 |
echo '' |
| 460 |
|
| 461 |
# We've just checked this out, no sense going back to the server for the |
| 462 |
# BuildTools version. Because of the intermediate variable, newline has |
| 463 |
# become space. |
| 464 |
|
| 465 |
srcExternals=`svn propget svn:externals .` |
| 466 |
srcBTURL=`echo $srcExternals | \ |
| 467 |
sed -n -e 's/.*BuildTools *https:\([^ ]*\) .*/https:\1/p'` |
| 468 |
if test -z "$srcBTURL" ; then |
| 469 |
srcBTURL="none" |
| 470 |
fi |
| 471 |
echo "Source BuildTools...: $srcBTURL" |
| 472 |
|
| 473 |
rm -f Dependencies |
| 474 |
ext_name= |
| 475 |
ext_url= |
| 476 |
buildtoolsMismatch=0 |
| 477 |
for i in `cat $srcDepFile.bak` ; do |
| 478 |
if test "$ext_name" = "" ; then |
| 479 |
ext_name=$i |
| 480 |
else |
| 481 |
ext_url=$i |
| 482 |
if expr "$ext_name" : '#.*' 2>&1 >/dev/null ; then |
| 483 |
echo " $ext_name $ext_url ==> skipped" |
| 484 |
ext_name= |
| 485 |
continue |
| 486 |
fi |
| 487 |
ext_urltype=`extractTypeFromURL $ext_url` |
| 488 |
ext_proj=`extractProjFromURL $ext_url` |
| 489 |
|
| 490 |
# See if this external should be dropped. |
| 491 |
|
| 492 |
if expr "$exciseExternals" : '.*'$ext_proj'.*' 2>&1 > /dev/null ; then |
| 493 |
echo " $ext_name $ext_url ==> excised" |
| 494 |
ext_name= |
| 495 |
continue |
| 496 |
fi |
| 497 |
|
| 498 |
ext_isNormalURL=`isNormalURL $ext_url` |
| 499 |
|
| 500 |
# Convert a trunk URL to stable unless it's listed in trunkExternals. |
| 501 |
|
| 502 |
if test $ext_urltype = trunk ; then |
| 503 |
if expr "$trunkExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then |
| 504 |
echo " $ext_name $ext_url ==> unchanged" |
| 505 |
else |
| 506 |
ext_oldurl=$ext_url |
| 507 |
ext_url=`bestStable $ext_url -1` |
| 508 |
# Normal (not BuildTools/ThirdParty/Data) need a directory name, |
| 509 |
# and it may differ from the project name. Carefully preserve it. |
| 510 |
if test $ext_isNormalURL = yes ; then |
| 511 |
ext_tail=`extractTailFromExt $ext_oldurl` |
| 512 |
ext_url=${ext_url}${ext_tail} |
| 513 |
fi |
| 514 |
echo " $ext_name $ext_oldurl ==> $ext_url" |
| 515 |
fi |
| 516 |
else |
| 517 |
echo " $ext_name $ext_url ==> unchanged" |
| 518 |
fi |
| 519 |
|
| 520 |
# Get the BuildTools URL for the external and compare to the BuildTools URL |
| 521 |
# for the source, assuming we have one and the external has one. |
| 522 |
|
| 523 |
if test $ext_isNormalURL = yes && |
| 524 |
test $ext_proj != BuildTools && test $srcBTURL != none ; then |
| 525 |
ext_url_notail=`echo $ext_url | sed -e 's,/[^/]*$,,'` |
| 526 |
extBTURL=`svn propget svn:externals $ext_url_notail || :` |
| 527 |
extBTURL=`echo $extBTURL | \ |
| 528 |
sed -n -e 's/^BuildTools *https:\([^ ]*\) *$/https:\1/p'` |
| 529 |
if test -n "$extBTURL" ; then |
| 530 |
testResult=`compareURLVersions "$srcBTURL" "$extBTURL"` |
| 531 |
if test $testResult = no ; then |
| 532 |
if test $ignoreBuildToolsMismatch = all || \ |
| 533 |
expr "$mismatchBTExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then |
| 534 |
echo " WARNING: BuildTools mismatch: $ext_url_notail uses $extBTURL" |
| 535 |
else |
| 536 |
buildtoolsMismatch=1 |
| 537 |
echo " ERROR: BuildTools mismatch: $ext_url_notail uses $extBTURL" |
| 538 |
fi |
| 539 |
fi |
| 540 |
fi |
| 541 |
fi |
| 542 |
|
| 543 |
echo "$ext_name $ext_url" >>Dependencies |
| 544 |
ext_name= |
| 545 |
echo '' |
| 546 |
fi |
| 547 |
done |
| 548 |
|
| 549 |
# If we have a BuildTools mismatch, exit. |
| 550 |
|
| 551 |
if test $buildtoolsMismatch = 1 ; then |
| 552 |
echo "Exiting due to BuildTools mismatches; use -i to ignore." |
| 553 |
exit 2 |
| 554 |
fi |
| 555 |
|
| 556 |
$cmdDir/set_externals Dependencies |
| 557 |
|
| 558 |
# Try three times to check out externals before conceding defeat. |
| 559 |
|
| 560 |
echo '' |
| 561 |
echo '===> Checking out externals ...' |
| 562 |
echo '' |
| 563 |
|
| 564 |
svn update || |
| 565 |
{ echo "Retry 1 ... " ; svn update ; } || |
| 566 |
{ echo "Retry 2 ... " ; svn update ; } || |
| 567 |
{ echo "Checkout of externals failed. Aborting." ; exit 3 ; } |
| 568 |
|
| 569 |
# Run any scripts to acquire ThirdParty code. |
| 570 |
|
| 571 |
if test -d ThirdParty ; then |
| 572 |
|
| 573 |
echo '' |
| 574 |
echo '===> Downloading ThirdParty code ...' |
| 575 |
echo '' |
| 576 |
|
| 577 |
ext_name= |
| 578 |
ext_url= |
| 579 |
for i in `svn propget svn:externals .` ; do |
| 580 |
if test -z "$ext_name" ; then |
| 581 |
ext_name=$i |
| 582 |
else |
| 583 |
ext_url=$i |
| 584 |
if expr "$ext_name" : 'ThirdParty/.*' 2>&1 >/dev/null ; then |
| 585 |
cd $ext_name |
| 586 |
ext_proj=`extractProjFromURL $ext_url` |
| 587 |
getScript=get.$ext_proj |
| 588 |
if test -x "$getScript" ; then |
| 589 |
./$getScript -y |
| 590 |
fi |
| 591 |
cd $coDir |
| 592 |
fi |
| 593 |
ext_name= |
| 594 |
fi |
| 595 |
done |
| 596 |
fi |
| 597 |
fi |
| 598 |
|
| 599 |
|
| 600 |
# Done processing externals. If this is a ThirdParty project, we still have |
| 601 |
# to run the get script. |
| 602 |
|
| 603 |
if test $isThirdParty = yes; then |
| 604 |
if test -x get.$srcProj ; then |
| 605 |
echo '' |
| 606 |
echo '===> Downloading third party code...' |
| 607 |
echo '' |
| 608 |
./get.$srcProj -y |
| 609 |
fi |
| 610 |
fi |
| 611 |
|
| 612 |
# Run the autotools to update configure and make files |
| 613 |
|
| 614 |
echo '' |
| 615 |
echo '===> Running BuildTools/run_autotools ...' |
| 616 |
echo '' |
| 617 |
|
| 618 |
if test $isThirdParty = yes || test $isData = yes ; then |
| 619 |
cd ../.. |
| 620 |
./BuildTools/run_autotools |
| 621 |
cd "$coDir" |
| 622 |
else |
| 623 |
./BuildTools/run_autotools |
| 624 |
fi |
| 625 |
|
| 626 |
# Let's see if it works. We only run tests for non-ThirdParty, non-Data. DO NOT |
| 627 |
# turn on --enable-maintainer-mode in the initial configure command. At the |
| 628 |
# least, it's not needed. At the worst, as of 100526, it'll undo all the |
| 629 |
# careful work above to set externals. |
| 630 |
|
| 631 |
if test $isThirdParty != yes && test $isData != yes; then ( |
| 632 |
set -e |
| 633 |
echo '' |
| 634 |
echo '===> Creating build directory and running the configuration script...' |
| 635 |
echo '' |
| 636 |
mkdir build |
| 637 |
cd build |
| 638 |
cmd="$coDir/configure -C" |
| 639 |
echo $cmd |
| 640 |
eval $cmd |
| 641 |
echo '' |
| 642 |
echo '===> Compiling code...' |
| 643 |
echo '' |
| 644 |
cmd='make install' |
| 645 |
echo $cmd |
| 646 |
eval $cmd |
| 647 |
echo '' |
| 648 |
echo '===> Running the unit test...' |
| 649 |
echo '' |
| 650 |
echo '*******************************************************************************' |
| 651 |
echo '*** ***' |
| 652 |
echo '*** BEGIN OUTPUT OF MAKE TEST ***' |
| 653 |
echo '*** ***' |
| 654 |
echo '*******************************************************************************' |
| 655 |
echo '' |
| 656 |
cmd='make test' |
| 657 |
echo $cmd |
| 658 |
eval $cmd |
| 659 |
echo '' |
| 660 |
echo '*******************************************************************************' |
| 661 |
echo '*** ***' |
| 662 |
echo '*** END OUTPUT OF MAKE TEST ***' |
| 663 |
echo '*** ***' |
| 664 |
echo '*******************************************************************************' |
| 665 |
) |
| 666 |
if test $? != 0; then |
| 667 |
echo '' |
| 668 |
echo 'Error during build or test' |
| 669 |
echo '' |
| 670 |
exit 3 |
| 671 |
fi |
| 672 |
fi |
| 673 |
|
| 674 |
# No fatal errors. Declare victory. |
| 675 |
|
| 676 |
echo '' |
| 677 |
echo '===> ALL TESTS PASSED' |
| 678 |
if test $isThirdParty != yes && |
| 679 |
test $isData != yes && test $isBuildTools != yes ; then |
| 680 |
echo '' |
| 681 |
echo 'Please review the output above, particularly the one of make test' |
| 682 |
fi |
| 683 |
echo '' |
| 684 |
|
| 685 |
# Do we need to plug in nonexistent stable branches for circular dependencies |
| 686 |
# tested with the trunk? If so, generate a new Dependencies. This is the only |
| 687 |
# reason trunk references should appear in the externals for a stable branch, |
| 688 |
# so we don't need to check further before removing them. |
| 689 |
|
| 690 |
if test -n "$trunkExternals" ; then |
| 691 |
echo '' |
| 692 |
echo "===> Grooming externals to remove trunk references used for testing." |
| 693 |
echo '' |
| 694 |
mv Dependencies Dependencies.temp.$$ |
| 695 |
ext_name= |
| 696 |
ext_url= |
| 697 |
for i in `cat Dependencies.temp.$$`; do |
| 698 |
if test "$ext_name" = ""; then |
| 699 |
ext_name="$i" |
| 700 |
else |
| 701 |
ext_url=$i |
| 702 |
ext_urltype=`extractTypeFromURL $ext_url` |
| 703 |
ext_proj=`extractProjFromURL $ext_url` |
| 704 |
if test $ext_urltype = trunk ; then |
| 705 |
ext_oldurl=$ext_url |
| 706 |
ext_url=`bestStable $ext_url -1` |
| 707 |
ext_majVer=`extractMajorFromURL $ext_url` |
| 708 |
ext_minVer=`extractMinorFromURL $ext_url` |
| 709 |
ext_minVer=`expr $ext_minVer + 1` |
| 710 |
ext_url=`replaceVersionInURL $ext_url $ext_majVer $ext_minVer` |
| 711 |
ext_isNormal=`isNormalURL $ext_url` |
| 712 |
if test $ext_isNormal = yes ; then |
| 713 |
ext_url="${ext_url}${ext_proj}" |
| 714 |
fi |
| 715 |
echo " $ext_name $ext_oldurl ==> $ext_url" |
| 716 |
fi |
| 717 |
echo "$ext_name $ext_url" >>Dependencies |
| 718 |
ext_name= |
| 719 |
fi |
| 720 |
done |
| 721 |
rm -f Dependencies.temp.$$ |
| 722 |
$cmdDir/set_externals Dependencies |
| 723 |
fi |
| 724 |
|
| 725 |
if test -r Dependencies ; then |
| 726 |
echo '' |
| 727 |
echo 'Also, please confirm the Externals are correct:' |
| 728 |
svn propget svn:externals |
| 729 |
fi |
| 730 |
|
| 731 |
echo '' |
| 732 |
echo 'After reviewing the output above, you can create a new stable by going into' |
| 733 |
echo 'the directory' |
| 734 |
echo '' |
| 735 |
echo " $startDir" |
| 736 |
echo '' |
| 737 |
echo "and run the commit_new_stable script" |
| 738 |
|
| 739 |
cd $topBuildDir |
| 740 |
|
| 741 |
# Record information for the commit_new_stable script. |
| 742 |
|
| 743 |
cat >.new_stable_data <<EOF |
| 744 |
coinURL=$coinURL |
| 745 |
startDir=$startDir |
| 746 |
topBuildDir=$topBuildDir |
| 747 |
coDir=$coDir |
| 748 |
newStableURL=$newStableURL |
| 749 |
srcURL=$srcURL |
| 750 |
newVersion=$newVersion |
| 751 |
bak_files="$bak_files" |
| 752 |
EOF |