]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/all/build-all
regened with new version
[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
17# host name of the machine to use for windows builds
18WIN_HOST=cyclops
19
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.
23WIN_SHARED=./tmp/mnt
24WIN_MOUNT="smbmount //$WIN_HOST/BUILD $WIN_SHARED -o credentials=/etc/samba/auth.cyclops.robind,dmask=755,fmask=644"
25WIN_UMOUNT="smbumount $WIN_SHARED"
26
27# Where is that dir from the remote machine's perspective?
28WIN_SHARED_REMOTE=/c/BUILD
29
30
31
32# Same as the above
33OSX_HOST=bigmac
34OSX_SHARED=./tmp/mnt/BUILD
35OSX_MOUNT="smbmount //$OSX_HOST/robind ./tmp/mnt -o credentials=/etc/samba/auth.bigmac.robind,dmask=755,fmask=644"
36OSX_UMOUNT="smbumount ./tmp/mnt"
37OSX_SHARED_REMOTE=/Users/robind/BUILD
38
39
40
41# Alsmost the same... See below
42LINUX_HOST=rh9
43LINUX_SHARED=/stuff/temp/BUILD
44LINUX_MOUNT=
45LINUX_UMOUNT=
46LINUX_SHARED_REMOTE=/stuff/temp/BUILD
47
48
49# Upload server locations
50UPLOAD_HOST=starship.python.net
51UPLOAD_DAILY_ROOT=/home/crew/robind/public_html/wxPython/daily
52UPLOAD_PREVIEW_ROOT=/home/crew/robind/public_html/wxPython/preview
53
54
55
56# ---------------------------------------------------------------------------
57# functions
58
59function usage {
60 echo ""
61 echo "Usage: $0 [command flags...]"
62 echo ""
63 echo "build types:"
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"
67 echo ""
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"
72 echo ""
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"
80 echo ""
81
82
83}
84
85# ---------------------------------------------------------------------------
86
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.
90if [ ! -d wxPython -o ! -d wx ]; then
91 echo "Please run this script from the root wxPython directory."
92 exit 1
93fi
94
95
96
97# Set defaults and check the command line options
98KIND=dryrun
99PYVER=2.3
100skipsource=no
101onlysource=no
102skipwin=no
103skiposx=no
104skiplinux=no
105skipclean=no
106
107for flag in $*; do
108 case $flag in
109 dryrun) KIND=dryrun ;;
110 daily) KIND=daily ;;
111 release) KIND=release ;;
112
113 2.2) PYVER=2.2 ;;
114 2.3) PYVER=2.3 ;;
115 all) PYVER="2.2 2.3" ;;
116
117 skipsource) skipsource=yes ;;
118 onlysource) onlysource=yes ;;
119 skipwin) skipwin=yes ;;
120 skiposx) skiposx=yes ;;
121 skiplinux) skiplinux=yes ;;
122 skipclean) skipclean=yes ;;
123
124 help) usage; exit 1 ;;
125 *) echo "Unknown flag \"$flag\""
126 usage
127 exit 1
128 esac
129done
130
131
132# ensure the staging area exists
133if [ ! -d $STAGING_DIR ]; then
134 mkdir -p $STAGING_DIR
135fi
136
137# Figure out the wxPython version number, possibly adjusted for being a daily build
138if [ $KIND = daily ]; then
139 DAILY=`date +%Y%m%d` # should it include the hour too? 2-digit year?
140 echo $DAILY > DAILY_BUILD
141fi
142VERSION=`python -c "import setup;print setup.VERSION"`
143
144
145#echo VERSION=$VERSION
146#exit 0
147
148# ---------------------------------------------------------------------------
149# Make the sources and other basic stuff.
150
151if [ $skipsource != yes -o $onlysource = yes ]; then
152
153 # clean out the local dist dir
154 rm -f dist/*
155
156 # Regenerate the reST docs
157 echo "Regenerating the reST docs..."
158 cd docs
159 for x in *.txt; do
160 docutils-html $x `basename $x .txt`.html
161 done
162 cd -
163
164 # build the doc and demo tarballs
165 distrib/makedemo
166 distrib/makedocs
167
168 # make the source tarball
169 distrib/makerpm 2.3 skipclean skiprpm gtk2
170
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
175 done
176
177 # Copy everything to the staging dir
178 echo "Moving stuff to $STAGING_DIR..."
179 rm -f dist/*.spec
180 mv dist/* $STAGING_DIR
181 for doc in CHANGES BUILD INSTALL MigrationGuide default; do
182 cp docs/$doc.* $STAGING_DIR
183 done
184
185 # cleanup
186 echo "Cleaning up..."
187 rm -f dist/*
188 rm -rf _build_rpm
189fi
190
191if [ $KIND = daily ]; then
192 rm DAILY_BUILD
193fi
194
195if [ $onlysource = yes ]; then
196 exit 0
197fi
198
199# ---------------------------------------------------------------------------
200# Windows build
201
202if [ $skipwin != yes ]; then
203 echo "-=-=- Starting Windows build..."
204
205 # mount the shared folder?
206 if [ -n "$WIN_MOUNT" ]; then
207 echo "Mounting shared folder..."
208 $WIN_MOUNT
209 fi
210
211 # Copy the src file
212 echo "Copying source file..."
213 cp $STAGING_DIR/wxPythonSrc-$VERSION.tar.gz $WIN_SHARED
214
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"
218
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"
223
224 echo "Fetching the results..."
225 cp $WIN_SHARED/wxPythonWIN32* $STAGING_DIR
226 ssh $WIN_HOST "cd $WIN_SHARED_REMOTE && rm wxPythonWIN32*"
227
228 # unmount?
229 if [ -n "$WIN_UMOUNT" ]; then
230 echo "Unmounting shared folder..."
231 $WIN_UMOUNT
232 fi
233fi
234
235
236# ---------------------------------------------------------------------------
237# OSX build
238
239if [ $skiposx != yes ]; then
240 echo "-=-=- Starting OSX build..."
241
242 # mount the shared folder?
243 if [ -n "$OSX_MOUNT" ]; then
244 echo "Mounting shared folder..."
245 $OSX_MOUNT
246 fi
247
248 # Copy the src file
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
253
254 # Untar it on the remote machine, and then run the build script
255 echo "Unarchiving source file on $OSX_HOST..."
256 ssh $OSX_HOST "cd $OSX_SHARED_REMOTE && tar xzf wxPythonSrc-$VERSION.tar.gz && rm wxPythonSrc-$VERSION.tar.gz"
257
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 $OSX_HOST "cd $wxdir && $cmd $wxdir $OSX_SHARED_REMOTE $skipclean $VERSION $PYVER"
262
263 echo "Fetching the results..."
264 cp $OSX_SHARED/wxPythonOSX* $STAGING_DIR
265 ssh $OSX_HOST "cd $OSX_SHARED_REMOTE && rm wxPythonOSX*"
266
267 # unmount?
268 if [ -n "$OSX_UMOUNT" ]; then
269 echo "Unmounting shared folder..."
270 $OSX_UMOUNT
271 fi
272fi
273
274
275# ---------------------------------------------------------------------------
276# Linux build
277
278# This build is optional, check if the target machine is up and
279# running
280if [ $skiplinux != yes ]; then
281 if ping -q -c1 -w1 $LINUX_HOST > /dev/null; then
282 # the ping succeeded
283 skiplinux=no
284 else
285 # the ping failed, skip the build
286 skiplinux=yes
287 echo "-----------------------------------------------------------------"
288 echo "The $LINUX_HOST machine is offline, skipping the binary RPM build."
289 echo "-----------------------------------------------------------------"
290 fi
291fi
292
293
294if [ $skiplinux != yes ]; then
295 echo "-=-=- Starting Linux build..."
296
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...
303
304
305 echo "Copying source files..."
306 mkdir -p $LINUX_SHARED
307 cp $STAGING_DIR/wxPython*.src.rpm $LINUX_SHARED
308
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"
311
312 echo "Fetching the results..."
313 cp $LINUX_SHARED/wxPythonGTK*.i[0-9]86.rpm $STAGING_DIR
314 rm -r $LINUX_SHARED
315fi
316
317
318
319
320# ---------------------------------------------------------------------------
321# Final disposition of build results...
322
323
324if [ $KIND = dryrun ]; then
325 # we're done
326 exit 0
327fi
328
329
330if [ $KIND = daily ]; then
331
332 destdir=$UPLOAD_PREVIEW_ROOT/$DAILY
333 echo "Copying to the starship at $destdir..."
334 ssh $UPLOAD_HOST "mkdir -p $destdir"
335 scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
336
337 echo "Cleaning up staging dir..."
338 rm $STAGING_DIR/*
339 rmdir $STAGING_DIR
340
341 # TODO: something to remove old builds from starship, keeping
342 # only N days worth
343
344 # TODO: Send email to wxPython-dev?
345
346 exit 0
347fi
348
349
350if [ $KIND = release ]; then
351
352 echo "Copying to the local file server..."
353 destdir=/stuff/Development/wxPython/dist/$VERSION
354 mkdir -p $destdir
355 cp $STAGING_DIR/* $destdir
356
357 echo "Copying to the starship..."
358 destdir=$UPLOAD_PREVIEW_ROOT/$VERSION
359 ssh $UPLOAD_HOST "mkdir -p $destdir"
360 scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
361
362 echo "Cleaning up staging dir..."
363 rm $STAGING_DIR/*
364 rmdir $STAGING_DIR
365
366 exit 0
367fi
368
369
370# ---------------------------------------------------------------------------