]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/all/build-all
The build can now start RPM builds on more than one linux target,
[wxWidgets.git] / wxPython / distrib / all / build-all
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
7 set -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
15 STAGING_DIR=./BUILD
16
17
18 # host name of the machine to use for windows builds
19 WIN_HOST=beast
20 # Where is the build dir from the remote machine's perspective?
21 WIN_BUILD=/c/BUILD
22
23
24 # Just like the above
25 OSX_HOST=bigmac
26 OSX_BUILD=/tmp/BUILD
27
28
29 # Alsmost the same... See below for hosts and other info
30 LINUX_BUILD=/tmp/BUILD
31
32
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
37
38
39
40 # ---------------------------------------------------------------------------
41 # functions
42
43 function usage {
44 echo ""
45 echo "Usage: $0 [command flags...]"
46 echo ""
47 echo "build types:"
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"
51 echo ""
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"
56 echo ""
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"
64 echo ""
65
66
67 }
68
69 # ---------------------------------------------------------------------------
70
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."
76 exit 1
77 fi
78
79
80
81 # Set defaults and check the command line options
82 KIND=dryrun
83 PYVER=2.3
84 skipsource=no
85 onlysource=no
86 skipwin=no
87 skiposx=no
88 skiplinux=no
89 skipclean=no
90
91 for flag in $*; do
92 case $flag in
93 dryrun) KIND=dryrun ;;
94 daily) KIND=daily ;;
95 release) KIND=release ;;
96
97 2.2) PYVER=2.2 ;;
98 2.3) PYVER=2.3 ;;
99 all) PYVER="2.2 2.3" ;;
100
101 skipsource) skipsource=yes ;;
102 onlysource) onlysource=yes ;;
103 skipwin) skipwin=yes ;;
104 skiposx) skiposx=yes ;;
105 skiplinux) skiplinux=yes ;;
106 skipclean) skipclean=yes ;;
107
108 help) usage; exit 1 ;;
109 *) echo "Unknown flag \"$flag\""
110 usage
111 exit 1
112 esac
113 done
114
115
116 # ensure the staging area exists
117 if [ ! -d $STAGING_DIR ]; then
118 mkdir -p $STAGING_DIR
119 fi
120
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
125 fi
126 VERSION=`python -c "import setup;print setup.VERSION"`
127
128
129 #echo VERSION=$VERSION
130 #exit 0
131
132 echo "Getting started at " `date`
133
134 # ---------------------------------------------------------------------------
135 # Make the sources and other basic stuff.
136
137 if [ $skipsource != yes -o $onlysource = yes ]; then
138
139 # clean out the local dist dir
140 rm -f dist/*
141
142 # Regenerate the reST docs
143 echo "Regenerating the reST docs..."
144 cd docs
145 for x in *.txt; do
146 docutils-html $x `basename $x .txt`.html
147 done
148 cd -
149
150 # build the doc and demo tarballs
151 distrib/makedemo
152 distrib/makedocs
153
154 # build the new docs too
155 docs/bin/everything
156
157 # make the source tarball
158 distrib/makerpm 2.3 skipclean skiprpm gtk2
159
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
164 done
165
166 # Copy everything to the staging dir
167 echo "Moving stuff to $STAGING_DIR..."
168 rm -f dist/*.spec
169 mv dist/* $STAGING_DIR
170 for doc in CHANGES BUILD INSTALL MigrationGuide default; do
171 cp docs/$doc.* $STAGING_DIR
172 done
173
174 # cleanup
175 echo "Cleaning up..."
176 rm -f dist/*
177 rm -rf _build_rpm
178 fi
179
180 if [ $KIND = daily ]; then
181 rm DAILY_BUILD
182 fi
183
184 if [ $onlysource = yes ]; then
185 exit 0
186 fi
187
188 # ---------------------------------------------------------------------------
189 # Windows build
190
191 if [ $skipwin != yes ]; then
192 echo "-=-=- Starting Windows build..."
193
194 echo "Copying source file and build script..."
195 scp $STAGING_DIR/wxPythonSrc-$VERSION.tar.gz \
196 distrib/all/build-windows \
197 $WIN_HOST:$WIN_BUILD
198
199 echo "Running build script on $WIN_HOST..."
200 wxdir=$WIN_BUILD/wxPythonSrc-$VERSION
201 cmd=./build-windows
202 ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
203
204 echo "Fetching the results..."
205 scp $WIN_HOST:$WIN_BUILD/wxPythonWIN32* $STAGING_DIR
206 ssh $WIN_HOST "rm $WIN_BUILD/wxPythonWIN32*"
207 fi
208
209
210 # ---------------------------------------------------------------------------
211 # OSX build
212
213 if [ $skiposx != yes ]; then
214 echo "-=-=- Starting OSX build..."
215
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 \
222 $OSX_HOST:$OSX_BUILD
223
224 echo "Running build script on $OSX_HOST..."
225 wxdir=$OSX_BUILD/wxPythonSrc-$VERSION
226 cmd=./build-osx
227 ssh root@$OSX_HOST "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $PYVER && rm $cmd"
228
229 echo "Fetching the results..."
230 scp "$OSX_HOST:$OSX_BUILD/wxPythonOSX*" $STAGING_DIR
231 ssh $OSX_HOST "rm $OSX_BUILD/wxPythonOSX*"
232 fi
233
234
235 # ---------------------------------------------------------------------------
236 # Linux build
237
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...
242
243 function DoLinuxBuild {
244 local host=$1
245 local reltag=$2
246 shift;shift
247 local pyver=$@
248
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 "-----------------------------------------------------------------"
254 else
255 echo "-----------------------------------------------------------------"
256 echo "The $host machine is offline, skipping the binary RPM build."
257 echo "-----------------------------------------------------------------"
258 return 0
259 fi
260
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
266
267 echo "Running build script on $host..."
268 cmd=./build-linux
269 ssh root@$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver"
270
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"
274
275 }
276
277
278 DoLinuxBuild co-rh9 RH9 $PYVER
279 DoLinuxBuild co-fc2 FC2 2.3
280
281
282
283 # ---------------------------------------------------------------------------
284 # Final disposition of build results...
285
286 chmod a+r $STAGING_DIR/*
287
288 if [ $KIND = dryrun ]; then
289 # we're done
290 echo "Finished at " `date`
291 exit 0
292 fi
293
294
295 if [ $KIND = daily ]; then
296
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"
302
303
304 echo "Cleaning up staging dir..."
305 rm $STAGING_DIR/*
306 rmdir $STAGING_DIR
307
308 # TODO: something to remove old builds from starship, keeping
309 # only N days worth
310
311 # Send email to wxPython-dev
312 DATE=`date`
313 TO=wxPython-dev@lists.wxwidgets.org
314
315 cat <<EOF | /usr/sbin/sendmail $TO
316 From: R'bot <rbot@wxpython.org>
317 To: $TO
318 Subject: New test build uploaded
319 Date: $DATE
320
321 Hi,
322
323 A new test build of wxPython has been uploaded to starship.
324
325 Version: $VERSION
326 Pythons: $PYVER
327 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
328
329 Have fun!
330 R'bot
331
332 EOF
333
334 echo "Finished at " `date`
335 exit 0
336 fi
337
338
339 if [ $KIND = release ]; then
340
341 echo "Copying to the local file server..."
342 destdir=/stuff/Development/wxPython/dist/$VERSION
343 mkdir -p $destdir
344 cp $STAGING_DIR/* $destdir
345
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
350
351 echo "Cleaning up staging dir..."
352 rm $STAGING_DIR/*
353 rmdir $STAGING_DIR
354
355 # Send email to wxPython-dev
356 DATE=`date`
357 TO=wxPython-dev@lists.wxwidgets.org
358
359 cat <<EOF | /usr/sbin/sendmail $TO
360 From: R'bot <rbot@wxpython.org>
361 To: $TO
362 Subject: New release candidate build uploaded
363 Date: $DATE
364
365 Hi,
366
367 A new RC build of wxPython has been uploaded to starship.
368
369 Version: $VERSION
370 Pythons: $PYVER
371 URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION
372
373 Have fun!
374 R'bot
375
376 EOF
377
378 echo "Finished at " `date`
379 exit 0
380 fi
381
382
383 # ---------------------------------------------------------------------------