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 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 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"
71 # ---------------------------------------------------------------------------
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."
83 # Set defaults and check the command line options
96 dryrun
) KIND
=dryrun
;;
98 release
) KIND
=release
;;
102 all
) PYVER
="2.2 2.3" ;;
104 skipsource
) skipsource
=yes ;;
105 onlysource
) onlysource
=yes ;;
106 skipdocs
) skipdocs
=yes ;;
107 skipwin
) skipwin
=yes ;;
108 skiposx
) skiposx
=yes ;;
109 skiplinux
) skiplinux
=yes ;;
110 skipclean
) skipclean
=yes ;;
112 help) usage
; exit 1 ;;
113 *) echo "Unknown flag \"$flag\""
120 # ensure the staging area exists
121 if [ ! -d $STAGING_DIR ]; then
122 mkdir -p $STAGING_DIR
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
130 VERSION
=`python -c "import setup;print setup.VERSION"`
133 #echo VERSION=$VERSION
136 echo "Getting started at " `date`
138 # ---------------------------------------------------------------------------
139 # Make the sources and other basic stuff.
141 if [ $skipsource != yes -o $onlysource = yes ]; then
143 # clean out the local dist dir
146 if [ $skipdocs != yes ]; then
147 # Regenerate the reST docs
148 echo "Regenerating the reST docs..."
151 docutils
-html $x `basename $x .txt`.html
155 # build the doc and demo tarballs
159 # build the new docs too
163 # make the source tarball and srpm
164 distrib
/makerpm
2.3 srpm
166 # Copy everything to the staging dir
167 echo "Moving stuff to $STAGING_DIR..."
168 mv dist
/* $STAGING_DIR
170 if [ $skipdocs != yes ]; then
171 for doc
in CHANGES BUILD INSTALL MigrationGuide default
; do
172 cp docs
/$doc.
* $STAGING_DIR
177 echo "Cleaning up..."
181 if [ $KIND = daily
]; then
185 if [ $onlysource = yes ]; then
189 # ---------------------------------------------------------------------------
192 if [ $skipwin != yes ]; then
193 echo "-=-=- Starting Windows build..."
195 echo "Copying source file and build script..."
196 scp
$STAGING_DIR/wxPython
-src-$VERSION.
tar.gz \
197 distrib
/all
/build
-windows \
200 echo "Running build script on $WIN_HOST..."
201 wxdir
=$WIN_BUILD/wxPython
-src-$VERSION
203 ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
205 echo "Fetching the results..."
206 scp
"$WIN_HOST:$WIN_BUILD/wxPython*-win32*" $STAGING_DIR
207 ssh $WIN_HOST "rm $WIN_BUILD/wxPython*-win32*"
211 # ---------------------------------------------------------------------------
214 function DoOSXBuild
{
218 # test if the target machine is online
219 if ping -q -c1 -w1 $host > /dev
/null
; then
220 echo "-----------------------------------------------------------------"
221 echo " The $host machine is online, OSX-$flavor build continuing..."
222 echo "-----------------------------------------------------------------"
224 echo "-----------------------------------------------------------------"
225 echo "The $host machine is offline, skipping the OSX-$flavor build."
226 echo "-----------------------------------------------------------------"
230 echo "-=-=- Starting OSX-$flavor build on $host..."
232 echo "Copying source files and build script..."
233 ssh root@
$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true"
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 \
238 distrib
/all
/build
-osx \
239 root@
$host:$OSX_BUILD
241 echo "Running build script on $host..."
242 wxdir
=$OSX_BUILD/wxPython
-src-$VERSION
244 ssh root@
$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $PYVER && rm $cmd"
246 echo "Fetching the results..."
247 scp
"root@$host:$OSX_BUILD/wxPython*-osx*" $STAGING_DIR
248 ssh root@
$host "rm $OSX_BUILD/wxPython*-osx*"
253 if [ $skiposx != yes ]; then
255 DoOSXBuild
$OSX_HOST_panther panther
256 DoOSXBuild
$OSX_HOST_jaguar jaguar
261 # ---------------------------------------------------------------------------
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
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...
269 function DoLinuxBuild
{
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 "-----------------------------------------------------------------"
281 echo "-----------------------------------------------------------------"
282 echo "The $host machine is offline, skipping the binary RPM build."
283 echo "-----------------------------------------------------------------"
287 echo "Copying source files and build script..."
288 ssh root@
$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
289 scp
$STAGING_DIR/wxPython
-src* $STAGING_DIR/wxPython.spec\
290 distrib
/all
/build
-linux \
291 root@
$host:$LINUX_BUILD
293 echo "Running build script on $host..."
295 ssh root@
$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver"
297 echo "Fetching the results..."
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"
303 if [ $skiplinux != yes ]; then
305 DoLinuxBuild co
-rh9 rh9
$PYVER
306 DoLinuxBuild co
-fc2 fc2
2.3
311 # ---------------------------------------------------------------------------
312 # Final disposition of build results...
314 chmod a
+r
$STAGING_DIR/*
316 if [ $KIND = dryrun
]; then
318 echo "Finished at " `date`
323 if [ $KIND = daily
]; then
325 destdir
=$UPLOAD_DAILY_ROOT/$DAILY
326 echo "Copying to the starship at $destdir..."
327 ssh $UPLOAD_HOST "mkdir -p $destdir"
328 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
329 ssh $UPLOAD_HOST "cd $destdir && ls -al"
332 echo "Cleaning up staging dir..."
336 # TODO: something to remove old builds from starship, keeping
339 # Send email to wxPython-dev
341 TO
=wxPython
-dev@lists.wxwidgets.org
343 cat <<EOF | /usr/sbin/sendmail $TO
344 From: R'bot <rbot@wxpython.org>
346 Subject: $DAILY test build uploaded
351 A new test build of wxPython has been uploaded to starship.
354 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
355 Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html
362 echo "Finished at " `date`
367 if [ $KIND = release
]; then
369 echo "Copying to the local file server..."
370 destdir
=/stuff
/Development
/wxPython
/dist
/$VERSION
372 cp $STAGING_DIR/* $destdir
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
379 echo "Cleaning up staging dir..."
383 # Send email to wxPython-dev
385 TO
=wxPython
-dev@lists.wxwidgets.org
387 cat <<EOF | /usr/sbin/sendmail $TO
388 From: R'bot <rbot@wxpython.org>
390 Subject: $VERSION release candidate build uploaded
395 A new RC build of wxPython has been uploaded to starship.
398 URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION
399 Changes: http://starship.python.net/crew/robind/wxPython/preview/$VERSION/CHANGES.html
406 echo "Finished at " `date`
411 # ---------------------------------------------------------------------------