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