]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/all/build-all
in unescape add normal characters in addition to unescaped characters :)
[wxWidgets.git] / wxPython / distrib / all / build-all
CommitLineData
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
7set -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
15STAGING_DIR=./BUILD
16
36e91097 17
d6624155
RD
18# host name of the machine to use for windows builds
19WIN_HOST=beast
20# Where is the build dir from the remote machine's perspective?
21WIN_BUILD=/c/BUILD
36e91097
RD
22
23
d6624155 24# Just like the above
d391b80e
RD
25OSX_HOST_panther=bigmac
26OSX_HOST_jaguar=whopper
28d1454a 27OSX_BUILD=/BUILD
36e91097
RD
28
29
afbe4a55 30# Alsmost the same... See below for hosts and other info
d6624155 31LINUX_BUILD=/tmp/BUILD
36e91097
RD
32
33
34# Upload server locations
35UPLOAD_HOST=starship.python.net
36UPLOAD_DAILY_ROOT=/home/crew/robind/public_html/wxPython/daily
37UPLOAD_PREVIEW_ROOT=/home/crew/robind/public_html/wxPython/preview
38
39
40
41# ---------------------------------------------------------------------------
42# functions
43
44function 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"
7dc107d6 51 echo " release Do a normal release (cantidate) build, copy to starship"
36e91097
RD
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."
38d45b10 60 echo " onlysource Exit after building the source and docs 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"
7dc107d6 66 echo " skipupload Don't upload the builds to starship"
ad65aea8 67 echo " parallel parallelize the builds where possible"
36e91097 68 echo ""
ad65aea8
RD
69}
70
36e91097
RD
71
72
ad65aea8
RD
73function PrefixLines {
74 label=$1
75 tee tmp/$label.log | awk "{ print \"** $label: \" \$0; fflush(); }"
36e91097
RD
76}
77
78# ---------------------------------------------------------------------------
79
80# Make sure we are running in the right directory. TODO: make this
81# test more robust. Currenly we just test for the presence of
82# 'wxPython' and 'wx' subdirs.
83if [ ! -d wxPython -o ! -d wx ]; then
84 echo "Please run this script from the root wxPython directory."
85 exit 1
86fi
87
88
89
90# Set defaults and check the command line options
91KIND=dryrun
92PYVER=2.3
93skipsource=no
94onlysource=no
28d1454a 95skipdocs=no
36e91097
RD
96skipwin=no
97skiposx=no
98skiplinux=no
99skipclean=no
7dc107d6 100skipupload=no
ad65aea8 101parallel=no
36e91097
RD
102
103for flag in $*; do
104 case $flag in
105 dryrun) KIND=dryrun ;;
106 daily) KIND=daily ;;
107 release) KIND=release ;;
108
109 2.2) PYVER=2.2 ;;
110 2.3) PYVER=2.3 ;;
111 all) PYVER="2.2 2.3" ;;
112
113 skipsource) skipsource=yes ;;
114 onlysource) onlysource=yes ;;
28d1454a 115 skipdocs) skipdocs=yes ;;
36e91097
RD
116 skipwin) skipwin=yes ;;
117 skiposx) skiposx=yes ;;
118 skiplinux) skiplinux=yes ;;
119 skipclean) skipclean=yes ;;
7dc107d6 120 skipupload) skipupload=yes ;;
ad65aea8
RD
121 parallel) parallel=yes ;;
122 noparallel) parallel=no ;;
36e91097
RD
123
124 help) usage; exit 1 ;;
125 *) echo "Unknown flag \"$flag\""
126 usage
127 exit 1
128 esac
129done
130
131
132# ensure the staging area exists
133if [ ! -d $STAGING_DIR ]; then
134 mkdir -p $STAGING_DIR
135fi
136
137# Figure out the wxPython version number, possibly adjusted for being a daily build
138if [ $KIND = daily ]; then
139 DAILY=`date +%Y%m%d` # should it include the hour too? 2-digit year?
140 echo $DAILY > DAILY_BUILD
141fi
142VERSION=`python -c "import setup;print setup.VERSION"`
143
144
145#echo VERSION=$VERSION
146#exit 0
147
38d45b10 148
31c7a57a
RD
149echo "Getting started at " `date`
150
36e91097
RD
151# ---------------------------------------------------------------------------
152# Make the sources and other basic stuff.
153
154if [ $skipsource != yes -o $onlysource = yes ]; then
155
156 # clean out the local dist dir
157 rm -f dist/*
158
28d1454a
RD
159 if [ $skipdocs != yes ]; then
160 # Regenerate the reST docs
161 echo "Regenerating the reST docs..."
162 cd docs
163 for x in *.txt; do
164 docutils-html $x `basename $x .txt`.html
165 done
166 cd -
167
168 # build the doc and demo tarballs
169 distrib/makedemo
170 distrib/makedocs
171
172 # build the new docs too
173 docs/bin/everything
174 fi
175
176 # make the source tarball and srpm
177 distrib/makerpm 2.3 srpm
36e91097
RD
178
179 # Copy everything to the staging dir
180 echo "Moving stuff to $STAGING_DIR..."
36e91097 181 mv dist/* $STAGING_DIR
28d1454a
RD
182
183 if [ $skipdocs != yes ]; then
184 for doc in CHANGES BUILD INSTALL MigrationGuide default; do
185 cp docs/$doc.* $STAGING_DIR
186 done
187 fi
36e91097
RD
188
189 # cleanup
190 echo "Cleaning up..."
191 rm -f dist/*
36e91097
RD
192fi
193
194if [ $KIND = daily ]; then
195 rm DAILY_BUILD
196fi
197
198if [ $onlysource = yes ]; then
199 exit 0
200fi
201
202# ---------------------------------------------------------------------------
203# Windows build
204
ad65aea8
RD
205function DoWindowsBuild {
206 set -o errexit
207
208 # test if the target machine is online
209 if ping -q -c1 -w1 $WIN_HOST > /dev/null; then
210 echo "-----------------------------------------------------------------"
211 echo " The $WIN_HOST machine is online, Windows build continuing..."
212 echo "-----------------------------------------------------------------"
213 else
214 echo "-----------------------------------------------------------------"
215 echo "The $WIN_HOST machine is offline, skipping the Windows build."
216 echo "-----------------------------------------------------------------"
217 return 0
218 fi
36e91097
RD
219 echo "-=-=- Starting Windows build..."
220
d6624155 221 echo "Copying source file and build script..."
28d1454a 222 scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \
d6624155
RD
223 distrib/all/build-windows \
224 $WIN_HOST:$WIN_BUILD
36e91097 225
d6624155 226 echo "Running build script on $WIN_HOST..."
28d1454a 227 wxdir=$WIN_BUILD/wxPython-src-$VERSION
d6624155
RD
228 cmd=./build-windows
229 ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
230
231 echo "Fetching the results..."
bceb17b2 232 scp "$WIN_HOST:$WIN_BUILD/wxPython*-win32*" $STAGING_DIR
28d1454a 233 ssh $WIN_HOST "rm $WIN_BUILD/wxPython*-win32*"
ad65aea8
RD
234}
235
236if [ $skipwin != yes ]; then
237 if [ $parallel = no ]; then
238 DoWindowsBuild
239 else
240 DoWindowsBuild 2>&1 | PrefixLines $WIN_HOST &
241 winPID=$!
242 fi
36e91097
RD
243fi
244
245
246# ---------------------------------------------------------------------------
247# OSX build
248
d391b80e
RD
249function DoOSXBuild {
250 local host=$1
251 local flavor=$2
252
ad65aea8
RD
253 set -o errexit
254
d391b80e
RD
255 # test if the target machine is online
256 if ping -q -c1 -w1 $host > /dev/null; then
257 echo "-----------------------------------------------------------------"
ba9a8985 258 echo " The $host machine is online, OSX-$flavor build continuing..."
d391b80e
RD
259 echo "-----------------------------------------------------------------"
260 else
261 echo "-----------------------------------------------------------------"
ba9a8985 262 echo "The $host machine is offline, skipping the OSX-$flavor build."
d391b80e
RD
263 echo "-----------------------------------------------------------------"
264 return 0
265 fi
266
267 echo "-=-=- Starting OSX-$flavor build on $host..."
36e91097 268
d6624155 269 echo "Copying source files and build script..."
ba9a8985 270 ssh root@$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true"
28d1454a
RD
271 #ssh root@$host "mkdir -p $OSX_BUILD || true"
272 scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \
273 $STAGING_DIR/wxPython-docs-$VERSION.tar.gz \
274 $STAGING_DIR/wxPython-demo-$VERSION.tar.gz \
d6624155 275 distrib/all/build-osx \
39d3e67e 276 root@$host:$OSX_BUILD
d6624155 277
d391b80e 278 echo "Running build script on $host..."
28d1454a 279 wxdir=$OSX_BUILD/wxPython-src-$VERSION
d6624155 280 cmd=./build-osx
d391b80e 281 ssh root@$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $PYVER && rm $cmd"
d6624155
RD
282
283 echo "Fetching the results..."
28d1454a
RD
284 scp "root@$host:$OSX_BUILD/wxPython*-osx*" $STAGING_DIR
285 ssh root@$host "rm $OSX_BUILD/wxPython*-osx*"
d391b80e
RD
286
287}
288
289
290if [ $skiposx != yes ]; then
ad65aea8
RD
291 if [ $parallel = no ]; then
292 DoOSXBuild $OSX_HOST_jaguar jaguar
293 DoOSXBuild $OSX_HOST_panther panther
294 else
295 DoOSXBuild $OSX_HOST_jaguar jaguar 2>&1 | PrefixLines $OSX_HOST_jaguar &
296 DoOSXBuild $OSX_HOST_panther panther 2>&1 | PrefixLines $OSX_HOST_panther &
297 fi
36e91097
RD
298fi
299
300
ad65aea8 301
36e91097
RD
302# ---------------------------------------------------------------------------
303# Linux build
304
afbe4a55
RD
305# The remote Linux builds are different than those above. The source
306# RPMs were already built in the source step, and so building the
39d3e67e
RD
307# binary RPMs is a very simple followup step. But then add to that
308# the fact that we need to build on more than one distro...
afbe4a55 309
ad65aea8
RD
310
311
afbe4a55
RD
312function DoLinuxBuild {
313 local host=$1
314 local reltag=$2
315 shift;shift
316 local pyver=$@
317
ad65aea8
RD
318 set -o errexit
319
afbe4a55
RD
320 # test if the target machine is online
321 if ping -q -c1 -w1 $host > /dev/null; then
322 echo "-----------------------------------------------------------------"
323 echo " The $host machine is online, build continuing..."
324 echo "-----------------------------------------------------------------"
36e91097 325 else
36e91097 326 echo "-----------------------------------------------------------------"
afbe4a55 327 echo "The $host machine is offline, skipping the binary RPM build."
36e91097 328 echo "-----------------------------------------------------------------"
afbe4a55 329 return 0
36e91097 330 fi
afbe4a55 331
4bd19ff3 332 echo "Copying source files and build script..."
afbe4a55 333 ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
28d1454a 334 scp $STAGING_DIR/wxPython-src* $STAGING_DIR/wxPython.spec\
d6624155 335 distrib/all/build-linux \
afbe4a55 336 root@$host:$LINUX_BUILD
d6624155 337
afbe4a55 338 echo "Running build script on $host..."
d6624155 339 cmd=./build-linux
afbe4a55 340 ssh root@$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver"
36e91097
RD
341
342 echo "Fetching the results..."
28d1454a
RD
343 scp "root@$host:$LINUX_BUILD/wxPython*.i[0-9]86.rpm" $STAGING_DIR
344 ssh root@$host "rm $LINUX_BUILD/wxPython*.i[0-9]86.rpm"
afbe4a55
RD
345
346}
36e91097 347
ad65aea8
RD
348
349
350
d391b80e 351if [ $skiplinux != yes ]; then
36e91097 352
ad65aea8
RD
353 if [ $parallel = no ]; then
354 DoLinuxBuild co-rh9 rh9 $PYVER
355 DoLinuxBuild co-fc2 fc2 2.3
356 DoLinuxBuild co-mdk92 mdk92 2.3
357 DoLinuxBuild co-mdk101 mdk101 2.3
358 else
359
360 # Since the linux builds are currently done in coLinux
361 # 'machines' running on the WIN_HOST let's wait for the
362 # windows build to be done before launching them
afbe4a55 363
ad65aea8
RD
364 #if [ -n $winPID ]; then
365 # wait $winPID
366 #fi
367
368 (DoLinuxBuild co-rh9 rh9 $PYVER 2>&1 | PrefixLines co-rh9 &; \
369 DoLinuxBuild co-fc2 fc2 2.3 2>&1 | PrefixLines co-fc2 ) &
370
371 wait $! # wait for the previous two to complete before starting the next two
372
373 (DoLinuxBuild co-mdk92 mdk92 2.3 2>&1 | PrefixLines co-mdk92 &; \
374 DoLinuxBuild co-mdk101 mdk101 2.3 2>&1 | PrefixLines co-mdk101 ) &
375 fi
d391b80e 376fi
36e91097
RD
377
378
ad65aea8
RD
379# ---------------------------------------------------------------------------
380
381if [ $parallel = yes ]; then
382
383 # TODO: Figure out how to test if all the builds were successful
384
385 echo "***********************************"
386 echo " Waiting for builds to complete... "
387 echo "***********************************"
388 wait
389fi
390
36e91097
RD
391# ---------------------------------------------------------------------------
392# Final disposition of build results...
393
79408446 394chmod a+r $STAGING_DIR/*
36e91097
RD
395
396if [ $KIND = dryrun ]; then
397 # we're done
31c7a57a 398 echo "Finished at " `date`
36e91097
RD
399 exit 0
400fi
401
402
403if [ $KIND = daily ]; then
404
5df4dd4b
RD
405 echo "Copying to the local file server..."
406 destdir=/stuff/temp/$VERSION
407 mkdir -p $destdir
408 cp $STAGING_DIR/* $destdir
409
38d45b10 410 if [ $skipupload != yes ]; then
7dc107d6
RD
411 destdir=$UPLOAD_DAILY_ROOT/$DAILY
412 echo "Copying to the starship at $destdir..."
413 ssh $UPLOAD_HOST "mkdir -p $destdir"
414 scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
415 ssh $UPLOAD_HOST "cd $destdir && ls -al"
79408446 416
36e91097 417
7dc107d6
RD
418 # TODO: something to remove old builds from starship, keeping
419 # only N days worth
36e91097 420
7dc107d6
RD
421 # Send email to wxPython-dev
422 DATE=`date`
423 TO=wxPython-dev@lists.wxwidgets.org
36e91097 424
7dc107d6 425 cat <<EOF | /usr/sbin/sendmail $TO
71132988
RD
426From: R'bot <rbot@wxpython.org>
427To: $TO
c7be1d2a 428Subject: $DAILY test build uploaded
71132988
RD
429Date: $DATE
430
79408446
RD
431Hi,
432
433A new test build of wxPython has been uploaded to starship.
434
435 Version: $VERSION
79408446 436 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
023a034e 437 Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html
79408446
RD
438
439Have fun!
440R'bot
36e91097 441
71132988 442EOF
7dc107d6
RD
443 fi
444
445 echo "Cleaning up staging dir..."
446 rm $STAGING_DIR/*
447 rmdir $STAGING_DIR
31c7a57a
RD
448
449 echo "Finished at " `date`
36e91097
RD
450 exit 0
451fi
452
453
454if [ $KIND = release ]; then
455
456 echo "Copying to the local file server..."
457 destdir=/stuff/Development/wxPython/dist/$VERSION
458 mkdir -p $destdir
459 cp $STAGING_DIR/* $destdir
460
38d45b10 461 if [ $skipupload != yes ]; then
7dc107d6
RD
462 echo "Copying to the starship..."
463 destdir=$UPLOAD_PREVIEW_ROOT/$VERSION
464 ssh $UPLOAD_HOST "mkdir -p $destdir"
465 scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
36e91097 466
7dc107d6
RD
467 # Send email to wxPython-dev
468 DATE=`date`
469 TO=wxPython-dev@lists.wxwidgets.org
afbe4a55 470
7dc107d6 471 cat <<EOF | /usr/sbin/sendmail $TO
afbe4a55
RD
472From: R'bot <rbot@wxpython.org>
473To: $TO
c7be1d2a 474Subject: $VERSION release candidate build uploaded
afbe4a55
RD
475Date: $DATE
476
477Hi,
478
479A new RC build of wxPython has been uploaded to starship.
480
481 Version: $VERSION
afbe4a55 482 URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION
023a034e 483 Changes: http://starship.python.net/crew/robind/wxPython/preview/$VERSION/CHANGES.html
afbe4a55
RD
484
485Have fun!
486R'bot
487
488EOF
489
7dc107d6
RD
490 fi
491
492 echo "Cleaning up staging dir..."
493 rm $STAGING_DIR/*
494 rmdir $STAGING_DIR
495
31c7a57a 496 echo "Finished at " `date`
36e91097
RD
497 exit 0
498fi
499
500
501# ---------------------------------------------------------------------------