]>
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." | |
38d45b10 | 60 | echo " onlysource Exit after building the source and docs 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 | ||
38d45b10 | 139 | |
31c7a57a RD |
140 | echo "Getting started at " `date` |
141 | ||
36e91097 RD |
142 | # --------------------------------------------------------------------------- |
143 | # Make the sources and other basic stuff. | |
144 | ||
145 | if [ $skipsource != yes -o $onlysource = yes ]; then | |
146 | ||
147 | # clean out the local dist dir | |
148 | rm -f dist/* | |
149 | ||
28d1454a RD |
150 | if [ $skipdocs != yes ]; then |
151 | # Regenerate the reST docs | |
152 | echo "Regenerating the reST docs..." | |
153 | cd docs | |
154 | for x in *.txt; do | |
155 | docutils-html $x `basename $x .txt`.html | |
156 | done | |
157 | cd - | |
158 | ||
159 | # build the doc and demo tarballs | |
160 | distrib/makedemo | |
161 | distrib/makedocs | |
162 | ||
163 | # build the new docs too | |
164 | docs/bin/everything | |
165 | fi | |
166 | ||
167 | # make the source tarball and srpm | |
168 | distrib/makerpm 2.3 srpm | |
36e91097 RD |
169 | |
170 | # Copy everything to the staging dir | |
171 | echo "Moving stuff to $STAGING_DIR..." | |
36e91097 | 172 | mv dist/* $STAGING_DIR |
28d1454a RD |
173 | |
174 | if [ $skipdocs != yes ]; then | |
175 | for doc in CHANGES BUILD INSTALL MigrationGuide default; do | |
176 | cp docs/$doc.* $STAGING_DIR | |
177 | done | |
178 | fi | |
36e91097 RD |
179 | |
180 | # cleanup | |
181 | echo "Cleaning up..." | |
182 | rm -f dist/* | |
36e91097 RD |
183 | fi |
184 | ||
185 | if [ $KIND = daily ]; then | |
186 | rm DAILY_BUILD | |
187 | fi | |
188 | ||
189 | if [ $onlysource = yes ]; then | |
190 | exit 0 | |
191 | fi | |
192 | ||
193 | # --------------------------------------------------------------------------- | |
194 | # Windows build | |
195 | ||
196 | if [ $skipwin != yes ]; then | |
197 | echo "-=-=- Starting Windows build..." | |
198 | ||
d6624155 | 199 | echo "Copying source file and build script..." |
28d1454a | 200 | scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \ |
d6624155 RD |
201 | distrib/all/build-windows \ |
202 | $WIN_HOST:$WIN_BUILD | |
36e91097 | 203 | |
d6624155 | 204 | echo "Running build script on $WIN_HOST..." |
28d1454a | 205 | wxdir=$WIN_BUILD/wxPython-src-$VERSION |
d6624155 RD |
206 | cmd=./build-windows |
207 | ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd" | |
208 | ||
209 | echo "Fetching the results..." | |
bceb17b2 | 210 | scp "$WIN_HOST:$WIN_BUILD/wxPython*-win32*" $STAGING_DIR |
28d1454a | 211 | ssh $WIN_HOST "rm $WIN_BUILD/wxPython*-win32*" |
36e91097 RD |
212 | fi |
213 | ||
214 | ||
215 | # --------------------------------------------------------------------------- | |
216 | # OSX build | |
217 | ||
d391b80e RD |
218 | function DoOSXBuild { |
219 | local host=$1 | |
220 | local flavor=$2 | |
221 | ||
222 | # test if the target machine is online | |
223 | if ping -q -c1 -w1 $host > /dev/null; then | |
224 | echo "-----------------------------------------------------------------" | |
ba9a8985 | 225 | echo " The $host machine is online, OSX-$flavor build continuing..." |
d391b80e RD |
226 | echo "-----------------------------------------------------------------" |
227 | else | |
228 | echo "-----------------------------------------------------------------" | |
ba9a8985 | 229 | echo "The $host machine is offline, skipping the OSX-$flavor build." |
d391b80e RD |
230 | echo "-----------------------------------------------------------------" |
231 | return 0 | |
232 | fi | |
233 | ||
234 | echo "-=-=- Starting OSX-$flavor build on $host..." | |
36e91097 | 235 | |
d6624155 | 236 | echo "Copying source files and build script..." |
ba9a8985 | 237 | ssh root@$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true" |
28d1454a RD |
238 | #ssh root@$host "mkdir -p $OSX_BUILD || true" |
239 | scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \ | |
240 | $STAGING_DIR/wxPython-docs-$VERSION.tar.gz \ | |
241 | $STAGING_DIR/wxPython-demo-$VERSION.tar.gz \ | |
d6624155 | 242 | distrib/all/build-osx \ |
39d3e67e | 243 | root@$host:$OSX_BUILD |
d6624155 | 244 | |
d391b80e | 245 | echo "Running build script on $host..." |
28d1454a | 246 | wxdir=$OSX_BUILD/wxPython-src-$VERSION |
d6624155 | 247 | cmd=./build-osx |
d391b80e | 248 | ssh root@$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $PYVER && rm $cmd" |
d6624155 RD |
249 | |
250 | echo "Fetching the results..." | |
28d1454a RD |
251 | scp "root@$host:$OSX_BUILD/wxPython*-osx*" $STAGING_DIR |
252 | ssh root@$host "rm $OSX_BUILD/wxPython*-osx*" | |
d391b80e RD |
253 | |
254 | } | |
255 | ||
256 | ||
257 | if [ $skiposx != yes ]; then | |
258 | ||
d391b80e | 259 | DoOSXBuild $OSX_HOST_jaguar jaguar |
38d45b10 | 260 | DoOSXBuild $OSX_HOST_panther panther |
d391b80e | 261 | |
36e91097 RD |
262 | fi |
263 | ||
264 | ||
265 | # --------------------------------------------------------------------------- | |
266 | # Linux build | |
267 | ||
afbe4a55 RD |
268 | # The remote Linux builds are different than those above. The source |
269 | # RPMs were already built in the source step, and so building the | |
39d3e67e RD |
270 | # binary RPMs is a very simple followup step. But then add to that |
271 | # the fact that we need to build on more than one distro... | |
afbe4a55 RD |
272 | |
273 | function DoLinuxBuild { | |
274 | local host=$1 | |
275 | local reltag=$2 | |
276 | shift;shift | |
277 | local pyver=$@ | |
278 | ||
279 | # test if the target machine is online | |
280 | if ping -q -c1 -w1 $host > /dev/null; then | |
281 | echo "-----------------------------------------------------------------" | |
282 | echo " The $host machine is online, build continuing..." | |
283 | echo "-----------------------------------------------------------------" | |
36e91097 | 284 | else |
36e91097 | 285 | echo "-----------------------------------------------------------------" |
afbe4a55 | 286 | echo "The $host machine is offline, skipping the binary RPM build." |
36e91097 | 287 | echo "-----------------------------------------------------------------" |
afbe4a55 | 288 | return 0 |
36e91097 | 289 | fi |
afbe4a55 | 290 | |
4bd19ff3 | 291 | echo "Copying source files and build script..." |
afbe4a55 | 292 | ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*" |
28d1454a | 293 | scp $STAGING_DIR/wxPython-src* $STAGING_DIR/wxPython.spec\ |
d6624155 | 294 | distrib/all/build-linux \ |
afbe4a55 | 295 | root@$host:$LINUX_BUILD |
d6624155 | 296 | |
afbe4a55 | 297 | echo "Running build script on $host..." |
d6624155 | 298 | cmd=./build-linux |
afbe4a55 | 299 | ssh root@$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver" |
36e91097 RD |
300 | |
301 | echo "Fetching the results..." | |
28d1454a RD |
302 | scp "root@$host:$LINUX_BUILD/wxPython*.i[0-9]86.rpm" $STAGING_DIR |
303 | ssh root@$host "rm $LINUX_BUILD/wxPython*.i[0-9]86.rpm" | |
afbe4a55 RD |
304 | |
305 | } | |
36e91097 | 306 | |
d391b80e | 307 | if [ $skiplinux != yes ]; then |
36e91097 | 308 | |
28d1454a RD |
309 | DoLinuxBuild co-rh9 rh9 $PYVER |
310 | DoLinuxBuild co-fc2 fc2 2.3 | |
afbe4a55 | 311 | |
d391b80e | 312 | fi |
36e91097 RD |
313 | |
314 | ||
315 | # --------------------------------------------------------------------------- | |
316 | # Final disposition of build results... | |
317 | ||
79408446 | 318 | chmod a+r $STAGING_DIR/* |
36e91097 RD |
319 | |
320 | if [ $KIND = dryrun ]; then | |
321 | # we're done | |
31c7a57a | 322 | echo "Finished at " `date` |
36e91097 RD |
323 | exit 0 |
324 | fi | |
325 | ||
326 | ||
327 | if [ $KIND = daily ]; then | |
328 | ||
5df4dd4b RD |
329 | echo "Copying to the local file server..." |
330 | destdir=/stuff/temp/$VERSION | |
331 | mkdir -p $destdir | |
332 | cp $STAGING_DIR/* $destdir | |
333 | ||
38d45b10 | 334 | if [ $skipupload != yes ]; then |
7dc107d6 RD |
335 | destdir=$UPLOAD_DAILY_ROOT/$DAILY |
336 | echo "Copying to the starship at $destdir..." | |
337 | ssh $UPLOAD_HOST "mkdir -p $destdir" | |
338 | scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir | |
339 | ssh $UPLOAD_HOST "cd $destdir && ls -al" | |
79408446 | 340 | |
36e91097 | 341 | |
7dc107d6 RD |
342 | # TODO: something to remove old builds from starship, keeping |
343 | # only N days worth | |
36e91097 | 344 | |
7dc107d6 RD |
345 | # Send email to wxPython-dev |
346 | DATE=`date` | |
347 | TO=wxPython-dev@lists.wxwidgets.org | |
36e91097 | 348 | |
7dc107d6 | 349 | cat <<EOF | /usr/sbin/sendmail $TO |
71132988 RD |
350 | From: R'bot <rbot@wxpython.org> |
351 | To: $TO | |
c7be1d2a | 352 | Subject: $DAILY test build uploaded |
71132988 RD |
353 | Date: $DATE |
354 | ||
79408446 RD |
355 | Hi, |
356 | ||
357 | A new test build of wxPython has been uploaded to starship. | |
358 | ||
359 | Version: $VERSION | |
79408446 | 360 | URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY |
023a034e | 361 | Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html |
79408446 RD |
362 | |
363 | Have fun! | |
364 | R'bot | |
36e91097 | 365 | |
71132988 | 366 | EOF |
7dc107d6 RD |
367 | fi |
368 | ||
369 | echo "Cleaning up staging dir..." | |
370 | rm $STAGING_DIR/* | |
371 | rmdir $STAGING_DIR | |
31c7a57a RD |
372 | |
373 | echo "Finished at " `date` | |
36e91097 RD |
374 | exit 0 |
375 | fi | |
376 | ||
377 | ||
378 | if [ $KIND = release ]; then | |
379 | ||
380 | echo "Copying to the local file server..." | |
381 | destdir=/stuff/Development/wxPython/dist/$VERSION | |
382 | mkdir -p $destdir | |
383 | cp $STAGING_DIR/* $destdir | |
384 | ||
38d45b10 | 385 | if [ $skipupload != yes ]; then |
7dc107d6 RD |
386 | echo "Copying to the starship..." |
387 | destdir=$UPLOAD_PREVIEW_ROOT/$VERSION | |
388 | ssh $UPLOAD_HOST "mkdir -p $destdir" | |
389 | scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir | |
36e91097 | 390 | |
7dc107d6 RD |
391 | # Send email to wxPython-dev |
392 | DATE=`date` | |
393 | TO=wxPython-dev@lists.wxwidgets.org | |
afbe4a55 | 394 | |
7dc107d6 | 395 | cat <<EOF | /usr/sbin/sendmail $TO |
afbe4a55 RD |
396 | From: R'bot <rbot@wxpython.org> |
397 | To: $TO | |
c7be1d2a | 398 | Subject: $VERSION release candidate build uploaded |
afbe4a55 RD |
399 | Date: $DATE |
400 | ||
401 | Hi, | |
402 | ||
403 | A new RC build of wxPython has been uploaded to starship. | |
404 | ||
405 | Version: $VERSION | |
afbe4a55 | 406 | URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION |
023a034e | 407 | Changes: http://starship.python.net/crew/robind/wxPython/preview/$VERSION/CHANGES.html |
afbe4a55 RD |
408 | |
409 | Have fun! | |
410 | R'bot | |
411 | ||
412 | EOF | |
413 | ||
7dc107d6 RD |
414 | fi |
415 | ||
416 | echo "Cleaning up staging dir..." | |
417 | rm $STAGING_DIR/* | |
418 | rmdir $STAGING_DIR | |
419 | ||
31c7a57a | 420 | echo "Finished at " `date` |
36e91097 RD |
421 | exit 0 |
422 | fi | |
423 | ||
424 | ||
425 | # --------------------------------------------------------------------------- |