]>
Commit | Line | Data |
---|---|---|
2bf6b425 | 1 | #!/usr/bin/python -u |
e4bb5998 RD |
2 | #---------------------------------------------------------------------- |
3 | # Name: build-all.py | |
70b5f65e RD |
4 | # Purpose: Master build script for building all the wxPython |
5 | # installers and such on all the build machines in | |
6 | # my lab, and then distributing the results as needed. | |
e4bb5998 RD |
7 | # |
8 | # This will replace the build-all bash script and is | |
9 | # needed because the needs of the build have outgrown | |
10 | # what I can do with bash. | |
11 | # | |
12 | # Author: Robin Dunn | |
13 | # | |
14 | # Created: 05-Nov-2004 | |
15 | # RCS-ID: $Id$ | |
16 | # Copyright: (c) 2004 by Total Control Software | |
17 | # Licence: wxWindows license | |
18 | #---------------------------------------------------------------------- | |
19 | ||
20 | import sys | |
21 | import os | |
22 | import time | |
f1a9f331 | 23 | from taskrunner import Job, Task, TaskRunner, Config |
e4bb5998 RD |
24 | |
25 | #---------------------------------------------------------------------- | |
26 | # Configuration items | |
27 | ||
f1a9f331 | 28 | CFGFILE = "./distrib/all/build-environ.cfg" |
e4bb5998 | 29 | config = Config() |
f1a9f331 | 30 | config.read(CFGFILE) |
e4bb5998 RD |
31 | |
32 | #---------------------------------------------------------------------- | |
33 | # Define all the build tasks | |
34 | ||
35 | class Job(Job): | |
36 | LOGBASE = "./tmp" | |
37 | ||
e4bb5998 RD |
38 | #---------------------------------------------------------------------- |
39 | ||
46910b06 RD |
40 | def getTasks(config_env): |
41 | # Things that need to be done before any of the builds | |
42 | initialTask = Task([ | |
0f475e8a RD |
43 | Job("", "distrib/all/build-setup", env=config_env), |
44 | Job("", "distrib/all/build-docs", env=config_env), | |
45 | Job("", "distrib/all/build-sources", env=config_env), | |
46910b06 RD |
46 | ]) |
47 | ||
48 | # Build tasks. Anything that can be done in parallel (depends greatly | |
49 | # on the nature of the build machines configurations...) is a separate | |
50 | # task. | |
51 | ||
67be49ee RD |
52 | ## jaguarTask = Task( Job("whopper.23", "distrib/all/build-osx", |
53 | ## [config.OSX_HOST_jaguar, "2.3", "ansi"], env=config_env) ) | |
46910b06 | 54 | |
0f475e8a RD |
55 | pantherTask = Task( [ Job("bigmac.23", |
56 | "distrib/all/build-osx", | |
57 | [config.OSX_HOST_panther, "2.3", "both"], env=config_env), | |
58 | Job("bigmac.24", | |
59 | "distrib/all/build-osx", | |
60 | [config.OSX_HOST_panther, "2.4", "both"], env=config_env) | |
61 | ]) | |
62 | ||
63 | tigerTask = Task([ #Job("smallfry.23", | |
64 | # "distrib/all/build-osx", | |
65 | # [config.OSX_HOST_tiger, "2.3", "both"], env=config_env), | |
66 | Job("smallfry.24", | |
67 | "distrib/all/build-osx", | |
68 | [config.OSX_HOST_tiger, "2.4", "both", "universal"], env=config_env), | |
69 | Job("smallfry.25", | |
70 | "distrib/all/build-osx", | |
71 | [config.OSX_HOST_tiger, "2.5", "both", "universal"], env=config_env) | |
72 | ]) | |
73 | ||
46910b06 RD |
74 | |
75 | beastTask1 = Task( | |
67be49ee RD |
76 | [ #Job("beast.23", "distrib/all/build-windows", ["2.3"], env=config_env), |
77 | # Job("co-rh9.23", "distrib/all/build-rpm", ["beast", "co-rh9", "rh9", "2.3"], env=config_env), | |
46910b06 | 78 | Job("beast.24", "distrib/all/build-windows", ["2.4"], env=config_env), |
67be49ee | 79 | # Job("co-rh9.24", "distrib/all/build-rpm", ["beast", "co-rh9", "rh9", "2.4"], env=config_env), |
0f475e8a | 80 | Job("beast.25", "distrib/all/build-windows", ["2.5"], env=config_env), |
67be49ee | 81 | Job("co-mdk2006.24","distrib/all/build-rpm", ["beast", "co-mdk2006", "mdk2006", "2.4"], env=config_env), |
46910b06 RD |
82 | ]) |
83 | ||
84 | beastTask2 = Task( | |
67be49ee | 85 | [ #Job("co-fc2.23", "distrib/all/build-rpm", ["beast", "co-fc2", "fc2", "2.3"], env=config_env), |
0f475e8a RD |
86 | Job("co-fc4.24", "distrib/all/build-rpm", ["beast", "co-fc4", "fc4", "2.4"], env=config_env), |
87 | Job("co-mdk102.24", "distrib/all/build-rpm", ["beast", "co-mdk102", "mdk102", "2.4"], env=config_env), | |
67be49ee | 88 | # Job("co-mdk2006.24","distrib/all/build-rpm", ["beast", "co-mdk2006", "mdk2006", "2.4"], env=config_env), |
46910b06 | 89 | ]) |
70b5f65e | 90 | |
67071773 RD |
91 | xavierTask = Task([ |
92 | Job("xavier", "distrib/all/build-deb", ["xavier", "/work/chroot/dapper", "dapper"], env=config_env), | |
93 | ]) | |
94 | ||
67be49ee | 95 | buildTasks = [ #jaguarTask, |
46910b06 | 96 | pantherTask, |
0f475e8a | 97 | tigerTask, |
46910b06 RD |
98 | beastTask1, |
99 | beastTask2, | |
67071773 | 100 | xavierTask, |
46910b06 RD |
101 | ] |
102 | ||
103 | # Finalization. This is for things that must wait until all the | |
104 | # builds are done, such as copying the installers someplace, sending | |
105 | # emails, etc. | |
106 | finalizationTask = Task( Job("", "distrib/all/build-finalize", env=config_env) ) | |
107 | ||
108 | return initialTask, buildTasks, finalizationTask | |
109 | ||
110 | ||
111 | #---------------------------------------------------------------------- | |
112 | ||
e4bb5998 RD |
113 | def usage(): |
114 | print "" | |
115 | print "Usage: build-all [command flags...]" | |
116 | print "" | |
117 | print "build types:" | |
118 | print " dryrun Do the build, but don't copy anywhere (default)" | |
119 | print " daily Do a daily build, copy to starship" | |
120 | print " release Do a normal release (cantidate) build, copy to starship" | |
121 | print "" | |
122 | print "optional command flags:" | |
e4bb5998 RD |
123 | print " skipsource Don't build the source archives, use the ones" |
124 | print " already in the staging dir." | |
125 | print " onlysource Exit after building the source and docs archives" | |
126 | print " skipdocs Don't rebuild the docs" | |
127 | print " skipwin Don't do the remote Windows build" | |
128 | print " skiposx Don't do the remote OSX build" | |
67071773 RD |
129 | print " skiprpm Don't do the remote Linux (RPM) build" |
130 | print " skipdeb Don't do the remote Linux (DEB) build" | |
e4bb5998 RD |
131 | print " skipclean Don't do the cleanup step on the remote builds" |
132 | print " skipupload Don't upload the builds to starship" | |
f5ed42f8 | 133 | print " ansi Also do the ansi builds" |
e4bb5998 | 134 | print "" |
2bf6b425 RD |
135 | print " nocohost Don't start the coLinux sessions if they are" |
136 | print " not already online" | |
137 | print "" | |
36e91097 | 138 | |
36e91097 | 139 | |
e4bb5998 RD |
140 | #---------------------------------------------------------------------- |
141 | ||
142 | def main(args): | |
143 | # Make sure we are running in the right directory. TODO: make | |
144 | # this test more robust. Currenly we just test for the presence | |
145 | # of 'wxPython' and 'wx' subdirs. | |
146 | if not os.path.isdir("wxPython") or not os.path.isdir("wx"): | |
147 | print "Please run this script from the root wxPython directory." | |
148 | sys.exit(1) | |
f1a9f331 KO |
149 | |
150 | ||
e4bb5998 RD |
151 | |
152 | # Check command line flags | |
153 | for flag in args: | |
154 | if flag in ["dryrun", "daily", "release"]: | |
155 | config.KIND = flag | |
156 | ||
e4bb5998 RD |
157 | elif flag == "skipsource": |
158 | config.skipsource = "yes" | |
159 | ||
160 | elif flag == "onlysource": | |
161 | config.onlysource = "yes" | |
162 | ||
163 | elif flag == "skipdocs": | |
164 | config.skipdocs = "yes" | |
165 | ||
166 | elif flag == "skipnewdocs": | |
167 | config.skipnewdocs = "yes" | |
168 | ||
169 | elif flag == "skipwin": | |
170 | config.skipwin = "yes" | |
171 | ||
172 | elif flag == "skiposx": | |
173 | config.skiposx = "yes" | |
174 | ||
67071773 RD |
175 | elif flag == "skipdeb": |
176 | config.skipdeb = "yes" | |
177 | ||
178 | elif flag == "skiprpm": | |
179 | config.skiprpm = "yes" | |
e4bb5998 RD |
180 | |
181 | elif flag == "skipclean": | |
182 | config.skipclean = "yes" | |
183 | ||
184 | elif flag == "skipupload": | |
185 | config.skipupload = "yes" | |
2bf6b425 | 186 | |
f5ed42f8 RD |
187 | elif flag == "ansi": |
188 | config.buildansi = "yes" | |
189 | ||
2bf6b425 RD |
190 | elif flag == "nocohost": |
191 | config.startcohost = "no" | |
e4bb5998 RD |
192 | |
193 | else: | |
194 | print 'Unknown flag: "%s"' % flag | |
195 | usage() | |
196 | sys.exit(2) | |
197 | ||
198 | ||
199 | # ensure the staging area exists | |
200 | if not os.path.exists(config.STAGING_DIR): | |
201 | os.makedirs(config.STAGING_DIR) | |
202 | ||
203 | # Figure out the wxPython version number, possibly adjusted for being a daily build | |
204 | if config.KIND == "daily": | |
205 | t = time.localtime() | |
206 | config.DAILY = time.strftime("%Y%m%d") # should it include the hour too? 2-digit year? | |
207 | file("DAILY_BUILD", "w").write(config.DAILY) | |
208 | sys.path.append('.') | |
209 | import setup | |
67071773 RD |
210 | v = config.VERSION = setup.VERSION |
211 | config.VER2 = '.'.join(v.split('.')[:2]) | |
e4bb5998 | 212 | |
f1a9f331 KO |
213 | config_env = config.asDict() |
214 | config_env.update(os.environ) | |
215 | ||
46910b06 | 216 | initialTask, buildTasks, finalizationTask = getTasks(config_env) |
f1a9f331 | 217 | |
e4bb5998 RD |
218 | print "Build getting started at: ", time.ctime() |
219 | ||
e4bb5998 RD |
220 | # Run the first task, which will create the docs and sources tarballs |
221 | tr = TaskRunner(initialTask) | |
222 | rc = tr.run() | |
223 | ||
224 | # cleanup the DAILY_BUILD file | |
225 | if config.KIND == "daily": | |
226 | os.unlink("DAILY_BUILD") | |
227 | ||
228 | # Quit now? | |
229 | if rc != 0 or config.onlysource == "yes": | |
230 | sys.exit(rc) | |
231 | ||
232 | ||
233 | # Run the main build tasks | |
234 | tr = TaskRunner(buildTasks) | |
235 | rc = tr.run() | |
236 | if rc != 0: | |
237 | sys.exit(rc) | |
238 | ||
239 | ||
240 | # when all the builds are done, run the finalization task | |
241 | tr = TaskRunner(finalizationTask) | |
242 | rc = tr.run() | |
243 | if rc != 0: | |
244 | sys.exit(rc) | |
5df4dd4b | 245 | |
e4bb5998 RD |
246 | |
247 | print "Build finished at: ", time.ctime() | |
248 | sys.exit(0) | |
7dc107d6 | 249 | |
7dc107d6 | 250 | |
36e91097 RD |
251 | |
252 | ||
e4bb5998 RD |
253 | if __name__ == "__main__": |
254 | main(sys.argv[1:]) |