1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright (C) 2007 International Business Machines. |
---|
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: commit_new_release 1272 2009-04-24 16:33:02Z andreasw $ |
---|
9 | # |
---|
10 | # Author: Andreas Waechter IBM 2007-06-21 |
---|
11 | # Modified by: Lou Hafer SFU 2008-04-17 |
---|
12 | |
---|
13 | #set -x -v |
---|
14 | |
---|
15 | set -e |
---|
16 | |
---|
17 | # Remember what was done during release generation. |
---|
18 | |
---|
19 | if test -r .new_release_data; then |
---|
20 | . .new_release_data |
---|
21 | else |
---|
22 | echo '' |
---|
23 | echo 'Error: You need to run prepare_new_release first.' |
---|
24 | echo '' |
---|
25 | exit -1; |
---|
26 | fi |
---|
27 | |
---|
28 | # Commit the release to stable so we can do a repository-side copy to create |
---|
29 | # the release. |
---|
30 | |
---|
31 | echo '' |
---|
32 | echo '===> Temporarily committing changed version of stable...' |
---|
33 | echo '' |
---|
34 | |
---|
35 | rev_num_before=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'` |
---|
36 | echo "Revision number before commit: $rev_num_before" |
---|
37 | |
---|
38 | cmd="svn ci -m \"temporarily committing release candidate to stable\"" |
---|
39 | echo $cmd |
---|
40 | eval $cmd |
---|
41 | |
---|
42 | # Update to confirm the commit. Avoid pulling in externals --- if we're doing |
---|
43 | # circular dependencies, they may not exist. As it stands, the main purpose of |
---|
44 | # this call is to allow us to easily obtain the current revision. It might be |
---|
45 | # useful to strengthen this and check that the value is what we're expecting |
---|
46 | # --- one greater than the revision before commit. `--ignore-externals' could |
---|
47 | # be made provisional on the existence of circular dependency by passing a |
---|
48 | # boolean through .new_release_data. This would strengthen the update, in that |
---|
49 | # the update would confirm existence of the externals. |
---|
50 | |
---|
51 | cmd='svn update --ignore-externals' |
---|
52 | echo $cmd |
---|
53 | eval $cmd |
---|
54 | |
---|
55 | rev_num=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'` |
---|
56 | echo "Current revision number is: $rev_num" |
---|
57 | |
---|
58 | # Create the release with a repository-side copy. |
---|
59 | |
---|
60 | echo '' |
---|
61 | echo "===> Creating new release $new_ver from stable $stableBranch (rev $rev_num)..." |
---|
62 | echo '' |
---|
63 | |
---|
64 | cmd="svn copy -m \"creating releases/$new_ver from stable/$stableBranch (rev $rev_num)\" $stableURL $releaseURL" |
---|
65 | echo $cmd |
---|
66 | eval $cmd |
---|
67 | |
---|
68 | # And restore the stable branch to it's original condition. Start by reverting |
---|
69 | # to the original externals. |
---|
70 | |
---|
71 | if test -r Externals; then |
---|
72 | echo '' |
---|
73 | echo '===> Restoring original externals...' |
---|
74 | echo '' |
---|
75 | |
---|
76 | mv Externals.bak Externals |
---|
77 | svn pset svn:externals -F Externals . |
---|
78 | fi |
---|
79 | |
---|
80 | # Revert the package id in configure.ac and propagate with run_autotools. Note |
---|
81 | # that this does not exclude configure.ac for externals in the normal place. |
---|
82 | # But since changes to externals are not swept up by the commit, it doesn't |
---|
83 | # matter. On the other hand, if this whole checkout is a temporary for the |
---|
84 | # purpose of release generation, I'm not entirely convinced we need to bother |
---|
85 | # to exclude configure.ac in the actual ThirdParty code base. Comments from |
---|
86 | # ThirdParty maintainers welcome. |
---|
87 | |
---|
88 | conf_ac_files=`find . -name 'configure.ac' | grep -v -E 'ThirdParty/.*/.*/configure.ac'` |
---|
89 | |
---|
90 | echo '' |
---|
91 | echo "===> Restoring version number (${stableBranch}stable) in configure.ac files" |
---|
92 | for i in $conf_ac_files; do |
---|
93 | sed -e "s|AC_INIT\(.*\)\[[0-9\.]*\],\(.*\)|AC_INIT\1[${stableBranch}stable],\2|" $i > bla |
---|
94 | mv bla $i |
---|
95 | svn di $i |
---|
96 | done |
---|
97 | |
---|
98 | echo '' |
---|
99 | echo '===> Running the autotools' |
---|
100 | echo '' |
---|
101 | curdir=`pwd` |
---|
102 | cd $buildBase |
---|
103 | BuildTools/run_autotools |
---|
104 | cd "$curdir" |
---|
105 | |
---|
106 | # Commit the restored stable branch. |
---|
107 | |
---|
108 | echo '' |
---|
109 | echo '===> Committing restored stable...' |
---|
110 | echo '' |
---|
111 | |
---|
112 | cmd="svn ci -m \"restoring stable/$stableBranch\"" |
---|
113 | echo $cmd |
---|
114 | eval $cmd |
---|
115 | |
---|
116 | echo '' |
---|
117 | echo "Done, new release $releaseURL created" |
---|
118 | echo '' |
---|
119 | echo "You can now delete the directory $buildBase including subdirectories" |
---|
120 | |
---|
121 | rm .new_release_data |
---|