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