source: trunk/commit_new_stable @ 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: 5.9 KB
Line 
1#!/bin/sh
2
3# Copyright (C) 2010 International Business Machines and others.
4# All Rights Reserved.
5# This file is distributed under the Common Public License.
6# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
7#
8# $Id$
9#
10# Adapted from commit_new_release by Lou Hafer, SFU, 100507.
11
12# Set to 1 to suppress actions that actually modify the repository side.
13
14debug=0
15
16if test $debug = 1 ; then
17  echo "Dry run by default. Commands that would modify the repository are"
18  echo "echoed but not executed. Edit the script and set debug to 1 when"
19  echo "you're confident you're ready."
20fi
21
22#set -x -v
23
24set -e
25
26# Know thy self. If there are no '/' chars in the command name, we're running
27# in the currrent directory. Otherwise, strip the command name, leaving the
28# prefix.  Coin-functions is expected to live in the same directory.
29# As of the original version (100602), this script doesn't need coin-functions,
30# but this still has some value as a consistency check.
31
32if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then
33  cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'`
34else
35  cmdDir='.'
36fi
37if test -r $cmdDir/coin-functions ; then
38  . $cmdDir/coin-functions
39else
40  echo "Cannot find utility functions file coin-functions; exiting."
41fi
42
43
44# What are we committing?
45
46dirToCommit="$1"
47
48if test -z "$dirToCommit" ; then
49  echo "usage: commit_new_stable <directory to commit>"
50  exit 1
51fi
52
53# Remember what was done during release generation.
54
55if test -r $dirToCommit/.new_stable_data; then
56  . $dirToCommit/.new_stable_data
57else
58  echo ''
59  echo "Error: the file .new_stable_data is not present in $dirToCommit."
60  echo 'Are you running commit_new_stable in the same directory where you'
61  echo 'ran prepare_new_stable?'
62  echo ''
63  exit 1
64fi
65
66# Confirm that we're in the proper directory.
67
68currDir=`pwd`
69if test "$currDir/$dirToCommit" != "$topBuildDir" ; then
70  echo "According to $dirToCommit/.new_stable_data, the stable candidate was assembled"
71  echo "in $topBuildDir."
72  echo "You have asked to commit $currDir/$dirToCommit."
73  echo "There is some confusion. Repository is unchanged."
74  exit 1
75fi
76
77# Change to the checkout directory.
78
79cd $coDir
80
81# If there are externals set on this directory, confirm that
82# .Externals.original is present so that we can restore them later.
83
84newStableExternals=`svn propget svn:externals .`
85if test -n "$newStableExternals" ; then
86  if test -r .Externals.original ; then
87    :
88  else
89    echo "This project has externals, but no .Externals.original file"
90    echo "is present to restore them. Repository is unchanged."
91    exit 1
92  fi
93fi
94
95# Make some short-form URLs by stripping the COIN URL base.
96
97srcURLshort=`echo $srcURL | sed -e "s,$coinURL/\(.*\),\1,"`
98newStableURLshort=`echo $newStableURL | sed -e "s,$coinURL/\(.*\),\1,"`
99
100# Do we have to svn add Dependencies? If this query comes up with a leading
101# `?', the answer is yes. If Dependencies is entirely absent or unchanged,
102# we'll get a null string. If it's modified, we'll have a leading `M'.
103
104dependStatus=`svn status Dependencies`
105if expr "$dependStatus" : '?.*Dependencies.*' >/dev/null 2>&1 ; then
106  cmd='svn add Dependencies'
107  echo $cmd
108  if test $debug = 0 ; then
109    eval $cmd
110  fi
111fi
112
113# Commit the stable back to its source URL so we can do a repository-side copy
114# to create the release.
115
116echo ''
117echo "===> Temporarily committing stable candidate to $srcURLshort ..."
118echo ''
119
120rev_num_before=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
121echo "Revision number before commit: $rev_num_before"
122
123cmd="svn ci -m \"temporarily committing stable candidate\""
124echo $cmd
125if test $debug = 0 ; then
126  eval $cmd
127fi
128
129# Update to confirm the commit. Avoid pulling in externals --- if we're doing
130# circular dependencies, they may not exist. As it stands, the main purpose of
131# this call is to allow us to easily obtain the current revision. It might be
132# useful to strengthen this and check that the value is what we're expecting
133# --- one greater than the revision before commit. `--ignore-externals' could
134# be made provisional on the existence of circular dependency by passing a
135# boolean through .new_release_data. This would strengthen the update, in that
136# the update would confirm existence of the externals.
137
138cmd='svn update --ignore-externals'
139echo $cmd
140if test $debug = 0 ; then
141  eval $cmd
142fi
143
144rev_num=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'`
145echo "Current revision number is: $rev_num"
146
147# Create the new stable branch with a repository-side copy.
148
149echo ''
150echo "===> Creating new stable branch $newStableURLshort from $srcURLshort (r$rev_num)..."
151echo ''
152
153cmd="svn copy -m \"creating $newStableURLshort from $srcURLshort (r$rev_num).
154Final stable prior to split repo conversion. Reformatted code. Some bug fixes.\" $srcURL $newStableURL"
155echo $cmd
156if test $debug = 0 ; then
157  eval $cmd
158fi
159
160# And restore the stable branch to its original condition. Start by reverting
161# to the original externals.
162
163if test -r .Externals.original ; then
164  echo ''
165  echo '===> Restoring original externals ...'
166  echo ''
167  cmd="svn propset -F .Externals.original svn:externals ."
168  echo $cmd
169  if test $debug = 0 ; then
170    eval $cmd
171    rm .Externals.original
172  fi
173fi
174
175# For every .bak file that we created, revert it.
176
177for i in $bak_files; do
178  cmd="cp $i.bak $i ; rm $i.bak"
179  if test $debug = 1 ; then
180    echo "$cmd"
181  else
182    eval $cmd
183  fi
184done
185
186echo ''
187echo '===> Executing run_autotools to restore configuration files.'
188echo ''
189curdir=`pwd`
190cd $topBuildDir
191cmd="BuildTools/run_autotools"
192echo $cmd
193if test $debug = 0 ; then
194  eval $cmd
195fi
196cd "$curdir"
197
198# Commit the restored source URL.
199
200echo ''
201echo "===> Committing restored $srcURLshort ..."
202echo ''
203
204cmd="svn ci -m \"restoring $srcURLshort\""
205echo $cmd
206if test $debug = 0 ; then
207  eval $cmd
208fi
209
210cd $topBuildDir
211cmd="rm .new_stable_data"
212echo $cmd
213if test $debug = 0 ; then
214  eval $cmd
215fi
216
217cd $startDir
218
219echo ''
220echo "Done, new stable $newStableURLshort created"
221echo ''
222echo "You can now delete the directory $topBuildDir including subdirectories"
223
Note: See TracBrowser for help on using the repository browser.