]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/all/build-all
Restructured for new style RPMs, etc. Can build all the RPMs from a
[wxWidgets.git] / wxPython / distrib / all / build-all
CommitLineData
36e91097
RD
1#!/bin/bash
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# ---------------------------------------------------------------------------
6
7set -o errexit
8#set -o xtrace
9
10# ---------------------------------------------------------------------------
11# Some control variables...
12
13# the local spot that we put everything when done, before possibly copying
14# to remote hosts
15STAGING_DIR=./BUILD
16
36e91097 17
d6624155
RD
18# host name of the machine to use for windows builds
19WIN_HOST=beast
20# Where is the build dir from the remote machine's perspective?
21WIN_BUILD=/c/BUILD
36e91097
RD
22
23
d6624155 24# Just like the above
d391b80e
RD
25OSX_HOST_panther=bigmac
26OSX_HOST_jaguar=whopper
d6624155 27OSX_BUILD=/tmp/BUILD
36e91097
RD
28
29
afbe4a55 30# Alsmost the same... See below for hosts and other info
d6624155 31LINUX_BUILD=/tmp/BUILD
36e91097
RD
32
33
34# Upload server locations
35UPLOAD_HOST=starship.python.net
36UPLOAD_DAILY_ROOT=/home/crew/robind/public_html/wxPython/daily
37UPLOAD_PREVIEW_ROOT=/home/crew/robind/public_html/wxPython/preview
38
39
40
41# ---------------------------------------------------------------------------
42# functions
43
44function usage {
45 echo ""
46 echo "Usage: $0 [command flags...]"
47 echo ""
48 echo "build types:"
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"
52 echo ""
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"
57 echo ""
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"
65 echo ""
66
67
68}
69
70# ---------------------------------------------------------------------------
71
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.
75if [ ! -d wxPython -o ! -d wx ]; then
76 echo "Please run this script from the root wxPython directory."
77 exit 1
78fi
79
80
81
82# Set defaults and check the command line options
83KIND=dryrun
84PYVER=2.3
85skipsource=no
86onlysource=no
87skipwin=no
88skiposx=no
89skiplinux=no
90skipclean=no
91
92for flag in $*; do
93 case $flag in
94 dryrun) KIND=dryrun ;;
95 daily) KIND=daily ;;
96 release) KIND=release ;;
97
98 2.2) PYVER=2.2 ;;
99 2.3) PYVER=2.3 ;;
100 all) PYVER="2.2 2.3" ;;
101
102 skipsource) skipsource=yes ;;
103 onlysource) onlysource=yes ;;
104 skipwin) skipwin=yes ;;
105 skiposx) skiposx=yes ;;
106 skiplinux) skiplinux=yes ;;
107 skipclean) skipclean=yes ;;
108
109 help) usage; exit 1 ;;
110 *) echo "Unknown flag \"$flag\""
111 usage
112 exit 1
113 esac
114done
115
116
117# ensure the staging area exists
118if [ ! -d $STAGING_DIR ]; then
119 mkdir -p $STAGING_DIR
120fi
121
122# Figure out the wxPython version number, possibly adjusted for being a daily build
123if [ $KIND = daily ]; then
124 DAILY=`date +%Y%m%d` # should it include the hour too? 2-digit year?
125 echo $DAILY > DAILY_BUILD
126fi
127VERSION=`python -c "import setup;print setup.VERSION"`
128
129
130#echo VERSION=$VERSION
131#exit 0
132
31c7a57a
RD
133echo "Getting started at " `date`
134
36e91097
RD
135# ---------------------------------------------------------------------------
136# Make the sources and other basic stuff.
137
138if [ $skipsource != yes -o $onlysource = yes ]; then
139
140 # clean out the local dist dir
141 rm -f dist/*
142
143 # Regenerate the reST docs
144 echo "Regenerating the reST docs..."
145 cd docs
146 for x in *.txt; do
147 docutils-html $x `basename $x .txt`.html
148 done
149 cd -
150
151 # build the doc and demo tarballs
152 distrib/makedemo
153 distrib/makedocs
154
477550dc
RD
155 # build the new docs too
156 docs/bin/everything
157
36e91097
RD
158 # make the source tarball
159 distrib/makerpm 2.3 skipclean skiprpm gtk2
160
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
165 done
166
167 # Copy everything to the staging dir
168 echo "Moving stuff to $STAGING_DIR..."
169 rm -f dist/*.spec
170 mv dist/* $STAGING_DIR
171 for doc in CHANGES BUILD INSTALL MigrationGuide default; do
172 cp docs/$doc.* $STAGING_DIR
173 done
174
175 # cleanup
176 echo "Cleaning up..."
177 rm -f dist/*
178 rm -rf _build_rpm
179fi
180
181if [ $KIND = daily ]; then
182 rm DAILY_BUILD
183fi
184
185if [ $onlysource = yes ]; then
186 exit 0
187fi
188
189# ---------------------------------------------------------------------------
190# Windows build
191
192if [ $skipwin != yes ]; then
193 echo "-=-=- Starting Windows build..."
194
d6624155
RD
195 echo "Copying source file and build script..."
196 scp $STAGING_DIR/wxPythonSrc-$VERSION.tar.gz \
197 distrib/all/build-windows \
198 $WIN_HOST:$WIN_BUILD
36e91097 199
d6624155
RD
200 echo "Running build script on $WIN_HOST..."
201 wxdir=$WIN_BUILD/wxPythonSrc-$VERSION
202 cmd=./build-windows
203 ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
204
205 echo "Fetching the results..."
206 scp $WIN_HOST:$WIN_BUILD/wxPythonWIN32* $STAGING_DIR
207 ssh $WIN_HOST "rm $WIN_BUILD/wxPythonWIN32*"
36e91097
RD
208fi
209
210
211# ---------------------------------------------------------------------------
212# OSX build
213
d391b80e
RD
214function DoOSXBuild {
215 local host=$1
216 local flavor=$2
217
218 # test if the target machine is online
219 if ping -q -c1 -w1 $host > /dev/null; then
220 echo "-----------------------------------------------------------------"
ba9a8985 221 echo " The $host machine is online, OSX-$flavor build continuing..."
d391b80e
RD
222 echo "-----------------------------------------------------------------"
223 else
224 echo "-----------------------------------------------------------------"
ba9a8985 225 echo "The $host machine is offline, skipping the OSX-$flavor build."
d391b80e
RD
226 echo "-----------------------------------------------------------------"
227 return 0
228 fi
229
230 echo "-=-=- Starting OSX-$flavor build on $host..."
36e91097 231
d6624155 232 echo "Copying source files and build script..."
ba9a8985 233 ssh root@$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true"
d6624155
RD
234 scp $STAGING_DIR/wxPythonSrc-$VERSION.tar.gz \
235 $STAGING_DIR/wxPythonDocs-$VERSION.tar.gz \
236 $STAGING_DIR/wxPythonDemo-$VERSION.tar.gz \
237 distrib/all/build-osx \
39d3e67e 238 root@$host:$OSX_BUILD
d6624155 239
d391b80e 240 echo "Running build script on $host..."
d6624155
RD
241 wxdir=$OSX_BUILD/wxPythonSrc-$VERSION
242 cmd=./build-osx
d391b80e 243 ssh root@$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $PYVER && rm $cmd"
d6624155
RD
244
245 echo "Fetching the results..."
39d3e67e
RD
246 scp "root@$host:$OSX_BUILD/wxPythonOSX*" $STAGING_DIR
247 ssh root@$host "rm $OSX_BUILD/wxPythonOSX*"
d391b80e
RD
248
249}
250
251
252if [ $skiposx != yes ]; then
253
254 DoOSXBuild $OSX_HOST_panther panther
255 DoOSXBuild $OSX_HOST_jaguar jaguar
256
36e91097
RD
257fi
258
259
260# ---------------------------------------------------------------------------
261# Linux build
262
afbe4a55
RD
263# The remote Linux builds are different than those above. The source
264# RPMs were already built in the source step, and so building the
39d3e67e
RD
265# binary RPMs is a very simple followup step. But then add to that
266# the fact that we need to build on more than one distro...
afbe4a55
RD
267
268function DoLinuxBuild {
269 local host=$1
270 local reltag=$2
271 shift;shift
272 local pyver=$@
273
274 # test if the target machine is online
275 if ping -q -c1 -w1 $host > /dev/null; then
276 echo "-----------------------------------------------------------------"
277 echo " The $host machine is online, build continuing..."
278 echo "-----------------------------------------------------------------"
36e91097 279 else
36e91097 280 echo "-----------------------------------------------------------------"
afbe4a55 281 echo "The $host machine is offline, skipping the binary RPM build."
36e91097 282 echo "-----------------------------------------------------------------"
afbe4a55 283 return 0
36e91097 284 fi
afbe4a55 285
4bd19ff3 286 echo "Copying source files and build script..."
afbe4a55 287 ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
d6624155
RD
288 scp $STAGING_DIR/wxPython*.src.rpm \
289 distrib/all/build-linux \
afbe4a55 290 root@$host:$LINUX_BUILD
d6624155 291
afbe4a55 292 echo "Running build script on $host..."
d6624155 293 cmd=./build-linux
afbe4a55 294 ssh root@$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver"
36e91097
RD
295
296 echo "Fetching the results..."
afbe4a55
RD
297 scp "root@$host:$LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm" $STAGING_DIR
298 ssh root@$host "rm $LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm"
299
300}
36e91097 301
d391b80e 302if [ $skiplinux != yes ]; then
36e91097 303
d391b80e
RD
304 DoLinuxBuild co-rh9 RH9 $PYVER
305 DoLinuxBuild co-fc2 FC2 2.3
afbe4a55 306
d391b80e 307fi
36e91097
RD
308
309
310# ---------------------------------------------------------------------------
311# Final disposition of build results...
312
79408446 313chmod a+r $STAGING_DIR/*
36e91097
RD
314
315if [ $KIND = dryrun ]; then
316 # we're done
31c7a57a 317 echo "Finished at " `date`
36e91097
RD
318 exit 0
319fi
320
321
322if [ $KIND = daily ]; then
323
79408446 324 destdir=$UPLOAD_DAILY_ROOT/$DAILY
36e91097
RD
325 echo "Copying to the starship at $destdir..."
326 ssh $UPLOAD_HOST "mkdir -p $destdir"
327 scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
79408446
RD
328 ssh $UPLOAD_HOST "cd $destdir && ls -al"
329
36e91097
RD
330
331 echo "Cleaning up staging dir..."
332 rm $STAGING_DIR/*
333 rmdir $STAGING_DIR
334
335 # TODO: something to remove old builds from starship, keeping
336 # only N days worth
337
afbe4a55 338 # Send email to wxPython-dev
71132988
RD
339 DATE=`date`
340 TO=wxPython-dev@lists.wxwidgets.org
341
342 cat <<EOF | /usr/sbin/sendmail $TO
343From: R'bot <rbot@wxpython.org>
344To: $TO
c7be1d2a 345Subject: $DAILY test build uploaded
71132988
RD
346Date: $DATE
347
79408446
RD
348Hi,
349
350A new test build of wxPython has been uploaded to starship.
351
352 Version: $VERSION
79408446 353 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
023a034e 354 Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html
79408446
RD
355
356Have fun!
357R'bot
36e91097 358
71132988 359EOF
31c7a57a
RD
360
361 echo "Finished at " `date`
36e91097
RD
362 exit 0
363fi
364
365
366if [ $KIND = release ]; then
367
368 echo "Copying to the local file server..."
369 destdir=/stuff/Development/wxPython/dist/$VERSION
370 mkdir -p $destdir
371 cp $STAGING_DIR/* $destdir
372
373 echo "Copying to the starship..."
374 destdir=$UPLOAD_PREVIEW_ROOT/$VERSION
375 ssh $UPLOAD_HOST "mkdir -p $destdir"
376 scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
377
378 echo "Cleaning up staging dir..."
379 rm $STAGING_DIR/*
380 rmdir $STAGING_DIR
381
afbe4a55
RD
382 # Send email to wxPython-dev
383 DATE=`date`
384 TO=wxPython-dev@lists.wxwidgets.org
385
386 cat <<EOF | /usr/sbin/sendmail $TO
387From: R'bot <rbot@wxpython.org>
388To: $TO
c7be1d2a 389Subject: $VERSION release candidate build uploaded
afbe4a55
RD
390Date: $DATE
391
392Hi,
393
394A new RC build of wxPython has been uploaded to starship.
395
396 Version: $VERSION
afbe4a55 397 URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION
023a034e 398 Changes: http://starship.python.net/crew/robind/wxPython/preview/$VERSION/CHANGES.html
afbe4a55
RD
399
400Have fun!
401R'bot
402
403EOF
404
31c7a57a 405 echo "Finished at " `date`
36e91097
RD
406 exit 0
407fi
408
409
410# ---------------------------------------------------------------------------