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 # ---------------------------------------------------------------------------
149 # Make the sources and other basic stuff.
151 if [ $skipsource != yes -o $onlysource = yes ]; then
153 # clean out the local dist dir
156 # Regenerate the reST docs
157 echo "Regenerating the reST docs..."
160 docutils
-html $x `basename $x .txt`.html
164 # build the doc and demo tarballs
168 # make the source tarball
169 distrib
/makerpm
2.3 skipclean skiprpm gtk2
171 # make the source RPMs
172 for ver
in $PYVER; do
173 distrib
/makerpm
$ver skipclean skipcopy skiptar srpm
174 distrib
/makerpm
$ver skipclean skipcopy skiptar srpm gtk2
177 # Copy everything to the staging dir
178 echo "Moving stuff to $STAGING_DIR..."
180 mv dist
/* $STAGING_DIR
181 for doc
in CHANGES BUILD INSTALL MigrationGuide default
; do
182 cp docs
/$doc.
* $STAGING_DIR
186 echo "Cleaning up..."
191 if [ $KIND = daily
]; then
195 if [ $onlysource = yes ]; then
199 # ---------------------------------------------------------------------------
202 if [ $skipwin != yes ]; then
203 echo "-=-=- Starting Windows build..."
205 # mount the shared folder?
206 if [ -n "$WIN_MOUNT" ]; then
207 echo "Mounting shared folder..."
212 echo "Copying source file..."
213 cp $STAGING_DIR/wxPythonSrc
-$VERSION.
tar.gz
$WIN_SHARED
215 # Untar it on the remote machine, and then run the build script
216 echo "Unarchiving source file on $WIN_HOST..."
217 ssh $WIN_HOST "cd $WIN_SHARED_REMOTE && tar xzf wxPythonSrc-$VERSION.tar.gz && rm wxPythonSrc-$VERSION.tar.gz"
219 echo "Running build script on $WIN_HOST..."
220 wxdir
=$WIN_SHARED_REMOTE/wxPythonSrc
-$VERSION
221 cmd
=$wxdir/wxPython
/distrib
/all
/build
-windows
222 ssh $WIN_HOST "cd $wxdir && $cmd $wxdir $WIN_SHARED_REMOTE $skipclean $VERSION $PYVER"
224 echo "Fetching the results..."
225 cp $WIN_SHARED/wxPythonWIN32
* $STAGING_DIR
226 ssh $WIN_HOST "cd $WIN_SHARED_REMOTE && rm wxPythonWIN32*"
229 if [ -n "$WIN_UMOUNT" ]; then
230 echo "Unmounting shared folder..."
236 # ---------------------------------------------------------------------------
239 if [ $skiposx != yes ]; then
240 echo "-=-=- Starting OSX build..."
242 # mount the shared folder?
243 if [ -n "$OSX_MOUNT" ]; then
244 echo "Mounting shared folder..."
249 echo "Copying source files..."
250 cp $STAGING_DIR/wxPythonSrc
-$VERSION.
tar.gz
$OSX_SHARED
251 cp $STAGING_DIR/wxPythonDocs
-$VERSION.
tar.gz
$OSX_SHARED
252 cp $STAGING_DIR/wxPythonDemo
-$VERSION.
tar.gz
$OSX_SHARED
254 # Untar it on the remote machine, and then run the build script
255 echo "Unarchiving source file on $OSX_HOST..."
256 ssh root@
$OSX_HOST "cd $OSX_SHARED_REMOTE && tar xzf wxPythonSrc-$VERSION.tar.gz && rm wxPythonSrc-$VERSION.tar.gz"
258 echo "Running build script on $OSX_HOST..."
259 wxdir
=$OSX_SHARED_REMOTE/wxPythonSrc
-$VERSION
260 cmd
=$wxdir/wxPython
/distrib
/all
/build
-osx
261 ssh root@
$OSX_HOST "cd $wxdir && $cmd $wxdir $OSX_SHARED_REMOTE $skipclean $VERSION $PYVER"
263 echo "Fetching the results..."
264 cp $OSX_SHARED/wxPythonOSX
* $STAGING_DIR
265 ssh root@
$OSX_HOST "cd $OSX_SHARED_REMOTE && rm wxPythonOSX*"
268 if [ -n "$OSX_UMOUNT" ]; then
269 echo "Unmounting shared folder..."
275 # ---------------------------------------------------------------------------
278 # This build is optional, check if the target machine is up and
280 if [ $skiplinux != yes ]; then
281 if ping -q -c1 -w1 $LINUX_HOST > /dev
/null
; then
285 # the ping failed, skip the build
287 echo "-----------------------------------------------------------------"
288 echo "The $LINUX_HOST machine is offline, skipping the binary RPM build."
289 echo "-----------------------------------------------------------------"
294 if [ $skiplinux != yes ]; then
295 echo "-=-=- Starting Linux build..."
297 # The remote linux build is a bit different than the others. The
298 # SRPMs will have already been built in the initial source
299 # building steps, the only thing that the remote build needs to
300 # do is an "rpmbuild --rebuild" for each package. So we'll just
301 # copy the build script over and execute it, there is no need to
302 # unpack the tarball and most of the other steps...
305 echo "Copying source files..."
306 mkdir -p $LINUX_SHARED
307 cp $STAGING_DIR/wxPython
*.src.rpm
$LINUX_SHARED
309 scp distrib
/all
/build
-linux root@
$LINUX_HOST:/tmp
> /dev
/null
310 ssh root@
$LINUX_HOST "cd /tmp && ./build-linux /tmp/wx $LINUX_SHARED_REMOTE $skipclean $VERSION $PYVER"
312 echo "Fetching the results..."
313 cp $LINUX_SHARED/wxPythonGTK
*.i
[0-9]86.rpm
$STAGING_DIR
320 # ---------------------------------------------------------------------------
321 # Final disposition of build results...
323 chmod a
+r
$STAGING_DIR/*
325 if [ $KIND = dryrun
]; then
331 if [ $KIND = daily
]; then
333 destdir
=$UPLOAD_DAILY_ROOT/$DAILY
334 echo "Copying to the starship at $destdir..."
335 ssh $UPLOAD_HOST "mkdir -p $destdir"
336 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
337 ssh $UPLOAD_HOST "cd $destdir && ls -al"
340 echo "Cleaning up staging dir..."
344 # TODO: something to remove old builds from starship, keeping
347 # TODO: Send email to wxPython-dev?
349 TO
=wxPython
-dev@lists.wxwidgets.org
351 cat <<EOF | /usr/sbin/sendmail $TO
352 From: R'bot <rbot@wxpython.org>
354 Subject: New test build uploaded
359 A new test build of wxPython has been uploaded to starship.
363 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
373 if [ $KIND = release
]; then
375 echo "Copying to the local file server..."
376 destdir
=/stuff
/Development
/wxPython
/dist
/$VERSION
378 cp $STAGING_DIR/* $destdir
380 echo "Copying to the starship..."
381 destdir
=$UPLOAD_PREVIEW_ROOT/$VERSION
382 ssh $UPLOAD_HOST "mkdir -p $destdir"
383 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
385 echo "Cleaning up staging dir..."
393 # ---------------------------------------------------------------------------