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
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 " skipwin Don't do the remote Windows build"
62 echo " skiposx Don't do the remote OSX build"
63 echo " skiplinux Don't do the remote Linux build"
64 echo " skipclean Don't do the cleanup step on the remote builds"
70 # ---------------------------------------------------------------------------
72 # Make sure we are running in the right directory. TODO: make this
73 # test more robust. Currenly we just test for the presence of
74 # 'wxPython' and 'wx' subdirs.
75 if [ ! -d wxPython
-o ! -d wx
]; then
76 echo "Please run this script from the root wxPython directory."
82 # Set defaults and check the command line options
94 dryrun
) KIND
=dryrun
;;
96 release
) KIND
=release
;;
100 all
) PYVER
="2.2 2.3" ;;
102 skipsource
) skipsource
=yes ;;
103 onlysource
) onlysource
=yes ;;
104 skipwin
) skipwin
=yes ;;
105 skiposx
) skiposx
=yes ;;
106 skiplinux
) skiplinux
=yes ;;
107 skipclean
) skipclean
=yes ;;
109 help) usage
; exit 1 ;;
110 *) echo "Unknown flag \"$flag\""
117 # ensure the staging area exists
118 if [ ! -d $STAGING_DIR ]; then
119 mkdir -p $STAGING_DIR
122 # Figure out the wxPython version number, possibly adjusted for being a daily build
123 if [ $KIND = daily
]; then
124 DAILY
=`date +%Y%m%d` # should it include the hour too? 2-digit year?
125 echo $DAILY > DAILY_BUILD
127 VERSION
=`python -c "import setup;print setup.VERSION"`
130 #echo VERSION=$VERSION
133 echo "Getting started at " `date`
135 # ---------------------------------------------------------------------------
136 # Make the sources and other basic stuff.
138 if [ $skipsource != yes -o $onlysource = yes ]; then
140 # clean out the local dist dir
143 # Regenerate the reST docs
144 echo "Regenerating the reST docs..."
147 docutils
-html $x `basename $x .txt`.html
151 # build the doc and demo tarballs
155 # build the new docs too
158 # make the source tarball
159 distrib
/makerpm
2.3 skipclean skiprpm gtk2
161 # make the source RPMs
162 for ver
in $PYVER; do
163 distrib
/makerpm
$ver skipclean skipcopy skiptar srpm
164 distrib
/makerpm
$ver skipclean skipcopy skiptar srpm gtk2
167 # Copy everything to the staging dir
168 echo "Moving stuff to $STAGING_DIR..."
170 mv dist
/* $STAGING_DIR
171 for doc
in CHANGES BUILD INSTALL MigrationGuide default
; do
172 cp docs
/$doc.
* $STAGING_DIR
176 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/wxPythonSrc
-$VERSION.
tar.gz \
197 distrib
/all
/build
-windows \
200 echo "Running build script on $WIN_HOST..."
201 wxdir
=$WIN_BUILD/wxPythonSrc
-$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/wxPythonWIN32
* $STAGING_DIR
207 ssh $WIN_HOST "rm $WIN_BUILD/wxPythonWIN32*"
211 # ---------------------------------------------------------------------------
214 if [ $skiposx != yes ]; then
215 echo "-=-=- Starting OSX build..."
217 echo "Copying source files and build script..."
218 ssh $OSX_HOST "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/*"
219 scp
$STAGING_DIR/wxPythonSrc
-$VERSION.
tar.gz \
220 $STAGING_DIR/wxPythonDocs
-$VERSION.
tar.gz \
221 $STAGING_DIR/wxPythonDemo
-$VERSION.
tar.gz \
222 distrib
/all
/build
-osx \
225 echo "Running build script on $OSX_HOST..."
226 wxdir
=$OSX_BUILD/wxPythonSrc
-$VERSION
228 ssh root@
$OSX_HOST "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $PYVER && rm $cmd"
230 echo "Fetching the results..."
231 scp
"$OSX_HOST:$OSX_BUILD/wxPythonOSX*" $STAGING_DIR
232 ssh $OSX_HOST "rm $OSX_BUILD/wxPythonOSX*"
236 # ---------------------------------------------------------------------------
239 # This build is optional, check if the target machine is up and
241 if [ $skiplinux != yes ]; then
242 if ping -q -c1 -w1 $LINUX_HOST > /dev
/null
; then
246 # the ping failed, skip the build
248 echo "-----------------------------------------------------------------"
249 echo "The $LINUX_HOST machine is offline, skipping the binary RPM build."
250 echo "-----------------------------------------------------------------"
255 if [ $skiplinux != yes ]; then
256 echo "-=-=- Starting Linux build..."
258 # The remote linux build is a bit different than the others. The
259 # SRPMs will have already been built in the initial source
260 # building steps, the only thing that the remote build needs to
261 # do is an "rpmbuild --rebuild" for each package. So we'll just
262 # copy the build script over and execute it, there is no need to
263 # unpack the tarball and most of the other steps...
266 echo "Copying source files and build script..."
267 ssh root@
$LINUX_HOST "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
268 scp
$STAGING_DIR/wxPython
*.src.rpm \
269 distrib
/all
/build
-linux \
270 root@
$LINUX_HOST:$LINUX_BUILD
272 echo "Running build script on $LINUX_HOST..."
274 ssh root@
$LINUX_HOST "cd $LINUX_BUILD && $cmd $LINUX_BUILD $skipclean $VERSION $PYVER"
276 echo "Fetching the results..."
277 scp root@
$LINUX_HOST:$LINUX_BUILD/wxPythonGTK
*.i
[0-9]86.rpm
$STAGING_DIR
278 ssh root@
$LINUX_HOST "rm $LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm"
284 # ---------------------------------------------------------------------------
285 # Final disposition of build results...
287 chmod a
+r
$STAGING_DIR/*
289 if [ $KIND = dryrun
]; then
291 echo "Finished at " `date`
296 if [ $KIND = daily
]; then
298 destdir
=$UPLOAD_DAILY_ROOT/$DAILY
299 echo "Copying to the starship at $destdir..."
300 ssh $UPLOAD_HOST "mkdir -p $destdir"
301 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
302 ssh $UPLOAD_HOST "cd $destdir && ls -al"
305 echo "Cleaning up staging dir..."
309 # TODO: something to remove old builds from starship, keeping
312 # TODO: Send email to wxPython-dev?
314 TO
=wxPython
-dev@lists.wxwidgets.org
316 cat <<EOF | /usr/sbin/sendmail $TO
317 From: R'bot <rbot@wxpython.org>
319 Subject: New test build uploaded
324 A new test build of wxPython has been uploaded to starship.
328 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
335 echo "Finished at " `date`
340 if [ $KIND = release
]; then
342 echo "Copying to the local file server..."
343 destdir
=/stuff
/Development
/wxPython
/dist
/$VERSION
345 cp $STAGING_DIR/* $destdir
347 echo "Copying to the starship..."
348 destdir
=$UPLOAD_PREVIEW_ROOT/$VERSION
349 ssh $UPLOAD_HOST "mkdir -p $destdir"
350 scp
$STAGING_DIR/* $UPLOAD_HOST:/$destdir
352 echo "Cleaning up staging dir..."
356 echo "Finished at " `date`
361 # ---------------------------------------------------------------------------