]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/all/build-rpm
adding reference to technote
[wxWidgets.git] / wxPython / distrib / all / build-rpm
1 #!/bin/bash
2 #----------------------------------------------------------------------
3
4 set -o errexit
5
6
7 coHost=$1
8 host=$2
9 reltag=$3
10 pyver=$4
11
12 if [ $buildansi = yes ]; then
13 CHARTYPE=both
14 else
15 CHARTYPE=unicode
16 fi
17
18
19 function TestOnline {
20 local host=$1
21 local message=$2
22
23 if ping -q -c1 -w1 $host > /dev/null; then
24 return 0
25 else
26 return 1
27 fi
28 }
29
30
31 if [ $skiprpm != yes ]; then
32
33 startedCoHost=no
34 hostAvailable=no
35
36 # test if the target machine is online
37 if TestOnline $host; then
38 hostAvailable=yes
39 else
40 # Attempt to start the host via it's coLinux host, if there is one
41 if [ $coHost != none -a $startcohost == yes ]; then
42 if TestOnline $coHost; then
43 echo "Attempting to start $host via coLinux on $coHost..."
44 ssh $coHost "/c/coLinux/VMs/$host.bat -d > /dev/null 2>&1 &"
45
46 # Give it time to boot and be ready for conenctions,
47 # and then test with ssh, limiting retries.
48 for x in `seq 36`; do
49 sleep 5
50 echo "checking..."
51 if ssh root@$host "true" >/dev/null 2>&1; then
52 # success! the host is ready so we can break out of the loop
53 break;
54 fi
55 done
56
57 # test if the host is ready
58 if TestOnline $host; then
59 echo "coLinux start of $host on $coHost successful."
60 startedCoHost=yes
61 hostAvailable=yes
62 fi
63 else
64 echo "The $coHost machine is offline, unable to start coLinux for $host"
65 fi
66 fi
67 fi
68
69 if [ $hostAvailable = yes ]; then
70 echo "The $host machine is online, build continuing..."
71 else
72 echo "The $host machine is **OFFLINE**, skipping the binary RPM build."
73 exit 0
74 fi
75
76
77 echo "Copying source files and build script..."
78 ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
79 scp $STAGING_DIR/wxPython-src* $STAGING_DIR/wxPython.spec\
80 distrib/all/do-build-rpm \
81 root@$host:$LINUX_BUILD
82
83 echo "Running build script on $host..."
84 cmd=./do-build-rpm
85 ssh root@$host "cd $LINUX_BUILD && $cmd $reltag $skipclean $VERSION $pyver $CHARTYPE"
86
87 echo "Fetching the results..."
88 scp "root@$host:$LINUX_BUILD/wxPython*.i[0-9]86.rpm" $STAGING_DIR
89 ssh root@$host "rm $LINUX_BUILD/wxPython*.i[0-9]86.rpm"
90
91
92 if [ $startedCoHost = yes ]; then
93 echo "Halting $host on $coHost..."
94 ssh root@$host "/sbin/halt"
95 sleep 10
96 fi
97 sleep 30
98
99 echo "Done!"
100 fi
101