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