]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/all/build-all
Update year
[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
24
25 #----------------------------------------------------------------------
26 # Configuration items
27
28 class Config:
29 def write(self, filename="config", outfile=None):
30 if outfile is None:
31 f = file(filename, "w")
32 else:
33 f = outfile
34 for k, v in self.__dict__.items():
35 f.write('%s="%s"\n' % (k, v))
36
37 config = Config()
38
39 # the local spot that we put everything when done, before possibly copying
40 # to remote hosts
41 config.STAGING_DIR = "./BUILD"
42
43
44 # host name of the machine to use for windows builds
45 config.WIN_HOST = "beast"
46 # Where is the build dir from the remote machine's perspective?
47 config.WIN_BUILD = "/c/BUILD"
48
49
50 # Just like the above
51 config.OSX_HOST_panther = "bigmac"
52 config.OSX_HOST_jaguar = "whopper"
53 config.OSX_BUILD = "/BUILD"
54
55
56 # Alsmost the same... See below for hosts and other info
57 config.LINUX_BUILD = "/tmp/BUILD"
58
59
60 # Upload server locations
61 config.UPLOAD_HOST = "starship.python.net"
62 config.UPLOAD_DAILY_ROOT = "/home/crew/robind/public_html/wxPython/daily"
63 config.UPLOAD_PREVIEW_ROOT = "/home/crew/robind/public_html/wxPython/rc"
64
65 # defaults for build options
66 config.KIND = "dryrun"
67 config.skipsource = "no"
68 config.onlysource = "no"
69 config.skipdocs = "no"
70 config.skipwin = "no"
71 config.skiposx = "no"
72 config.skiplinux = "no"
73 config.skipclean = "no"
74 config.skipupload = "no"
75 config.skipnewdocs = "no"
76 config.startcohost = "yes"
77
78 #----------------------------------------------------------------------
79 # Define all the build tasks
80
81 class Job(Job):
82 LOGBASE = "./tmp"
83
84 CFGFILE = "./tmp/config"
85
86
87 # Things that need to be done before any of the builds
88 initialTask = Task([ Job("", ["distrib/all/build-setup", CFGFILE]),
89 Job("", ["distrib/all/build-docs", CFGFILE]),
90 Job("", ["distrib/all/build-sources", CFGFILE]),
91 ])
92
93 # Build tasks. Anything that can be done in parallel (depends greatly
94 # on the nature of the build machine configurations...) is a separate
95 # task.
96
97 jaguarTask = Task( Job(config.OSX_HOST_jaguar,
98 ["distrib/all/build-osx", CFGFILE, config.OSX_HOST_jaguar, "jaguar", "2.3"]) )
99
100 pantherTask = Task( Job(config.OSX_HOST_panther,
101 ["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther", "2.3"]) )
102
103 beastTask1 = Task([ Job("beast.23", ["distrib/all/build-windows", CFGFILE, "2.3"]),
104 Job("beast.24", ["distrib/all/build-windows", CFGFILE, "2.4"]),
105 ])
106
107 beastTask2 = Task([ Job("co-mdk101.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.3"]),
108 Job("co-fc2.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.3"]),
109 Job("co-mdk101.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.4"]),
110 Job("co-fc2.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.4"]),
111 ])
112
113 cyclopsTask = Task([ Job("co-rh9.23", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-rh9", "rh9", "2.3"]),
114 Job("co-mdk92.23", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-mdk92", "mdk92", "2.3"]),
115 Job("co-rh9.24", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-rh9", "rh9", "2.4"]),
116 Job("co-mdk92.24", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-mdk92", "mdk92", "2.4"]),
117 ])
118
119 buildTasks = [ jaguarTask,
120 pantherTask,
121 beastTask1,
122 beastTask2,
123 cyclopsTask,
124 ]
125
126 # Finalization. This is for things that must wait until all the
127 # builds are done, such as copying the installers someplace, sending
128 # emails, etc.
129 finalizationTask = Task( Job("", ["distrib/all/build-finalize", CFGFILE]) )
130
131
132 #----------------------------------------------------------------------
133
134 def usage():
135 print ""
136 print "Usage: build-all [command flags...]"
137 print ""
138 print "build types:"
139 print " dryrun Do the build, but don't copy anywhere (default)"
140 print " daily Do a daily build, copy to starship"
141 print " release Do a normal release (cantidate) build, copy to starship"
142 print ""
143 print "optional command flags:"
144 print " skipsource Don't build the source archives, use the ones"
145 print " already in the staging dir."
146 print " onlysource Exit after building the source and docs archives"
147 print " skipdocs Don't rebuild the docs"
148 print " skipwin Don't do the remote Windows build"
149 print " skiposx Don't do the remote OSX build"
150 print " skiplinux Don't do the remote Linux build"
151 print " skipclean Don't do the cleanup step on the remote builds"
152 print " skipupload Don't upload the builds to starship"
153 print ""
154 print " nocohost Don't start the coLinux sessions if they are"
155 print " not already online"
156 print ""
157
158
159 #----------------------------------------------------------------------
160
161 def main(args):
162 # Make sure we are running in the right directory. TODO: make
163 # this test more robust. Currenly we just test for the presence
164 # of 'wxPython' and 'wx' subdirs.
165 if not os.path.isdir("wxPython") or not os.path.isdir("wx"):
166 print "Please run this script from the root wxPython directory."
167 sys.exit(1)
168
169 # Check command line flags
170 for flag in args:
171 if flag in ["dryrun", "daily", "release"]:
172 config.KIND = flag
173
174 elif flag == "skipsource":
175 config.skipsource = "yes"
176
177 elif flag == "onlysource":
178 config.onlysource = "yes"
179
180 elif flag == "skipdocs":
181 config.skipdocs = "yes"
182
183 elif flag == "skipnewdocs":
184 config.skipnewdocs = "yes"
185
186 elif flag == "skipwin":
187 config.skipwin = "yes"
188
189 elif flag == "skiposx":
190 config.skiposx = "yes"
191
192 elif flag == "skiplinux":
193 config.skiplinux = "yes"
194
195 elif flag == "skipclean":
196 config.skipclean = "yes"
197
198 elif flag == "skipupload":
199 config.skipupload = "yes"
200
201 elif flag == "nocohost":
202 config.startcohost = "no"
203
204 else:
205 print 'Unknown flag: "%s"' % flag
206 usage()
207 sys.exit(2)
208
209
210 # ensure the staging area exists
211 if not os.path.exists(config.STAGING_DIR):
212 os.makedirs(config.STAGING_DIR)
213
214 # Figure out the wxPython version number, possibly adjusted for being a daily build
215 if config.KIND == "daily":
216 t = time.localtime()
217 config.DAILY = time.strftime("%Y%m%d") # should it include the hour too? 2-digit year?
218 file("DAILY_BUILD", "w").write(config.DAILY)
219 sys.path.append('.')
220 import setup
221 config.VERSION = setup.VERSION
222
223 # write the config file where the build scripts can find it
224 config.write(CFGFILE)
225 print "Build getting started at: ", time.ctime()
226
227
228 # Run the first task, which will create the docs and sources tarballs
229 tr = TaskRunner(initialTask)
230 rc = tr.run()
231
232 # cleanup the DAILY_BUILD file
233 if config.KIND == "daily":
234 os.unlink("DAILY_BUILD")
235
236 # Quit now?
237 if rc != 0 or config.onlysource == "yes":
238 sys.exit(rc)
239
240
241 # Run the main build tasks
242 tr = TaskRunner(buildTasks)
243 rc = tr.run()
244 if rc != 0:
245 sys.exit(rc)
246
247
248 # when all the builds are done, run the finalization task
249 tr = TaskRunner(finalizationTask)
250 rc = tr.run()
251 if rc != 0:
252 sys.exit(rc)
253
254
255 print "Build finished at: ", time.ctime()
256 sys.exit(0)
257
258
259
260
261 if __name__ == "__main__":
262 main(sys.argv[1:])