summaryrefslogtreecommitdiffstats
path: root/contrib/local/package-windows.expect
blob: 8aa4ac88890773c0521719c3f6c409807d9cad74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/expect

set timeout 600
set USCXML_BUILD_HOST $::env(USCXML_BUILD_HOST)
set USCXML_BUILD_ARCH $::env(USCXML_BUILD_ARCH)

set local_prompt {sradomski$ }
eval spawn ping -c1 ${USCXML_BUILD_HOST}.local.
expect "cannot resolve"  { puts "Host ${USCXML_BUILD_HOST}.local. not found"; exit } \
       -re $local_prompt { }

set initial_remote_prompt "C*>"
# the default windows prompt is hard to recognize
set remote_prompt "easy_to_recognize"

eval spawn scp -4 -r ../../package sradomski@epikur-win7.local:uscxml
expect {
	"100"              { exp_continue }
	"The authenticity" { send "yes\n"; exp_continue; }
	timeout            { puts "Timeout when uploading source code"; exit;  }
	-re $local_prompt  { }
}

##############################
# ssh into remote host

eval spawn ssh -4 sradomski@${USCXML_BUILD_HOST}.local.
expect {
	timeout            { puts "Timeout when connecting to windows"; exit;  }
	"The authenticity" { send "yes\n"; }
	-re $local_prompt  { puts "Could not connect to remote host"; exit; }
	-re $initial_remote_prompt { }
}

send "set prompt=easy_to_recognize \r"
expect -re $remote_prompt

send "cd build-uscxml\r"
expect -re $remote_prompt

if { [string compare $USCXML_BUILD_ARCH 32] == 0 } {
	send "\"c:\\Program Files\\Microsoft Visual Studio 10.0\\VC\\bin\\vcvars32.bat\"\r"
	expect -re $remote_prompt
} else {
	send "\"c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat\" x86_amd64\r"
	expect -re $remote_prompt
}

##############################
# package

send "\"cmake.exe\" -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DDIST_PREPARE=ON ..\\uscxml\r"
expect -re $remote_prompt

send "nmake package\r"
expect {
	-re $remote_prompt {}
	"Built target"  { exp_continue; }
	"CPack"  { exp_continue; }
}

##############################
# exit and copy packages

send "exit\r"
expect -re $local_prompt

eval cd ~/Documents/TK/Code/

if { [string compare $USCXML_BUILD_ARCH 32] == 0 } {
	eval spawn "scp -r epikur-win7.local:build-uscxml\\\\uscxml-windows* uscxml/installer/"
} else {
	eval spawn "scp -r epikur-win7-64.local:build-uscxml\\\\uscxml-windows* uscxml/installer/"
}
expect -re $local_prompt

exit