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
17 # host name of the machine to use for windows builds
20 # local dir (from the poerspecitve of the master machine) of the shared
21 # build dir on the windows machine, plus how to mount it there. If the
22 # [u]mount commands are empty then WIN_SHARED will be used directly.
24 WIN_MOUNT
="smbmount //$WIN_HOST/BUILD $WIN_SHARED -o credentials=/etc/samba/auth.cyclops.robind,dmask=755,fmask=644"
25 WIN_UMOUNT
="smbumount $WIN_SHARED"
27 # Where is that dir from the remote machine's perspective?
28 WIN_SHARED_REMOTE
=/c
/BUILD
34 OSX_SHARED
=.
/tmp
/mnt
/BUILD
35 OSX_MOUNT
="smbmount //$OSX_HOST/robind ./tmp/mnt -o credentials=/etc/samba/auth.bigmac.robind,dmask=755,fmask=644"
36 OSX_UMOUNT
="smbumount ./tmp/mnt"
37 OSX_SHARED_REMOTE
=/Users
/robind
/BUILD
41 # Alsmost the same... See below
43 LINUX_SHARED
=/stuff
/temp
/BUILD
46 LINUX_SHARED_REMOTE
=/stuff
/temp
/BUILD
49 # Upload server locations
50 UPLOAD_HOST
=starship.python.net
51 UPLOAD_DAILY_ROOT
=/home
/crew
/robind
/public_html
/wxPython
/daily
52 UPLOAD_PREVIEW_ROOT
=/home
/crew
/robind
/public_html
/wxPython
/preview
56 # ---------------------------------------------------------------------------
61 echo "Usage: $0 [command flags...]"
64 echo " dryrun Do the build, but don't copy anywhere (default)"
65 echo " daily Do a daily build, copy to starship"
66 echo " release Do a normal release build, copy to starship"
68 echo "optional command flags:"
69 echo " 2.2 Build for Python 2.2 (default=off)"
70 echo " 2.3 Build for Python 2.3 (default=on)"
71 echo " all Build for all supported Python versions"
73 echo " skipsource Don't build the source archives, use the ones"
74 echo " already in the staging dir."
75 echo " onlysource Exit after building the source archives"
76 echo " skipwin Don't do the remote Windows build"
77 echo " skiposx Don't do the remote OSX build"
78 echo " skiplinux Don't do the remote Linux build"
79 echo " skipclean Don't do the cleanup step on the remote builds"
85 # ---------------------------------------------------------------------------
87 # Make sure we are running in the right directory. TODO: make this
88 # test more robust. Currenly we just test for the presence of
89 # 'wxPython' and 'wx' subdirs.
90 if [ ! -d wxPython
-o ! -d wx
]; then
91 echo "Please run this script from the root wxPython directory."
97 # Set defaults and check the command line options
109 dryrun
) KIND
=dryrun
;;
111 release
) KIND
=release
;;
115 all
) PYVER
="2.2 2.3" ;;
117 skipsource
) skipsource
=yes ;;
118 onlysource
) onlysource
=yes ;;
119 skipwin
) skipwin
=yes ;;
120 skiposx
) skiposx
=yes ;;
121 skiplinux
) skiplinux
=yes ;;
122 skipclean
) skipclean
=yes ;;
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
148 echo "Getting started at " `date`
150 # ---------------------------------------------------------------------------
151 # Make the sources and other basic stuff.
153 if [ $skipsource != yes -o $onlysource = yes ]; then
155 # clean out the local dist dir
158 # Regenerate the reST docs
159 echo "Regenerating the reST docs..."
162 docutils
-html $x `basename $x .txt`.html
166 # build the doc and demo tarballs
170 # make the source tarball
171 distrib
/makerpm
2.3 skipclean skiprpm gtk2
173 # make the source RPMs
174 for ver
in $PYVER; do
175 distrib
/makerpm
$ver skipclean skipcopy skiptar srpm
176 distrib
/makerpm
$ver skipclean skipcopy skiptar srpm gtk2
179 # Copy everything to the staging dir
180 echo "Moving stuff to $STAGING_DIR..."
182 mv dist
/* $STAGING_DIR
183 for doc
in CHANGES BUILD INSTALL MigrationGuide default
; do
184 cp docs
/$doc.
* $STAGING_DIR
188 echo "Cleaning up..."
193 if [ $KIND = daily
]; then
197 if [ $onlysource = yes ]; then
201 # ---------------------------------------------------------------------------
204 if [ $skipwin != yes ]; then
205 echo "-=-=- Starting Windows build..."
207 # mount the shared folder?
208 if [ -n "$WIN_MOUNT" ]; then
209 echo "Mounting shared folder..."
214 echo "Copying source file..."
215 cp $STAGING_DIR/wxPythonSrc
-$VERSION.
tar.gz
$WIN_SHARED
217 # Untar it on the remote machine, and then run the build script
218 echo "Unarchiving source file on $WIN_HOST..."
219 ssh $WIN_HOST "cd $WIN_SHARED_REMOTE && tar xzf wxPythonSrc-$VERSION.tar.gz && rm wxPythonSrc-$VERSION.tar.gz"
221 echo "Running build script on $WIN_HOST..."
222 wxdir
=$WIN_SHARED_REMOTE/wxPythonSrc
-$VERSION
223 cmd
=$wxdir/wxPython
/distrib
/all
/build
-windows
224 ssh $WIN_HOST "cd $wxdir && $cmd $wxdir $WIN_SHARED_REMOTE $skipclean $VERSION $PYVER"
226 echo "Fetching the results..."
227 cp $WIN_SHARED/wxPythonWIN32
* $STAGING_DIR
228 ssh $WIN_HOST "cd $WIN_SHARED_REMOTE && rm wxPythonWIN32*"
231 if [ -n "$WIN_UMOUNT" ]; then
232 echo "Unmounting shared folder..."
238 # ---------------------------------------------------------------------------
241 if [ $skiposx != yes ]; then
242 echo "-=-=- Starting OSX build..."
244 # mount the shared folder?
245 if [ -n "$OSX_MOUNT" ]; then
246 echo "Mounting shared folder..."
251 echo "Copying source files..."
252 cp $STAGING_DIR/wxPythonSrc
-$VERSION.
tar.gz
$OSX_SHARED
253 cp $STAGING_DIR/wxPythonDocs
-$VERSION.
tar.gz
$OSX_SHARED
254 cp $STAGING_DIR/wxPythonDemo
-$VERSION.
tar.gz
$OSX_SHARED
256 # Untar it on the remote machine, and then run the build script
257 echo "Unarchiving source file on $OSX_HOST..."
258 ssh root@
$OSX_HOST "cd $OSX_SHARED_REMOTE && tar xzf wxPythonSrc-$VERSION.tar.gz && rm wxPythonSrc-$VERSION.tar.gz"
260 echo "Running build script on $OSX_HOST..."
261 wxdir
=$OSX_SHARED_REMOTE/wxPythonSrc
-$VERSION
262 cmd
=$wxdir/wxPython
/distrib
/all
/build
-osx
263 ssh root@
$OSX_HOST "cd $wxdir && $cmd $wxdir $OSX_SHARED_REMOTE $skipclean $VERSION $PYVER"
265 echo "Fetching the results..."
266 cp $OSX_SHARED/wxPythonOSX
* $STAGING_DIR
267 ssh root@
$OSX_HOST "cd $OSX_SHARED_REMOTE && rm wxPythonOSX*"
270 if [ -n "$OSX_UMOUNT" ]; then
271 echo "Unmounting shared folder..."
277 # ---------------------------------------------------------------------------
280 # This build is optional, check if the target machine is up and
282 if [ $skiplinux != yes ]; then
283 if ping -q -c1 -w1 $LINUX_HOST > /dev
/null
; then
287 # the ping failed, skip the build
289 echo "-----------------------------------------------------------------"
290 echo "The $LINUX_HOST machine is offline, skipping the binary RPM build."
291 echo "-----------------------------------------------------------------"
296 if [ $skiplinux != yes ]; then
297 echo "-=-=- Starting Linux build..."
299 # The remote linux build is a bit different than the others. The
300 # SRPMs will have already been built in the initial source
301 # building steps, the only thing that the remote build needs to
302 # do is an "rpmbuild --rebuild" for each package. So we'll just
303 # copy the build script over and execute it, there is no need to
304 # unpack the tarball and most of the other steps...
307 echo "Copying source files..."
308 mkdir -p $LINUX_SHARED
309 cp $STAGING_DIR/wxPython
*.src.rpm
$LINUX_SHARED
311 scp distrib
/all
/build
-linux root@
$LINUX_HOST:/tmp
> /dev
/null
312 ssh root@
$LINUX_HOST "cd /tmp && ./build-linux /tmp/wx $LINUX_SHARED_REMOTE $skipclean $VERSION $PYVER"
314 echo "Fetching the results..."
315 cp $LINUX_SHARED/wxPythonGTK
*.i
[0-9]86.rpm
$STAGING_DIR
322 # ---------------------------------------------------------------------------
323 # Final disposition of build results...
325 chmod a
+r
$STAGING_DIR/*
327 if [ $KIND = dryrun
]; then
329 echo "Finished at " `date`
334 if [ $KIND = daily
]; then
336 destdir
=$UPLOAD_DAILY_ROOT/$DAILY
337 echo "Copying to the starship at $destdir..."
338 ssh $UPLOAD_HOST "mkdir -p $destdir"
339 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
340 ssh $UPLOAD_HOST "cd $destdir && ls -al"
343 echo "Cleaning up staging dir..."
347 # TODO: something to remove old builds from starship, keeping
350 # TODO: Send email to wxPython-dev?
352 TO
=wxPython
-dev@lists.wxwidgets.org
354 cat <<EOF | /usr/sbin/sendmail $TO
355 From: R'bot <rbot@wxpython.org>
357 Subject: New test build uploaded
362 A new test build of wxPython has been uploaded to starship.
366 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
373 echo "Finished at " `date`
378 if [ $KIND = release
]; then
380 echo "Copying to the local file server..."
381 destdir
=/stuff
/Development
/wxPython
/dist
/$VERSION
383 cp $STAGING_DIR/* $destdir
385 echo "Copying to the starship..."
386 destdir
=$UPLOAD_PREVIEW_ROOT/$VERSION
387 ssh $UPLOAD_HOST "mkdir -p $destdir"
388 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
390 echo "Cleaning up staging dir..."
394 echo "Finished at " `date`
399 # ---------------------------------------------------------------------------