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 # ---------------------------------------------------------------------------
10 # ---------------------------------------------------------------------------
11 # Some control variables...
13 # the local spot that we put everything when done, before possibly copying
18 # host name of the machine to use for windows builds
20 # Where is the build dir from the remote machine's perspective?
25 OSX_HOST_panther
=bigmac
26 OSX_HOST_jaguar
=whopper
30 # Alsmost the same... See below for hosts and other info
31 LINUX_BUILD
=/tmp
/BUILD
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
41 # ---------------------------------------------------------------------------
46 echo "Usage: $0 [command flags...]"
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 (cantidate) build, copy to starship"
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"
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 and docs archives"
61 echo " skipdocs Don't rebuild the docs"
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 " skipupload Don't upload the builds to starship"
67 echo " parallel parallelize the builds where possible"
73 function PrefixLines
{
75 tee tmp
/$label.log
| awk "{ print \"** $label: \" \$0; fflush(); }"
78 # ---------------------------------------------------------------------------
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.
83 if [ ! -d wxPython
-o ! -d wx
]; then
84 echo "Please run this script from the root wxPython directory."
90 # Set defaults and check the command line options
105 dryrun
) KIND
=dryrun
;;
107 release
) KIND
=release
;;
111 all
) PYVER
="2.2 2.3" ;;
113 skipsource
) skipsource
=yes ;;
114 onlysource
) onlysource
=yes ;;
115 skipdocs
) skipdocs
=yes ;;
116 skipwin
) skipwin
=yes ;;
117 skiposx
) skiposx
=yes ;;
118 skiplinux
) skiplinux
=yes ;;
119 skipclean
) skipclean
=yes ;;
120 skipupload
) skipupload
=yes ;;
121 parallel
) parallel
=yes ;;
122 noparallel
) parallel
=no
;;
124 help) usage
; exit 1 ;;
125 *) echo "Unknown flag \"$flag\""
132 # ensure the staging area exists
133 if [ ! -d $STAGING_DIR ]; then
134 mkdir -p $STAGING_DIR
137 # Figure out the wxPython version number, possibly adjusted for being a daily build
138 if [ $KIND = daily
]; then
139 DAILY
=`date +%Y%m%d` # should it include the hour too? 2-digit year?
140 echo $DAILY > DAILY_BUILD
142 VERSION
=`python -c "import setup;print setup.VERSION"`
145 #echo VERSION=$VERSION
149 echo "Getting started at " `date`
151 # ---------------------------------------------------------------------------
152 # Make the sources and other basic stuff.
154 if [ $skipsource != yes -o $onlysource = yes ]; then
156 # clean out the local dist dir
159 if [ $skipdocs != yes ]; then
160 # Regenerate the reST docs
161 echo "Regenerating the reST docs..."
164 docutils
-html $x `basename $x .txt`.html
168 # build the doc and demo tarballs
172 # build the new docs too
176 # make the source tarball and srpm
177 distrib
/makerpm
2.3 srpm
179 # Copy everything to the staging dir
180 echo "Moving stuff to $STAGING_DIR..."
181 mv dist
/* $STAGING_DIR
183 if [ $skipdocs != yes ]; then
184 for doc
in CHANGES BUILD INSTALL MigrationGuide default
; do
185 cp docs
/$doc.
* $STAGING_DIR
190 echo "Cleaning up..."
194 if [ $KIND = daily
]; then
198 if [ $onlysource = yes ]; then
202 # ---------------------------------------------------------------------------
205 function DoWindowsBuild
{
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 "-----------------------------------------------------------------"
214 echo "-----------------------------------------------------------------"
215 echo "The $WIN_HOST machine is offline, skipping the Windows build."
216 echo "-----------------------------------------------------------------"
219 echo "-=-=- Starting Windows build..."
221 echo "Copying source file and build script..."
222 scp
$STAGING_DIR/wxPython
-src-$VERSION.
tar.gz \
223 distrib
/all
/build
-windows \
226 echo "Running build script on $WIN_HOST..."
227 wxdir
=$WIN_BUILD/wxPython
-src-$VERSION
229 ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
231 echo "Fetching the results..."
232 scp
"$WIN_HOST:$WIN_BUILD/wxPython*-win32*" $STAGING_DIR
233 ssh $WIN_HOST "rm $WIN_BUILD/wxPython*-win32*"
236 if [ $skipwin != yes ]; then
237 if [ $parallel = no
]; then
240 DoWindowsBuild
2>&1 | PrefixLines
$WIN_HOST &
246 # ---------------------------------------------------------------------------
249 function DoOSXBuild
{
255 # test if the target machine is online
256 if ping -q -c1 -w1 $host > /dev
/null
; then
257 echo "-----------------------------------------------------------------"
258 echo " The $host machine is online, OSX-$flavor build continuing..."
259 echo "-----------------------------------------------------------------"
261 echo "-----------------------------------------------------------------"
262 echo "The $host machine is offline, skipping the OSX-$flavor build."
263 echo "-----------------------------------------------------------------"
267 echo "-=-=- Starting OSX-$flavor build on $host..."
269 echo "Copying source files and build script..."
270 ssh root@
$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true"
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 \
275 distrib
/all
/build
-osx \
276 root@
$host:$OSX_BUILD
278 echo "Running build script on $host..."
279 wxdir
=$OSX_BUILD/wxPython
-src-$VERSION
281 ssh root@
$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $PYVER && rm $cmd"
283 echo "Fetching the results..."
284 scp
"root@$host:$OSX_BUILD/wxPython*-osx*" $STAGING_DIR
285 ssh root@
$host "rm $OSX_BUILD/wxPython*-osx*"
290 if [ $skiposx != yes ]; then
291 if [ $parallel = no
]; then
292 DoOSXBuild
$OSX_HOST_jaguar jaguar
293 DoOSXBuild
$OSX_HOST_panther panther
295 DoOSXBuild
$OSX_HOST_jaguar jaguar
2>&1 | PrefixLines
$OSX_HOST_jaguar &
296 DoOSXBuild
$OSX_HOST_panther panther
2>&1 | PrefixLines
$OSX_HOST_panther &
302 # ---------------------------------------------------------------------------
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
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...
312 function DoLinuxBuild
{
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 "-----------------------------------------------------------------"
326 echo "-----------------------------------------------------------------"
327 echo "The $host machine is offline, skipping the binary RPM build."
328 echo "-----------------------------------------------------------------"
332 echo "Copying source files and build script..."
333 ssh root@
$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
334 scp
$STAGING_DIR/wxPython
-src* $STAGING_DIR/wxPython.spec\
335 distrib
/all
/build
-linux \
336 root@
$host:$LINUX_BUILD
338 echo "Running build script on $host..."
340 ssh root@
$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver"
342 echo "Fetching the results..."
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"
351 if [ $skiplinux != yes ]; then
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
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
364 #if [ -n $winPID ]; then
368 (DoLinuxBuild co
-rh9 rh9
$PYVER 2>&1 | PrefixLines co
-rh9 &; \
369 DoLinuxBuild co
-fc2 fc2
2.3 2>&1 | PrefixLines co
-fc2 ) &
371 wait $
! # wait for the previous two to complete before starting the next two
373 (DoLinuxBuild co
-mdk92 mdk92
2.3 2>&1 | PrefixLines co
-mdk92 &; \
374 DoLinuxBuild co
-mdk101 mdk101
2.3 2>&1 | PrefixLines co
-mdk101 ) &
379 # ---------------------------------------------------------------------------
381 if [ $parallel = yes ]; then
383 # TODO: Figure out how to test if all the builds were successful
385 echo "***********************************"
386 echo " Waiting for builds to complete... "
387 echo "***********************************"
391 # ---------------------------------------------------------------------------
392 # Final disposition of build results...
394 chmod a
+r
$STAGING_DIR/*
396 if [ $KIND = dryrun
]; then
398 echo "Finished at " `date`
403 if [ $KIND = daily
]; then
405 echo "Copying to the local file server..."
406 destdir
=/stuff
/temp
/$VERSION
408 cp $STAGING_DIR/* $destdir
410 if [ $skipupload != yes ]; then
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"
418 # TODO: something to remove old builds from starship, keeping
421 # Send email to wxPython-dev
423 TO
=wxPython
-dev@lists.wxwidgets.org
425 cat <<EOF | /usr/sbin/sendmail $TO
426 From: R'bot <rbot@wxpython.org>
428 Subject: $DAILY test build uploaded
433 A new test build of wxPython has been uploaded to starship.
436 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
437 Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html
445 echo "Cleaning up staging dir..."
449 echo "Finished at " `date`
454 if [ $KIND = release
]; then
456 echo "Copying to the local file server..."
457 destdir
=/stuff
/Development
/wxPython
/dist
/$VERSION
459 cp $STAGING_DIR/* $destdir
461 if [ $skipupload != yes ]; then
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
467 # Send email to wxPython-dev
469 TO
=wxPython
-dev@lists.wxwidgets.org
471 cat <<EOF | /usr/sbin/sendmail $TO
472 From: R'bot <rbot@wxpython.org>
474 Subject: $VERSION release candidate build uploaded
479 A new RC build of wxPython has been uploaded to starship.
482 URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION
483 Changes: http://starship.python.net/crew/robind/wxPython/preview/$VERSION/CHANGES.html
492 echo "Cleaning up staging dir..."
496 echo "Finished at " `date`
501 # ---------------------------------------------------------------------------