]>
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 | ||
0f475e8a 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( | |
76 | [ Job("beast.23", "distrib/all/build-windows", ["2.3"], env=config_env), | |
0f475e8a | 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), |
0f475e8a RD |
79 | Job("co-rh9.24", "distrib/all/build-rpm", ["beast", "co-rh9", "rh9", "2.4"], env=config_env), |
80 | Job("beast.25", "distrib/all/build-windows", ["2.5"], env=config_env), | |
46910b06 RD |
81 | ]) |
82 | ||
83 | beastTask2 = Task( | |
0f475e8a RD |
84 | [ Job("co-fc2.23", "distrib/all/build-rpm", ["beast", "co-fc2", "fc2", "2.3"], env=config_env), |
85 | Job("co-fc4.24", "distrib/all/build-rpm", ["beast", "co-fc4", "fc4", "2.4"], env=config_env), | |
86 | Job("co-mdk102.24", "distrib/all/build-rpm", ["beast", "co-mdk102", "mdk102", "2.4"], env=config_env), | |
87 | Job("co-mdk2006.24","distrib/all/build-rpm", ["beast", "co-mdk2006", "mdk2006", "2.4"], env=config_env), | |
46910b06 | 88 | ]) |
70b5f65e | 89 | |
46910b06 RD |
90 | buildTasks = [ jaguarTask, |
91 | pantherTask, | |
0f475e8a | 92 | tigerTask, |
46910b06 RD |
93 | beastTask1, |
94 | beastTask2, | |
46910b06 RD |
95 | ] |
96 | ||
97 | # Finalization. This is for things that must wait until all the | |
98 | # builds are done, such as copying the installers someplace, sending | |
99 | # emails, etc. | |
100 | finalizationTask = Task( Job("", "distrib/all/build-finalize", env=config_env) ) | |
101 | ||
102 | return initialTask, buildTasks, finalizationTask | |
103 | ||
104 | ||
105 | #---------------------------------------------------------------------- | |
106 | ||
e4bb5998 RD |
107 | def usage(): |
108 | print "" | |
109 | print "Usage: build-all [command flags...]" | |
110 | print "" | |
111 | print "build types:" | |
112 | print " dryrun Do the build, but don't copy anywhere (default)" | |
113 | print " daily Do a daily build, copy to starship" | |
114 | print " release Do a normal release (cantidate) build, copy to starship" | |
115 | print "" | |
116 | print "optional command flags:" | |
e4bb5998 RD |
117 | print " skipsource Don't build the source archives, use the ones" |
118 | print " already in the staging dir." | |
119 | print " onlysource Exit after building the source and docs archives" | |
120 | print " skipdocs Don't rebuild the docs" | |
121 | print " skipwin Don't do the remote Windows build" | |
122 | print " skiposx Don't do the remote OSX build" | |
123 | print " skiplinux Don't do the remote Linux build" | |
124 | print " skipclean Don't do the cleanup step on the remote builds" | |
125 | print " skipupload Don't upload the builds to starship" | |
126 | print "" | |
2bf6b425 RD |
127 | print " nocohost Don't start the coLinux sessions if they are" |
128 | print " not already online" | |
129 | print "" | |
36e91097 | 130 | |
36e91097 | 131 | |
e4bb5998 RD |
132 | #---------------------------------------------------------------------- |
133 | ||
134 | def main(args): | |
135 | # Make sure we are running in the right directory. TODO: make | |
136 | # this test more robust. Currenly we just test for the presence | |
137 | # of 'wxPython' and 'wx' subdirs. | |
138 | if not os.path.isdir("wxPython") or not os.path.isdir("wx"): | |
139 | print "Please run this script from the root wxPython directory." | |
140 | sys.exit(1) | |
f1a9f331 KO |
141 | |
142 | ||
e4bb5998 RD |
143 | |
144 | # Check command line flags | |
145 | for flag in args: | |
146 | if flag in ["dryrun", "daily", "release"]: | |
147 | config.KIND = flag | |
148 | ||
e4bb5998 RD |
149 | elif flag == "skipsource": |
150 | config.skipsource = "yes" | |
151 | ||
152 | elif flag == "onlysource": | |
153 | config.onlysource = "yes" | |
154 | ||
155 | elif flag == "skipdocs": | |
156 | config.skipdocs = "yes" | |
157 | ||
158 | elif flag == "skipnewdocs": | |
159 | config.skipnewdocs = "yes" | |
160 | ||
161 | elif flag == "skipwin": | |
162 | config.skipwin = "yes" | |
163 | ||
164 | elif flag == "skiposx": | |
165 | config.skiposx = "yes" | |
166 | ||
167 | elif flag == "skiplinux": | |
168 | config.skiplinux = "yes" | |
169 | ||
170 | elif flag == "skipclean": | |
171 | config.skipclean = "yes" | |
172 | ||
173 | elif flag == "skipupload": | |
174 | config.skipupload = "yes" | |
2bf6b425 RD |
175 | |
176 | elif flag == "nocohost": | |
177 | config.startcohost = "no" | |
e4bb5998 RD |
178 | |
179 | else: | |
180 | print 'Unknown flag: "%s"' % flag | |
181 | usage() | |
182 | sys.exit(2) | |
183 | ||
184 | ||
185 | # ensure the staging area exists | |
186 | if not os.path.exists(config.STAGING_DIR): | |
187 | os.makedirs(config.STAGING_DIR) | |
188 | ||
189 | # Figure out the wxPython version number, possibly adjusted for being a daily build | |
190 | if config.KIND == "daily": | |
191 | t = time.localtime() | |
192 | config.DAILY = time.strftime("%Y%m%d") # should it include the hour too? 2-digit year? | |
193 | file("DAILY_BUILD", "w").write(config.DAILY) | |
194 | sys.path.append('.') | |
195 | import setup | |
196 | config.VERSION = setup.VERSION | |
197 | ||
f1a9f331 KO |
198 | config_env = config.asDict() |
199 | config_env.update(os.environ) | |
200 | ||
46910b06 | 201 | initialTask, buildTasks, finalizationTask = getTasks(config_env) |
f1a9f331 | 202 | |
e4bb5998 RD |
203 | print "Build getting started at: ", time.ctime() |
204 | ||
e4bb5998 RD |
205 | # Run the first task, which will create the docs and sources tarballs |
206 | tr = TaskRunner(initialTask) | |
207 | rc = tr.run() | |
208 | ||
209 | # cleanup the DAILY_BUILD file | |
210 | if config.KIND == "daily": | |
211 | os.unlink("DAILY_BUILD") | |
212 | ||
213 | # Quit now? | |
214 | if rc != 0 or config.onlysource == "yes": | |
215 | sys.exit(rc) | |
216 | ||
217 | ||
218 | # Run the main build tasks | |
219 | tr = TaskRunner(buildTasks) | |
220 | rc = tr.run() | |
221 | if rc != 0: | |
222 | sys.exit(rc) | |
223 | ||
224 | ||
225 | # when all the builds are done, run the finalization task | |
226 | tr = TaskRunner(finalizationTask) | |
227 | rc = tr.run() | |
228 | if rc != 0: | |
229 | sys.exit(rc) | |
5df4dd4b | 230 | |
e4bb5998 RD |
231 | |
232 | print "Build finished at: ", time.ctime() | |
233 | sys.exit(0) | |
7dc107d6 | 234 | |
7dc107d6 | 235 | |
36e91097 RD |
236 | |
237 | ||
e4bb5998 RD |
238 | if __name__ == "__main__": |
239 | main(sys.argv[1:]) |