]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/all/build-all
Automated build tweaks and fixes
[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
30 LINUX_HOST=rh9
31 LINUX_BUILD=/tmp/BUILD
32
33
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
38
39
40
41 # ---------------------------------------------------------------------------
42 # functions
43
44 function 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.
75 if [ ! -d wxPython -o ! -d wx ]; then
76 echo "Please run this script from the root wxPython directory."
77 exit 1
78 fi
79
80
81
82 # Set defaults and check the command line options
83 KIND=dryrun
84 PYVER=2.3
85 skipsource=no
86 onlysource=no
87 skipwin=no
88 skiposx=no
89 skiplinux=no
90 skipclean=no
91
92 for 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
114 done
115
116
117 # ensure the staging area exists
118 if [ ! -d $STAGING_DIR ]; then
119 mkdir -p $STAGING_DIR
120 fi
121
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
126 fi
127 VERSION=`python -c "import setup;print setup.VERSION"`
128
129
130 #echo VERSION=$VERSION
131 #exit 0
132
133 echo "Getting started at " `date`
134
135 # ---------------------------------------------------------------------------
136 # Make the sources and other basic stuff.
137
138 if [ $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
155 # make the source tarball
156 distrib/makerpm 2.3 skipclean skiprpm gtk2
157
158 # make the source RPMs
159 for ver in $PYVER; do
160 distrib/makerpm $ver skipclean skipcopy skiptar srpm
161 distrib/makerpm $ver skipclean skipcopy skiptar srpm gtk2
162 done
163
164 # Copy everything to the staging dir
165 echo "Moving stuff to $STAGING_DIR..."
166 rm -f dist/*.spec
167 mv dist/* $STAGING_DIR
168 for doc in CHANGES BUILD INSTALL MigrationGuide default; do
169 cp docs/$doc.* $STAGING_DIR
170 done
171
172 # cleanup
173 echo "Cleaning up..."
174 rm -f dist/*
175 rm -rf _build_rpm
176 fi
177
178 if [ $KIND = daily ]; then
179 rm DAILY_BUILD
180 fi
181
182 if [ $onlysource = yes ]; then
183 exit 0
184 fi
185
186 # ---------------------------------------------------------------------------
187 # Windows build
188
189 if [ $skipwin != yes ]; then
190 echo "-=-=- Starting Windows build..."
191
192 echo "Copying source file and build script..."
193 scp $STAGING_DIR/wxPythonSrc-$VERSION.tar.gz \
194 distrib/all/build-windows \
195 $WIN_HOST:$WIN_BUILD
196
197 echo "Running build script on $WIN_HOST..."
198 wxdir=$WIN_BUILD/wxPythonSrc-$VERSION
199 cmd=./build-windows
200 ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
201
202 echo "Fetching the results..."
203 scp $WIN_HOST:$WIN_BUILD/wxPythonWIN32* $STAGING_DIR
204 ssh $WIN_HOST "rm $WIN_BUILD/wxPythonWIN32*"
205 fi
206
207
208 # ---------------------------------------------------------------------------
209 # OSX build
210
211 if [ $skiposx != yes ]; then
212 echo "-=-=- Starting OSX build..."
213
214 echo "Copying source files and build script..."
215 ssh $OSX_HOST "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/*"
216 scp $STAGING_DIR/wxPythonSrc-$VERSION.tar.gz \
217 $STAGING_DIR/wxPythonDocs-$VERSION.tar.gz \
218 $STAGING_DIR/wxPythonDemo-$VERSION.tar.gz \
219 distrib/all/build-osx \
220 $OSX_HOST:$OSX_BUILD
221
222 echo "Running build script on $OSX_HOST..."
223 wxdir=$OSX_BUILD/wxPythonSrc-$VERSION
224 cmd=./build-osx
225 ssh root@$OSX_HOST "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $PYVER && rm $cmd"
226
227 echo "Fetching the results..."
228 scp "$OSX_HOST:$OSX_BUILD/wxPythonOSX*" $STAGING_DIR
229 ssh $OSX_HOST "rm $OSX_BUILD/wxPythonOSX*"
230 fi
231
232
233 # ---------------------------------------------------------------------------
234 # Linux build
235
236 # This build is optional, check if the target machine is up and
237 # running
238 if [ $skiplinux != yes ]; then
239 if ping -q -c1 -w1 $LINUX_HOST > /dev/null; then
240 # the ping succeeded
241 skiplinux=no
242 else
243 # the ping failed, skip the build
244 skiplinux=yes
245 echo "-----------------------------------------------------------------"
246 echo "The $LINUX_HOST machine is offline, skipping the binary RPM build."
247 echo "-----------------------------------------------------------------"
248 fi
249 fi
250
251
252 if [ $skiplinux != yes ]; then
253 echo "-=-=- Starting Linux build..."
254
255 # The remote linux build is a bit different than the others. The
256 # SRPMs will have already been built in the initial source
257 # building steps, the only thing that the remote build needs to
258 # do is an "rpmbuild --rebuild" for each package. So we'll just
259 # copy the build script over and execute it, there is no need to
260 # unpack the tarball and most of the other steps...
261
262
263 echo "Copying source filesa nd build script..."
264 ssh root@$LINUX_HOST "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
265 scp $STAGING_DIR/wxPython*.src.rpm \
266 distrib/all/build-linux \
267 root@$LINUX_HOST:$LINUX_BUILD
268
269 echo "Running build script on $LINUX_HOST..."
270 cmd=./build-linux
271 ssh root@$LINUX_HOST "cd $LINUX_BUILD && $cmd $LINUX_BUILD $skipclean $VERSION $PYVER"
272
273 echo "Fetching the results..."
274 scp root@$LINUX_HOST:$LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm $STAGING_DIR
275 ssh root@$LINUX_HOST "rm $LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm"
276 fi
277
278
279
280
281 # ---------------------------------------------------------------------------
282 # Final disposition of build results...
283
284 chmod a+r $STAGING_DIR/*
285
286 if [ $KIND = dryrun ]; then
287 # we're done
288 echo "Finished at " `date`
289 exit 0
290 fi
291
292
293 if [ $KIND = daily ]; then
294
295 destdir=$UPLOAD_DAILY_ROOT/$DAILY
296 echo "Copying to the starship at $destdir..."
297 ssh $UPLOAD_HOST "mkdir -p $destdir"
298 scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
299 ssh $UPLOAD_HOST "cd $destdir && ls -al"
300
301
302 echo "Cleaning up staging dir..."
303 rm $STAGING_DIR/*
304 rmdir $STAGING_DIR
305
306 # TODO: something to remove old builds from starship, keeping
307 # only N days worth
308
309 # TODO: Send email to wxPython-dev?
310 DATE=`date`
311 TO=wxPython-dev@lists.wxwidgets.org
312
313 cat <<EOF | /usr/sbin/sendmail $TO
314 From: R'bot <rbot@wxpython.org>
315 To: $TO
316 Subject: New test build uploaded
317 Date: $DATE
318
319 Hi,
320
321 A new test build of wxPython has been uploaded to starship.
322
323 Version: $VERSION
324 Pythons: $PYVER
325 URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
326
327 Have fun!
328 R'bot
329
330 EOF
331
332 echo "Finished at " `date`
333 exit 0
334 fi
335
336
337 if [ $KIND = release ]; then
338
339 echo "Copying to the local file server..."
340 destdir=/stuff/Development/wxPython/dist/$VERSION
341 mkdir -p $destdir
342 cp $STAGING_DIR/* $destdir
343
344 echo "Copying to the starship..."
345 destdir=$UPLOAD_PREVIEW_ROOT/$VERSION
346 ssh $UPLOAD_HOST "mkdir -p $destdir"
347 scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
348
349 echo "Cleaning up staging dir..."
350 rm $STAGING_DIR/*
351 rmdir $STAGING_DIR
352
353 echo "Finished at " `date`
354 exit 0
355 fi
356
357
358 # ---------------------------------------------------------------------------