]>
Commit | Line | Data |
---|---|---|
36e91097 RD |
1 | #!/bin/bash |
2 | # --------------------------------------------------------------------------- | |
3 | # Master build script for building all the installers and such on all the | |
4 | # build machines in my lab, and then distributing the results as needed. | |
5 | # --------------------------------------------------------------------------- | |
6 | ||
7 | set -o errexit | |
8 | #set -o xtrace | |
9 | ||
10 | # --------------------------------------------------------------------------- | |
11 | # Some control variables... | |
12 | ||
13 | # the local spot that we put everything when done, before possibly copying | |
14 | # to remote hosts | |
15 | STAGING_DIR=./BUILD | |
16 | ||
36e91097 | 17 | |
d6624155 RD |
18 | # host name of the machine to use for windows builds |
19 | WIN_HOST=beast | |
20 | # Where is the build dir from the remote machine's perspective? | |
21 | WIN_BUILD=/c/BUILD | |
36e91097 RD |
22 | |
23 | ||
d6624155 | 24 | # Just like the above |
d391b80e RD |
25 | OSX_HOST_panther=bigmac |
26 | OSX_HOST_jaguar=whopper | |
28d1454a | 27 | OSX_BUILD=/BUILD |
36e91097 RD |
28 | |
29 | ||
afbe4a55 | 30 | # Alsmost the same... See below for hosts and other info |
d6624155 | 31 | LINUX_BUILD=/tmp/BUILD |
36e91097 RD |
32 | |
33 | ||
34 | # Upload server locations | |
35 | UPLOAD_HOST=starship.python.net | |
36 | UPLOAD_DAILY_ROOT=/home/crew/robind/public_html/wxPython/daily | |
37 | UPLOAD_PREVIEW_ROOT=/home/crew/robind/public_html/wxPython/preview | |
38 | ||
39 | ||
40 | ||
41 | # --------------------------------------------------------------------------- | |
42 | # functions | |
43 | ||
44 | function usage { | |
45 | echo "" | |
46 | echo "Usage: $0 [command flags...]" | |
47 | echo "" | |
48 | echo "build types:" | |
49 | echo " dryrun Do the build, but don't copy anywhere (default)" | |
50 | echo " daily Do a daily build, copy to starship" | |
51 | echo " release Do a normal release build, copy to starship" | |
52 | echo "" | |
53 | echo "optional command flags:" | |
54 | echo " 2.2 Build for Python 2.2 (default=off)" | |
55 | echo " 2.3 Build for Python 2.3 (default=on)" | |
56 | echo " all Build for all supported Python versions" | |
57 | echo "" | |
58 | echo " skipsource Don't build the source archives, use the ones" | |
59 | echo " already in the staging dir." | |
60 | echo " onlysource Exit after building the source archives" | |
28d1454a | 61 | echo " skipdocs Don't rebuild the docs" |
36e91097 RD |
62 | echo " skipwin Don't do the remote Windows build" |
63 | echo " skiposx Don't do the remote OSX build" | |
64 | echo " skiplinux Don't do the remote Linux build" | |
65 | echo " skipclean Don't do the cleanup step on the remote builds" | |
66 | echo "" | |
67 | ||
68 | ||
69 | } | |
70 | ||
71 | # --------------------------------------------------------------------------- | |
72 | ||
73 | # Make sure we are running in the right directory. TODO: make this | |
74 | # test more robust. Currenly we just test for the presence of | |
75 | # 'wxPython' and 'wx' subdirs. | |
76 | if [ ! -d wxPython -o ! -d wx ]; then | |
77 | echo "Please run this script from the root wxPython directory." | |
78 | exit 1 | |
79 | fi | |
80 | ||
81 | ||
82 | ||
83 | # Set defaults and check the command line options | |
84 | KIND=dryrun | |
85 | PYVER=2.3 | |
86 | skipsource=no | |
87 | onlysource=no | |
28d1454a | 88 | skipdocs=no |
36e91097 RD |
89 | skipwin=no |
90 | skiposx=no | |
91 | skiplinux=no | |
92 | skipclean=no | |
93 | ||
94 | for flag in $*; do | |
95 | case $flag in | |
96 | dryrun) KIND=dryrun ;; | |
97 | daily) KIND=daily ;; | |
98 | release) KIND=release ;; | |
99 | ||
100 | 2.2) PYVER=2.2 ;; | |
101 | 2.3) PYVER=2.3 ;; | |
102 | all) PYVER="2.2 2.3" ;; | |
103 | ||
104 | skipsource) skipsource=yes ;; | |
105 | onlysource) onlysource=yes ;; | |
28d1454a | 106 | skipdocs) skipdocs=yes ;; |
36e91097 RD |
107 | skipwin) skipwin=yes ;; |
108 | skiposx) skiposx=yes ;; | |
109 | skiplinux) skiplinux=yes ;; | |
110 | skipclean) skipclean=yes ;; | |
111 | ||
112 | help) usage; exit 1 ;; | |
113 | *) echo "Unknown flag \"$flag\"" | |
114 | usage | |
115 | exit 1 | |
116 | esac | |
117 | done | |
118 | ||
119 | ||
120 | # ensure the staging area exists | |
121 | if [ ! -d $STAGING_DIR ]; then | |
122 | mkdir -p $STAGING_DIR | |
123 | fi | |
124 | ||
125 | # Figure out the wxPython version number, possibly adjusted for being a daily build | |
126 | if [ $KIND = daily ]; then | |
127 | DAILY=`date +%Y%m%d` # should it include the hour too? 2-digit year? | |
128 | echo $DAILY > DAILY_BUILD | |
129 | fi | |
130 | VERSION=`python -c "import setup;print setup.VERSION"` | |
131 | ||
132 | ||
133 | #echo VERSION=$VERSION | |
134 | #exit 0 | |
135 | ||
31c7a57a RD |
136 | echo "Getting started at " `date` |
137 | ||
36e91097 RD |
138 | # --------------------------------------------------------------------------- |
139 | # Make the sources and other basic stuff. | |
140 | ||
141 | if [ $skipsource != yes -o $onlysource = yes ]; then | |
142 | ||
143 | # clean out the local dist dir | |
144 | rm -f dist/* | |
145 | ||
28d1454a RD |
146 | if [ $skipdocs != yes ]; then |
147 | # Regenerate the reST docs | |
148 | echo "Regenerating the reST docs..." | |
149 | cd docs | |
150 | for x in *.txt; do | |
151 | docutils-html $x `basename $x .txt`.html | |
152 | done | |
153 | cd - | |
154 | ||
155 | # build the doc and demo tarballs | |
156 | distrib/makedemo | |
157 | distrib/makedocs | |
158 | ||
159 | # build the new docs too | |
160 | docs/bin/everything | |
161 | fi | |
162 | ||
163 | # make the source tarball and srpm | |
164 | distrib/makerpm 2.3 srpm | |
36e91097 RD |
165 | |
166 | # Copy everything to the staging dir | |
167 | echo "Moving stuff to $STAGING_DIR..." | |
36e91097 | 168 | mv dist/* $STAGING_DIR |
28d1454a RD |
169 | |
170 | if [ $skipdocs != yes ]; then | |
171 | for doc in CHANGES BUILD INSTALL MigrationGuide default; do | |
172 | cp docs/$doc.* $STAGING_DIR | |
173 | done | |
174 | fi | |
36e91097 RD |
175 | |
176 | # cleanup | |
177 | echo "Cleaning up..." | |
178 | rm -f dist/* | |
36e91097 RD |
179 | fi |
180 | ||
181 | if [ $KIND = daily ]; then | |
182 | rm DAILY_BUILD | |
183 | fi | |
184 | ||
185 | if [ $onlysource = yes ]; then | |
186 | exit 0 | |
187 | fi | |
188 | ||
189 | # --------------------------------------------------------------------------- | |
190 | # Windows build | |
191 | ||
192 | if [ $skipwin != yes ]; then | |
193 | echo "-=-=- Starting Windows build..." | |
194 | ||
d6624155 | 195 | echo "Copying source file and build script..." |
28d1454a | 196 | scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \ |
d6624155 RD |
197 | distrib/all/build-windows \ |
198 | $WIN_HOST:$WIN_BUILD | |
36e91097 | 199 | |
d6624155 | 200 | echo "Running build script on $WIN_HOST..." |
28d1454a | 201 | wxdir=$WIN_BUILD/wxPython-src-$VERSION |
d6624155 RD |
202 | cmd=./build-windows |
203 | ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd" | |
204 | ||
205 | echo "Fetching the results..." | |
28d1454a RD |
206 | scp $WIN_HOST:$WIN_BUILD/wxPython*-win32* $STAGING_DIR |
207 | ssh $WIN_HOST "rm $WIN_BUILD/wxPython*-win32*" | |
36e91097 RD |
208 | fi |
209 | ||
210 | ||
211 | # --------------------------------------------------------------------------- | |
212 | # OSX build | |
213 | ||
d391b80e RD |
214 | function DoOSXBuild { |
215 | local host=$1 | |
216 | local flavor=$2 | |
217 | ||
218 | # test if the target machine is online | |
219 | if ping -q -c1 -w1 $host > /dev/null; then | |
220 | echo "-----------------------------------------------------------------" | |
ba9a8985 | 221 | echo " The $host machine is online, OSX-$flavor build continuing..." |
d391b80e RD |
222 | echo "-----------------------------------------------------------------" |
223 | else | |
224 | echo "-----------------------------------------------------------------" | |
ba9a8985 | 225 | echo "The $host machine is offline, skipping the OSX-$flavor build." |
d391b80e RD |
226 | echo "-----------------------------------------------------------------" |
227 | return 0 | |
228 | fi | |
229 | ||
230 | echo "-=-=- Starting OSX-$flavor build on $host..." | |
36e91097 | 231 | |
d6624155 | 232 | echo "Copying source files and build script..." |
ba9a8985 | 233 | ssh root@$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true" |
28d1454a RD |
234 | #ssh root@$host "mkdir -p $OSX_BUILD || true" |
235 | scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \ | |
236 | $STAGING_DIR/wxPython-docs-$VERSION.tar.gz \ | |
237 | $STAGING_DIR/wxPython-demo-$VERSION.tar.gz \ | |
d6624155 | 238 | distrib/all/build-osx \ |
39d3e67e | 239 | root@$host:$OSX_BUILD |
d6624155 | 240 | |
d391b80e | 241 | echo "Running build script on $host..." |
28d1454a | 242 | wxdir=$OSX_BUILD/wxPython-src-$VERSION |
d6624155 | 243 | cmd=./build-osx |
d391b80e | 244 | ssh root@$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $PYVER && rm $cmd" |
d6624155 RD |
245 | |
246 | echo "Fetching the results..." | |
28d1454a RD |
247 | scp "root@$host:$OSX_BUILD/wxPython*-osx*" $STAGING_DIR |
248 | ssh root@$host "rm $OSX_BUILD/wxPython*-osx*" | |
d391b80e RD |
249 | |
250 | } | |
251 | ||
252 | ||
253 | if [ $skiposx != yes ]; then | |
254 | ||
255 | DoOSXBuild $OSX_HOST_panther panther | |
256 | DoOSXBuild $OSX_HOST_jaguar jaguar | |
257 | ||
36e91097 RD |
258 | fi |
259 | ||
260 | ||
261 | # --------------------------------------------------------------------------- | |
262 | # Linux build | |
263 | ||
afbe4a55 RD |
264 | # The remote Linux builds are different than those above. The source |
265 | # RPMs were already built in the source step, and so building the | |
39d3e67e RD |
266 | # binary RPMs is a very simple followup step. But then add to that |
267 | # the fact that we need to build on more than one distro... | |
afbe4a55 RD |
268 | |
269 | function DoLinuxBuild { | |
270 | local host=$1 | |
271 | local reltag=$2 | |
272 | shift;shift | |
273 | local pyver=$@ | |
274 | ||
275 | # test if the target machine is online | |
276 | if ping -q -c1 -w1 $host > /dev/null; then | |
277 | echo "-----------------------------------------------------------------" | |
278 | echo " The $host machine is online, build continuing..." | |
279 | echo "-----------------------------------------------------------------" | |
36e91097 | 280 | else |
36e91097 | 281 | echo "-----------------------------------------------------------------" |
afbe4a55 | 282 | echo "The $host machine is offline, skipping the binary RPM build." |
36e91097 | 283 | echo "-----------------------------------------------------------------" |
afbe4a55 | 284 | return 0 |
36e91097 | 285 | fi |
afbe4a55 | 286 | |
4bd19ff3 | 287 | echo "Copying source files and build script..." |
afbe4a55 | 288 | ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*" |
28d1454a | 289 | scp $STAGING_DIR/wxPython-src* $STAGING_DIR/wxPython.spec\ |
d6624155 | 290 | distrib/all/build-linux \ |
afbe4a55 | 291 | root@$host:$LINUX_BUILD |
d6624155 | 292 | |
afbe4a55 | 293 | echo "Running build script on $host..." |
d6624155 | 294 | cmd=./build-linux |
afbe4a55 | 295 | ssh root@$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver" |
36e91097 RD |
296 | |
297 | echo "Fetching the results..." | |
28d1454a RD |
298 | scp "root@$host:$LINUX_BUILD/wxPython*.i[0-9]86.rpm" $STAGING_DIR |
299 | ssh root@$host "rm $LINUX_BUILD/wxPython*.i[0-9]86.rpm" | |
afbe4a55 RD |
300 | |
301 | } | |
36e91097 | 302 | |
d391b80e | 303 | if [ $skiplinux != yes ]; then |
36e91097 | 304 | |
28d1454a RD |
305 | DoLinuxBuild co-rh9 rh9 $PYVER |
306 | DoLinuxBuild co-fc2 fc2 2.3 | |
afbe4a55 | 307 | |
d391b80e | 308 | fi |
36e91097 RD |
309 | |
310 | ||
311 | # --------------------------------------------------------------------------- | |
312 | # Final disposition of build results... | |
313 | ||
79408446 | 314 | chmod a+r $STAGING_DIR/* |
36e91097 RD |
315 | |
316 | if [ $KIND = dryrun ]; then | |
317 | # we're done | |
31c7a57a | 318 | echo "Finished at " `date` |
36e91097 RD |
319 | exit 0 |
320 | fi | |
321 | ||
322 | ||
323 | if [ $KIND = daily ]; then | |
324 | ||
79408446 | 325 | destdir=$UPLOAD_DAILY_ROOT/$DAILY |
36e91097 RD |
326 | echo "Copying to the starship at $destdir..." |
327 | ssh $UPLOAD_HOST "mkdir -p $destdir" | |
328 | scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir | |
79408446 RD |
329 | ssh $UPLOAD_HOST "cd $destdir && ls -al" |
330 | ||
36e91097 RD |
331 | |
332 | echo "Cleaning up staging dir..." | |
333 | rm $STAGING_DIR/* | |
334 | rmdir $STAGING_DIR | |
335 | ||
336 | # TODO: something to remove old builds from starship, keeping | |
337 | # only N days worth | |
338 | ||
afbe4a55 | 339 | # Send email to wxPython-dev |
71132988 RD |
340 | DATE=`date` |
341 | TO=wxPython-dev@lists.wxwidgets.org | |
342 | ||
343 | cat <<EOF | /usr/sbin/sendmail $TO | |
344 | From: R'bot <rbot@wxpython.org> | |
345 | To: $TO | |
c7be1d2a | 346 | Subject: $DAILY test build uploaded |
71132988 RD |
347 | Date: $DATE |
348 | ||
79408446 RD |
349 | Hi, |
350 | ||
351 | A new test build of wxPython has been uploaded to starship. | |
352 | ||
353 | Version: $VERSION | |
79408446 | 354 | URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY |
023a034e | 355 | Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html |
79408446 RD |
356 | |
357 | Have fun! | |
358 | R'bot | |
36e91097 | 359 | |
71132988 | 360 | EOF |
31c7a57a RD |
361 | |
362 | echo "Finished at " `date` | |
36e91097 RD |
363 | exit 0 |
364 | fi | |
365 | ||
366 | ||
367 | if [ $KIND = release ]; then | |
368 | ||
369 | echo "Copying to the local file server..." | |
370 | destdir=/stuff/Development/wxPython/dist/$VERSION | |
371 | mkdir -p $destdir | |
372 | cp $STAGING_DIR/* $destdir | |
373 | ||
374 | echo "Copying to the starship..." | |
375 | destdir=$UPLOAD_PREVIEW_ROOT/$VERSION | |
376 | ssh $UPLOAD_HOST "mkdir -p $destdir" | |
377 | scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir | |
378 | ||
379 | echo "Cleaning up staging dir..." | |
380 | rm $STAGING_DIR/* | |
381 | rmdir $STAGING_DIR | |
382 | ||
afbe4a55 RD |
383 | # Send email to wxPython-dev |
384 | DATE=`date` | |
385 | TO=wxPython-dev@lists.wxwidgets.org | |
386 | ||
387 | cat <<EOF | /usr/sbin/sendmail $TO | |
388 | From: R'bot <rbot@wxpython.org> | |
389 | To: $TO | |
c7be1d2a | 390 | Subject: $VERSION release candidate build uploaded |
afbe4a55 RD |
391 | Date: $DATE |
392 | ||
393 | Hi, | |
394 | ||
395 | A new RC build of wxPython has been uploaded to starship. | |
396 | ||
397 | Version: $VERSION | |
afbe4a55 | 398 | URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION |
023a034e | 399 | Changes: http://starship.python.net/crew/robind/wxPython/preview/$VERSION/CHANGES.html |
afbe4a55 RD |
400 | |
401 | Have fun! | |
402 | R'bot | |
403 | ||
404 | EOF | |
405 | ||
31c7a57a | 406 | echo "Finished at " `date` |
36e91097 RD |
407 | exit 0 |
408 | fi | |
409 | ||
410 | ||
411 | # --------------------------------------------------------------------------- |