This repository has been archived by the owner on May 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
make_release
executable file
·289 lines (232 loc) · 7.37 KB
/
make_release
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#!/bin/bash
# make_release release_number
usage() {
echo "usage: make_release release_number" >&2
exit 2
}
[ $# -eq 1 ] || usage
set -e
RELEASE_1=release_1
PYKE=pyke
PRE_2TO3_R1=pre_2to3_r1
PRE_2TO3=pre_2to3
TMPFILE=/tmp/make_release.$$
release_number="$1"
start_repo=`pwd`
# conditional commit -- only if "hg status" reports changes!
# all args passed to "hg commit"
do_commit() {
hg status > $TMPFILE
if [ -s $TMPFILE ]
then
#echo hg commit "$@"
hg commit "$@"
fi
rm -f $TMPFILE
}
# Raise error if "hg status" reports any changes!
# no args
check_status() {
hg status > $TMPFILE
if [ -s $TMPFILE ]
then
echo "ERROR: Uncommitted files:" >&2
cat $TMPFILE >&2
rm -f $TMPFILE
return 1
fi
rm -f $TMPFILE
}
# Raise error if "hg heads" reports multiple heads!
# optional -q arg to nix the error message to stderr
check_heads() {
hg heads --template '{desc|firstline}\n' > $TMPFILE
if [ `wc -l $TMPFILE | cut -f1 '-d '` -gt 1 ]
then
if [ x"$1" != x-q ]
then
echo "ERROR: Multiple Heads:" >&2
cat $TMPFILE >&2
fi
rm -f $TMPFILE
return 1
fi
rm -f $TMPFILE
}
# Run "hg fetch" and return error if no merge/commit done
# 1 arg, passed to "hg pull -u"
do_fetch() {
hg pull -u "$1"
if check_heads -q
then
return 1
else
hg merge
check_heads
hg commit -m "Automated merge with $1"
fi
}
echo
echo "*********************************************************************"
echo " Deleting .pyc files"
echo "*********************************************************************"
echo
find . -name '*.pyc' -exec rm {} +
echo
echo "*********************************************************************"
echo " Rebuilding compiler_bc.py"
echo "*********************************************************************"
echo
dir=pyke/krb_compiler/compiled_krb
if [ ! -d "$dir" ]
then
mkdir "$dir"
fi
python <<!
from pyke import krb_compiler
krb_compiler.compile_krb('compiler', 'pyke.krb_compiler.compiled_krb',
'pyke/krb_compiler/compiled_krb',
'pyke/krb_compiler/compiler.krb')
!
mv pyke/krb_compiler/compiled_krb/compiler_bc.py pyke/krb_compiler
echo
echo "*************************************************************************"
echo " Running testpyke"
echo "*************************************************************************"
echo
./testpyke
echo
echo "*************************************************************************"
echo " Committing release documentation"
echo "*************************************************************************"
echo
do_commit -m "Release documentation for $release_number"
check_status # there shouldn't be any uncommitted files!
echo
echo "*************************************************************************"
echo " Regenerating HTML documentation"
echo "*************************************************************************"
echo
cd doc/source
bin/gen_html
cd ../..
do_commit -Am "Regenerated HTML documentation for $release_number"
echo
echo "*************************************************************************"
echo " Fetching from sourceforge"
echo "*************************************************************************"
echo
cd "../$RELEASE_1"
hg pull
cd "$start_repo"
if do_fetch ../"$RELEASE_1"
then
./testpyke
fi
echo
echo "*************************************************************************"
echo " Merging into $PYKE"
echo "*************************************************************************"
echo
cd "../$PYKE"
hg pull
cd ..
rm -rf "$PYKE"_temp
hg clone -U "$PYKE" "$PYKE"_temp
cd "$PYKE"_temp
hg update
hg fetch "$start_repo"
#./testpyke # I don't want errors here stopping the release!
hg push # back to $PYKE
cd ..
rm -rf "$PYKE"_temp
echo
echo "*************************************************************************"
echo " Merging into $PRE_2TO3_R1"
echo "*************************************************************************"
echo
cd "$PRE_2TO3_R1"
hg pull
cd ..
rm -rf "$PRE_2TO3_R1"_temp
hg clone -U "$PRE_2TO3_R1" "$PRE_2TO3_R1"_temp
cd "$PRE_2TO3_R1"_temp
hg update
hg fetch "$start_repo"
cd doc/source
bin/gen_html
cd ../..
do_commit -Am "Regenerated 3.1 HTML documenation for $release_number"
./run_pre_test
hg push # back to $PRE_2TO3_R1
cd ..
rm -rf "$PRE_2TO3_R1"_temp
echo
echo "*************************************************************************"
echo " Merging into $PRE_2TO3"
echo "*************************************************************************"
echo
cd "$PRE_2TO3"
hg pull
cd ..
rm -rf "$PRE_2TO3"_temp
hg clone -U "$PRE_2TO3" "$PRE_2TO3"_temp
cd "$PRE_2TO3"_temp
hg update
# do this first to avoid dealing with the $PRE_2TO3_R1 merge conflicts twice!
hg fetch ../"$PRE_2TO3_R1"
hg fetch ../"$PYKE"
#./run_pre_test # I don't want errors here stopping the release!
hg push # back to $PRE_2TO3
cd ..
rm -rf "$PRE_2TO3"_temp
echo
echo "*************************************************************************"
echo " Building release files into dist directory"
echo "*************************************************************************"
echo
cd "$start_repo"
rm -rf build dist pyke.egg-info
python setup.py -q sdist --formats zip
cp ../"$PRE_2TO3_R1"_temp_test/dist/pyke*.zip dist
rm -rf ../"$PRE_2TO3_R1"_temp_test
cp RELEASE_NOTES-1.txt dist
echo
echo "*********************************************************************"
echo " Tagging release $release_number"
echo "*********************************************************************"
echo
hg tag -f "$release_number"
hg push # back to $RELEASE_1
############################################################################
# #
# This is where the script starts pushing the release to sourceforge. #
# #
############################################################################
echo
echo "*************************************************************************"
echo " Pushing sources to sourceforge"
echo "*************************************************************************"
echo
cd ../"$RELEASE_1"
hg push
cd ../"$PYKE"
hg push
cd ../"$PRE_2TO3_R1"
hg push
cd ../"$PRE_2TO3"
hg push
echo
echo "*********************************************************************"
echo " Copying release files to sourceforge"
echo "*********************************************************************"
echo
cd "$start_repo"
rsync -avP --delete -e ssh dist/ mtnyogi,[email protected]:/home/frs/project/p/py/pyke/pyke/"$release_number"
echo
echo "*************************************************************************"
echo " Copying HTML documentation to sourceforge"
echo "*************************************************************************"
echo
rsync -avP --delete -e ssh doc/html/ mtnyogi,[email protected]:htdocs/
echo Done!