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