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?
29 # Alsmost the same... See below for hosts and other info
30 LINUX_BUILD
=/tmp
/BUILD
33 # Upload server locations
34 UPLOAD_HOST
=starship.python.net
35 UPLOAD_DAILY_ROOT
=/home
/crew
/robind
/public_html
/wxPython
/daily
36 UPLOAD_PREVIEW_ROOT
=/home
/crew
/robind
/public_html
/wxPython
/preview
40 # ---------------------------------------------------------------------------
45 echo "Usage: $0 [command flags...]"
48 echo " dryrun Do the build, but don't copy anywhere (default)"
49 echo " daily Do a daily build, copy to starship"
50 echo " release Do a normal release build, copy to starship"
52 echo "optional command flags:"
53 echo " 2.2 Build for Python 2.2 (default=off)"
54 echo " 2.3 Build for Python 2.3 (default=on)"
55 echo " all Build for all supported Python versions"
57 echo " skipsource Don't build the source archives, use the ones"
58 echo " already in the staging dir."
59 echo " onlysource Exit after building the source archives"
60 echo " skipwin Don't do the remote Windows build"
61 echo " skiposx Don't do the remote OSX build"
62 echo " skiplinux Don't do the remote Linux build"
63 echo " skipclean Don't do the cleanup step on the remote builds"
69 # ---------------------------------------------------------------------------
71 # Make sure we are running in the right directory. TODO: make this
72 # test more robust. Currenly we just test for the presence of
73 # 'wxPython' and 'wx' subdirs.
74 if [ ! -d wxPython
-o ! -d wx
]; then
75 echo "Please run this script from the root wxPython directory."
81 # Set defaults and check the command line options
93 dryrun
) KIND
=dryrun
;;
95 release
) KIND
=release
;;
99 all
) PYVER
="2.2 2.3" ;;
101 skipsource
) skipsource
=yes ;;
102 onlysource
) onlysource
=yes ;;
103 skipwin
) skipwin
=yes ;;
104 skiposx
) skiposx
=yes ;;
105 skiplinux
) skiplinux
=yes ;;
106 skipclean
) skipclean
=yes ;;
108 help) usage
; exit 1 ;;
109 *) echo "Unknown flag \"$flag\""
116 # ensure the staging area exists
117 if [ ! -d $STAGING_DIR ]; then
118 mkdir -p $STAGING_DIR
121 # Figure out the wxPython version number, possibly adjusted for being a daily build
122 if [ $KIND = daily
]; then
123 DAILY
=`date +%Y%m%d` # should it include the hour too? 2-digit year?
124 echo $DAILY > DAILY_BUILD
126 VERSION
=`python -c "import setup;print setup.VERSION"`
129 #echo VERSION=$VERSION
132 echo "Getting started at " `date`
134 # ---------------------------------------------------------------------------
135 # Make the sources and other basic stuff.
137 if [ $skipsource != yes -o $onlysource = yes ]; then
139 # clean out the local dist dir
142 # Regenerate the reST docs
143 echo "Regenerating the reST docs..."
146 docutils
-html $x `basename $x .txt`.html
150 # build the doc and demo tarballs
154 # build the new docs too
157 # make the source tarball
158 distrib
/makerpm
2.3 skipclean skiprpm gtk2
160 # make the source RPMs
161 for ver
in $PYVER; do
162 distrib
/makerpm
$ver skipclean skipcopy skiptar srpm
163 distrib
/makerpm
$ver skipclean skipcopy skiptar srpm gtk2
166 # Copy everything to the staging dir
167 echo "Moving stuff to $STAGING_DIR..."
169 mv dist
/* $STAGING_DIR
170 for doc
in CHANGES BUILD INSTALL MigrationGuide default
; do
171 cp docs
/$doc.
* $STAGING_DIR
175 echo "Cleaning up..."
180 if [ $KIND = daily
]; then
184 if [ $onlysource = yes ]; then
188 # ---------------------------------------------------------------------------
191 if [ $skipwin != yes ]; then
192 echo "-=-=- Starting Windows build..."
194 echo "Copying source file and build script..."
195 scp
$STAGING_DIR/wxPythonSrc
-$VERSION.
tar.gz \
196 distrib
/all
/build
-windows \
199 echo "Running build script on $WIN_HOST..."
200 wxdir
=$WIN_BUILD/wxPythonSrc
-$VERSION
202 ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
204 echo "Fetching the results..."
205 scp
$WIN_HOST:$WIN_BUILD/wxPythonWIN32
* $STAGING_DIR
206 ssh $WIN_HOST "rm $WIN_BUILD/wxPythonWIN32*"
210 # ---------------------------------------------------------------------------
213 if [ $skiposx != yes ]; then
214 echo "-=-=- Starting OSX build..."
216 echo "Copying source files and build script..."
217 ssh $OSX_HOST "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/*"
218 scp
$STAGING_DIR/wxPythonSrc
-$VERSION.
tar.gz \
219 $STAGING_DIR/wxPythonDocs
-$VERSION.
tar.gz \
220 $STAGING_DIR/wxPythonDemo
-$VERSION.
tar.gz \
221 distrib
/all
/build
-osx \
224 echo "Running build script on $OSX_HOST..."
225 wxdir
=$OSX_BUILD/wxPythonSrc
-$VERSION
227 ssh root@
$OSX_HOST "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $PYVER && rm $cmd"
229 echo "Fetching the results..."
230 scp
"$OSX_HOST:$OSX_BUILD/wxPythonOSX*" $STAGING_DIR
231 ssh $OSX_HOST "rm $OSX_BUILD/wxPythonOSX*"
235 # ---------------------------------------------------------------------------
238 # The remote Linux builds are different than those above. The source
239 # RPMs were already built in the source step, and so building the
240 # binary RPMs is a very simple followup step. Add to that the fact
241 # that we need to build on more than one distro...
243 function DoLinuxBuild
{
249 # test if the target machine is online
250 if ping -q -c1 -w1 $host > /dev
/null
; then
251 echo "-----------------------------------------------------------------"
252 echo " The $host machine is online, build continuing..."
253 echo "-----------------------------------------------------------------"
255 echo "-----------------------------------------------------------------"
256 echo "The $host machine is offline, skipping the binary RPM build."
257 echo "-----------------------------------------------------------------"
261 echo "Copying source files and build script..."
262 ssh root@
$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
263 scp
$STAGING_DIR/wxPython
*.src.rpm \
264 distrib
/all
/build
-linux \
265 root@
$host:$LINUX_BUILD
267 echo "Running build script on $host..."
269 ssh root@
$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver"
271 echo "Fetching the results..."
272 scp
"root@$host:$LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm" $STAGING_DIR
273 ssh root@
$host "rm $LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm"
278 DoLinuxBuild co
-rh9 RH9
$PYVER
279 DoLinuxBuild co
-fc2 FC2
2.3
283 # ---------------------------------------------------------------------------
284 # Final disposition of build results...
286 chmod a
+r
$STAGING_DIR/*
288 if [ $KIND = dryrun
]; then
290 echo "Finished at " `date`
295 if [ $KIND = daily
]; then
297 destdir
=$UPLOAD_DAILY_ROOT/$DAILY
298 echo "Copying to the starship at $destdir..."
299 ssh $UPLOAD_HOST "mkdir -p $destdir"
300 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
301 ssh $UPLOAD_HOST "cd $destdir && ls -al"
304 echo "Cleaning up staging dir..."
308 # TODO: something to remove old builds from starship, keeping
311 # Send email to wxPython-dev
313 TO
=wxPython
-dev@lists.wxwidgets.org
315 cat <<EOF | /usr/sbin/sendmail $TO
316 From: R'bot <rbot@wxpython.org>
318 Subject: New test build uploaded
323 A new test build of wxPython has been uploaded to starship.
327 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
334 echo "Finished at " `date`
339 if [ $KIND = release
]; then
341 echo "Copying to the local file server..."
342 destdir
=/stuff
/Development
/wxPython
/dist
/$VERSION
344 cp $STAGING_DIR/* $destdir
346 echo "Copying to the starship..."
347 destdir
=$UPLOAD_PREVIEW_ROOT/$VERSION
348 ssh $UPLOAD_HOST "mkdir -p $destdir"
349 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
351 echo "Cleaning up staging dir..."
355 # Send email to wxPython-dev
357 TO
=wxPython
-dev@lists.wxwidgets.org
359 cat <<EOF | /usr/sbin/sendmail $TO
360 From: R'bot <rbot@wxpython.org>
362 Subject: New release candidate build uploaded
367 A new RC build of wxPython has been uploaded to starship.
371 URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION
378 echo "Finished at " `date`
383 # ---------------------------------------------------------------------------