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