author | William Roberts <williamr@symbian.org> |
Thu, 24 Jun 2010 14:23:13 +0100 | |
changeset 598 | 0a541d1f13c3 |
parent 580 | 6209aeff0f73 |
permissions | -rw-r--r-- |
3 | 1 |
# |
225
d401dbd3a410
Ensure that parallel parsing sbs calls pass on --no-depend-generate and --no-depend-include (as these influence makefile generation).
Jon Chatten
parents:
219
diff
changeset
|
2 |
# Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 | 3 |
# All rights reserved. |
4 |
# This component and the accompanying materials are made available |
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
|
6 |
# which accompanies this distribution, and is available |
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
# |
|
9 |
# Initial Contributors: |
|
10 |
# Nokia Corporation - initial contribution. |
|
11 |
# |
|
12 |
# Contributors: |
|
13 |
# |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
14 |
# Description: |
3 | 15 |
# raptor module |
16 |
# This module represents the running Raptor program. Raptor is started |
|
17 |
# either by calling the Main() function, which creates an instance of |
|
18 |
# the raptor.Raptor class and calls its methods to perform a build based |
|
19 |
# on command-line parameters, or by explicitly creating a raptor.Raptor |
|
20 |
# instance and calling its methods to set-up and perform a build. |
|
21 |
# |
|
22 |
||
23 |
name = "sbs" # the public name for the raptor build tool |
|
24 |
env = "SBS_HOME" # the environment variable that locates us |
|
25 |
xml = "sbs_init.xml" # the primary initialisation file |
|
26 |
env2 = "HOME" # the environment variable that locates the user |
|
27 |
xml2 = ".sbs_init.xml" # the override initialisation file |
|
28 |
||
29 |
import generic_path |
|
30 |
import os |
|
31 |
import raptor_cache |
|
32 |
import raptor_cli |
|
33 |
import raptor_data |
|
34 |
import raptor_make |
|
5 | 35 |
import raptor_makefile |
3 | 36 |
import raptor_meta |
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
37 |
import raptor_timing |
3 | 38 |
import raptor_utilities |
39 |
import raptor_version |
|
40 |
import raptor_xml |
|
41 |
import filter_list |
|
42 |
import sys |
|
43 |
import types |
|
44 |
import time |
|
45 |
import traceback |
|
46 |
import pluginbox |
|
47 |
from xml.sax.saxutils import escape |
|
48 |
||
49 |
||
50 |
if not "HOSTPLATFORM" in os.environ or not "HOSTPLATFORM_DIR" in os.environ: |
|
51 |
print "Error: HOSTPLATFORM and HOSTPLATFORM_DIR must be set in the environment (this is usually done automatically by the startup script)." |
|
52 |
sys.exit(1) |
|
53 |
||
54 |
hostplatform = os.environ["HOSTPLATFORM"].split(" ") |
|
55 |
hostplatform_dir = os.environ["HOSTPLATFORM_DIR"] |
|
56 |
||
57 |
# defaults can use EPOCROOT |
|
5 | 58 |
|
3 | 59 |
if "EPOCROOT" in os.environ: |
115
5869e06bf2ac
Cause whatcomp output to use the incoming epocroot value. i.e. if epocroot is relative then so is the what output.
timothy.murphy@nokia.com
parents:
59
diff
changeset
|
60 |
incoming_epocroot = os.environ["EPOCROOT"] |
136
d84e89d4dde4
Tab/space problem
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
133
diff
changeset
|
61 |
epocroot = incoming_epocroot.replace("\\","/") |
3 | 62 |
else: |
133
8184bb802ee1
In epocroot handling make windows the exceptional case because it is, use os.sep.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
115
diff
changeset
|
63 |
if 'win' in hostplatform: |
8184bb802ee1
In epocroot handling make windows the exceptional case because it is, use os.sep.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
115
diff
changeset
|
64 |
incoming_epocroot = os.sep |
8184bb802ee1
In epocroot handling make windows the exceptional case because it is, use os.sep.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
115
diff
changeset
|
65 |
epocroot = "/" |
8184bb802ee1
In epocroot handling make windows the exceptional case because it is, use os.sep.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
115
diff
changeset
|
66 |
os.environ["EPOCROOT"] = os.sep |
8184bb802ee1
In epocroot handling make windows the exceptional case because it is, use os.sep.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
115
diff
changeset
|
67 |
else: |
3 | 68 |
epocroot=os.environ['HOME'] + os.sep + "epocroot" |
69 |
os.environ["EPOCROOT"] = epocroot |
|
115
5869e06bf2ac
Cause whatcomp output to use the incoming epocroot value. i.e. if epocroot is relative then so is the what output.
timothy.murphy@nokia.com
parents:
59
diff
changeset
|
70 |
incoming_epocroot = epocroot |
3 | 71 |
|
72 |
if "SBS_BUILD_DIR" in os.environ: |
|
73 |
sbs_build_dir = os.environ["SBS_BUILD_DIR"] |
|
74 |
else: |
|
75 |
sbs_build_dir = (epocroot + "/epoc32/build").replace("//","/") |
|
76 |
||
77 |
||
78 |
# only use default XML from the epoc32 tree if it exists |
|
79 |
defaultSystemConfig = "lib/config" |
|
80 |
epoc32UserConfigDir = generic_path.Join(epocroot, "epoc32/sbs_config") |
|
81 |
if epoc32UserConfigDir.isDir(): |
|
82 |
defaultSystemConfig = str(epoc32UserConfigDir) + os.pathsep + defaultSystemConfig |
|
83 |
||
84 |
# parameters that can be overriden by the sbs_init.xml file |
|
85 |
# or by the command-line. |
|
86 |
defaults = { |
|
87 |
"allowCommandLineOverrides" : True, |
|
88 |
"CLI" : "raptor_cli", |
|
89 |
"buildInformation" : generic_path.Path("bld.inf"), |
|
90 |
"defaultConfig" : "default", |
|
91 |
"jobs": 4, |
|
92 |
"keepGoing": False, |
|
93 |
"logFileName" : generic_path.Join(sbs_build_dir,"Makefile.%TIME.log"), |
|
94 |
"makeEngine" : "make", |
|
95 |
"preferBuildInfoToSystemDefinition" : False, |
|
96 |
"pruneDuplicateMakefiles": True, |
|
97 |
"quiet" : False, |
|
98 |
"systemConfig" : defaultSystemConfig, |
|
99 |
"systemDefinition" : generic_path.Path("System_Definition.xml"), |
|
100 |
"systemDefinitionBase" : generic_path.Path("."), |
|
101 |
"systemFLM" : generic_path.Path("lib/flm"), |
|
102 |
"systemPlugins" : generic_path.Path("python/plugins"), |
|
103 |
"topMakefile" : generic_path.Join(sbs_build_dir,"Makefile"), |
|
104 |
"tries": 1, |
|
105 |
"writeSingleMakefile": True, |
|
106 |
"ignoreOsDetection": False, |
|
107 |
"toolcheck": "on", |
|
108 |
"filterList": "filterterminal,filterlogfile" |
|
109 |
} |
|
110 |
||
111 |
||
5 | 112 |
|
113 |
class ModelNode(object): |
|
114 |
""" Represents any node in a a tree of build information |
|
115 |
e.g. a tree of bld.infs, mmps and finally things like resource blocks and string table blocks. |
|
116 |
This is before they are produced into "build" specs. |
|
117 |
""" |
|
118 |
||
119 |
def __init__(self, id, parent = None): |
|
120 |
self.id = id |
|
121 |
self.type = type |
|
122 |
self.specs = [] |
|
123 |
self.deps = [] |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
124 |
self.children = set() |
5 | 125 |
self.unfurled = False |
126 |
self.parent = parent |
|
127 |
||
128 |
# Allow one to make a set |
|
129 |
def __hash__(self): |
|
130 |
return hash(self.id) |
|
131 |
||
132 |
def __cmp__(self,other): |
|
133 |
return cmp(self.id, other) |
|
3 | 134 |
|
135 |
def __iter__(self): |
|
5 | 136 |
return iter(self.children) |
3 | 137 |
|
138 |
def __getitem__(self,x): |
|
139 |
if isinstance(x, slice): |
|
5 | 140 |
return self.children[x.start:x.stop] |
141 |
return self.children[x] |
|
3 | 142 |
|
143 |
def __setitem__(self,k, v): |
|
5 | 144 |
self.children[k] = v |
3 | 145 |
|
146 |
def __len__(self): |
|
5 | 147 |
return len(self.children) |
3 | 148 |
|
5 | 149 |
def add(self, item): |
150 |
return self.children.add(item) |
|
151 |
||
152 |
def isunfurled(self, c): |
|
153 |
return self.unfurled == False |
|
3 | 154 |
|
5 | 155 |
def unfurl(self, build): |
156 |
"""Find any children of this node by processing it, produces specs""" |
|
157 |
pass |
|
3 | 158 |
|
5 | 159 |
def unfurl_all(self, build): |
160 |
"""Unfurl self and all children - preparatory e.g for realisation""" |
|
161 |
if not self.unfurled: |
|
162 |
self.unfurl(build) |
|
3 | 163 |
|
5 | 164 |
self.realise_exports(build) # permit communication of dependencies between children |
3 | 165 |
|
5 | 166 |
for c in self.children: |
167 |
c.unfurl_all(build) |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
168 |
|
3 | 169 |
|
5 | 170 |
def realise_exports(self, build): |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
171 |
"""Do the things that are needed such that we can fully unfurl all |
5 | 172 |
sibling nodes. i.e. this step is here to "take care" of the dependencies |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
173 |
between siblings. |
5 | 174 |
""" |
175 |
pass |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
176 |
|
5 | 177 |
def realise_makefile(self, build, specs): |
178 |
makefilename_base = build.topMakefile |
|
179 |
if self.name is not None: |
|
3 | 180 |
makefile = generic_path.Path(str(makefilename_base) + "_" + raptor_utilities.sanitise(self.name)) |
181 |
else: |
|
182 |
makefile = generic_path.Path(str(makefilename_base)) |
|
183 |
||
184 |
# insert the start time into the Makefile name? |
|
185 |
makefile.path = makefile.path.replace("%TIME", build.timestring) |
|
186 |
||
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
187 |
build.InfoDiscovery(object_type = "layers", count = 1) |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
188 |
build.InfoStartTime(object_type = "layer", task = "parse", |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
189 |
key = str(makefile.path)) |
5 | 190 |
makefileset = build.maker.Write(makefile, specs, build.buildUnitsToBuild) |
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
191 |
build.InfoEndTime(object_type = "layer", task = "parse", |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
192 |
key = str(makefile.path)) |
5 | 193 |
|
194 |
return makefileset |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
195 |
|
5 | 196 |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
197 |
|
5 | 198 |
def realise(self, build): |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
199 |
"""Give the spec trees to the make engine and actually |
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
200 |
"build" the product represented by this model node""" |
5 | 201 |
# Must ensure that all children are unfurled at this point |
202 |
self.unfurl_all(build) |
|
203 |
||
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
204 |
sp = self.specs |
5 | 205 |
|
206 |
build.AssertBuildOK() |
|
207 |
||
208 |
m = self.realise_makefile(build, sp) |
|
209 |
||
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
210 |
build.InfoStartTime(object_type = "layer", task = "build", |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
211 |
key = (str(m.directory) + "/" + str(m.filenamebase))) |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
212 |
result = build.Make(m) |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
213 |
build.InfoEndTime(object_type = "layer", task = "build", |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
214 |
key = (str(m.directory) + "/" + str(m.filenamebase))) |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
215 |
|
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
216 |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
217 |
return result |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
218 |
|
5 | 219 |
|
3 | 220 |
|
5 | 221 |
class Project(ModelNode): |
222 |
"""A project or, in symbian-speak, an MMP |
|
223 |
""" |
|
224 |
def __init__(self, filename, parent = None): |
|
225 |
super(Project,self).__init__(filename, parent = parent) |
|
226 |
# Assume that components are specified in mmp files for now |
|
227 |
# One day that tyranny might end. |
|
228 |
self.mmp_name = str(generic_path.Path.Absolute(filename)) |
|
229 |
self.id = self.mmp_name |
|
230 |
self.unfurled = False |
|
231 |
||
232 |
def makefile(self, makefilename_base, engine, named = False): |
|
233 |
"""Makefiles for individual mmps not feasible at the moment""" |
|
374
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
234 |
pass |
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
235 |
# Cannot, currently, "unfurl an mmp" directly but do want |
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
236 |
# to be able to simulate the overall recursive unfurling of a build. |
5 | 237 |
|
238 |
class Component(ModelNode): |
|
239 |
"""A group of projects or, in symbian-speak, a bld.inf. |
|
240 |
""" |
|
268
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
241 |
def __init__(self, filename, layername="", componentname=""): |
5 | 242 |
super(Component,self).__init__(filename) |
243 |
# Assume that components are specified in bld.inf files for now |
|
244 |
# One day that tyranny might end. |
|
245 |
self.bldinf = None # Slot for a bldinf object if we spot one later |
|
246 |
self.bldinf_filename = generic_path.Path.Absolute(filename) |
|
247 |
||
248 |
self.id = str(self.bldinf_filename) |
|
249 |
self.exportspecs = [] |
|
250 |
self.depfiles = [] |
|
251 |
self.unfurled = False # We can parse this |
|
268
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
252 |
|
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
253 |
# Extra metadata optionally supplied with system definition file gathered components |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
254 |
self.layername = layername |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
255 |
self.componentname = componentname |
5 | 256 |
|
257 |
def AddMMP(self, filename): |
|
258 |
self.children.add(Project(filename)) |
|
3 | 259 |
|
260 |
||
5 | 261 |
class Layer(ModelNode): |
268
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
262 |
""" Some components that should be built togther |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
263 |
e.g. a Layer in the system definition. |
268
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
264 |
|
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
265 |
Components that come from system definition files can |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
266 |
have extra surrounding metadata that we need to pass |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
267 |
on for use in log output. |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
268 |
""" |
5 | 269 |
def __init__(self, name, componentlist=[]): |
270 |
super(Layer,self).__init__(name) |
|
271 |
self.name = name |
|
272 |
||
273 |
for c in componentlist: |
|
268
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
274 |
if isinstance(c, raptor_xml.SystemModelComponent): |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
275 |
# this component came from a system_definition.xml |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
276 |
self.children.add(Component(c, c.GetContainerName("layer"), c.GetContainerName("component"))) |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
277 |
else: |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
278 |
# this is a plain old bld.inf file from the command-line |
692d9a4eefc4
Resurrect COMPONENT_NAME and LAYER_NAME output in logs when bld.inf files are gathered from system definition files.
Jon Chatten
parents:
226
diff
changeset
|
279 |
self.children.add(Component(c)) |
5 | 280 |
|
281 |
def unfurl(self, build): |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
282 |
"""Discover the children of this layer. This involves parsing the component MetaData (bld.infs, mmps). |
5 | 283 |
Takes a raptor object as a parameter (build), together with a list of Configurations. |
284 |
||
285 |
We currently have parsers that work on collections of components/bld.infs and that cannot |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
286 |
parse at a "finer" level. So one can't 'unfurl' an mmp at the moment. |
5 | 287 |
|
288 |
Returns True if the object was successfully unfurled. |
|
289 |
""" |
|
290 |
||
291 |
# setup all our components |
|
292 |
for c in self.children: |
|
293 |
c.specs = [] |
|
294 |
||
295 |
self.configs = build.buildUnitsToBuild |
|
296 |
||
297 |
||
298 |
metaReader = None |
|
299 |
if len (self.children): |
|
300 |
try: |
|
301 |
# create a MetaReader that is aware of the list of |
|
302 |
# configurations that we are trying to build. |
|
303 |
metaReader = raptor_meta.MetaReader(build, build.buildUnitsToBuild) |
|
304 |
||
305 |
# convert the list of bld.inf files into a specification |
|
306 |
# hierarchy suitable for all the configurations we are using. |
|
307 |
self.specs = list(build.generic_specs) |
|
11
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
308 |
self.specs.extend(metaReader.ReadBldInfFiles(self.children, doexport = build.doExport, dobuild = not build.doExportOnly)) |
5 | 309 |
|
310 |
except raptor_meta.MetaDataError, e: |
|
311 |
build.Error(e.Text) |
|
312 |
||
313 |
self.unfurled = True |
|
314 |
||
315 |
||
316 |
def meta_realise(self, build): |
|
317 |
"""Generate specs that can be used to "take care of" finding out more |
|
318 |
about this metaunit - i.e. one doesn't want to parse it immediately |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
319 |
but to create a makefile that will parse it. |
5 | 320 |
In this case it allows bld.infs to be parsed in parallel by make.""" |
321 |
||
3 | 322 |
# insert the start time into the Makefile name? |
323 |
||
5 | 324 |
self.configs = build.buildUnitsToBuild |
3 | 325 |
|
326 |
# Pass certain CLI flags through to the makefile-generating sbs calls |
|
327 |
cli_options = "" |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
328 |
|
3 | 329 |
if build.debugOutput == True: |
330 |
cli_options += " -d" |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
331 |
|
3 | 332 |
if build.ignoreOsDetection == True: |
333 |
cli_options += " -i" |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
334 |
|
3 | 335 |
if build.keepGoing == True: |
336 |
cli_options += " -k" |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
337 |
|
3 | 338 |
if build.quiet == True: |
339 |
cli_options += " -q" |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
340 |
|
225
d401dbd3a410
Ensure that parallel parsing sbs calls pass on --no-depend-generate and --no-depend-include (as these influence makefile generation).
Jon Chatten
parents:
219
diff
changeset
|
341 |
if build.noDependInclude == True: |
d401dbd3a410
Ensure that parallel parsing sbs calls pass on --no-depend-generate and --no-depend-include (as these influence makefile generation).
Jon Chatten
parents:
219
diff
changeset
|
342 |
cli_options += " --no-depend-include" |
d401dbd3a410
Ensure that parallel parsing sbs calls pass on --no-depend-generate and --no-depend-include (as these influence makefile generation).
Jon Chatten
parents:
219
diff
changeset
|
343 |
|
d401dbd3a410
Ensure that parallel parsing sbs calls pass on --no-depend-generate and --no-depend-include (as these influence makefile generation).
Jon Chatten
parents:
219
diff
changeset
|
344 |
if build.noDependGenerate == True: |
d401dbd3a410
Ensure that parallel parsing sbs calls pass on --no-depend-generate and --no-depend-include (as these influence makefile generation).
Jon Chatten
parents:
219
diff
changeset
|
345 |
cli_options += " --no-depend-generate" |
d401dbd3a410
Ensure that parallel parsing sbs calls pass on --no-depend-generate and --no-depend-include (as these influence makefile generation).
Jon Chatten
parents:
219
diff
changeset
|
346 |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
347 |
|
5 | 348 |
nc = len(self.children) |
349 |
number_blocks = build.jobs |
|
3 | 350 |
block_size = (nc / number_blocks) + 1 |
351 |
component_blocks = [] |
|
352 |
spec_nodes = [] |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
353 |
|
3 | 354 |
b = 0 |
5 | 355 |
childlist = list(self.children) |
3 | 356 |
while b < nc: |
5 | 357 |
component_blocks.append(childlist[b:b+block_size]) |
3 | 358 |
b += block_size |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
359 |
|
5 | 360 |
while len(component_blocks[-1]) <= 0: |
3 | 361 |
component_blocks.pop() |
5 | 362 |
number_blocks -= 1 |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
363 |
|
5 | 364 |
build.Info("Parallel Parsing: bld.infs split into %d blocks\n", number_blocks) |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
365 |
# Cause the binding makefiles to have the toplevel makefile's |
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
366 |
# name. The bindee's have __pp appended. |
5 | 367 |
tm = build.topMakefile.Absolute() |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
368 |
binding_makefiles = raptor_makefile.MakefileSet(str(tm.Dir()), build.maker.selectors, makefiles=None, filenamebase=str(tm.File())) |
5 | 369 |
build.topMakefile = generic_path.Path(str(build.topMakefile) + "_pp") |
370 |
||
3 | 371 |
loop_number = 0 |
372 |
for block in component_blocks: |
|
373 |
loop_number += 1 |
|
374 |
specNode = raptor_data.Specification("metadata_" + self.name) |
|
375 |
||
5 | 376 |
componentList = " ".join([str(c.bldinf_filename) for c in block]) |
377 |
||
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
378 |
|
5 | 379 |
configList = " ".join([c.name for c in self.configs if c.name != "build" ]) |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
380 |
|
3 | 381 |
makefile_path = str(build.topMakefile) + "_" + str(loop_number) |
382 |
try: |
|
383 |
os.unlink(makefile_path) # until we have dependencies working properly |
|
374
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
384 |
except Exception: |
3 | 385 |
pass |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
386 |
|
3 | 387 |
# add some basic data in a component-wide variant |
388 |
var = raptor_data.Variant() |
|
389 |
var.AddOperation(raptor_data.Set("COMPONENT_PATHS", componentList)) |
|
390 |
var.AddOperation(raptor_data.Set("MAKEFILE_PATH", makefile_path)) |
|
391 |
var.AddOperation(raptor_data.Set("CONFIGS", configList)) |
|
392 |
var.AddOperation(raptor_data.Set("CLI_OPTIONS", cli_options)) |
|
11
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
393 |
|
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
394 |
|
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
395 |
# Allow the flm to skip exports. Note: this parameter |
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
396 |
doexport_str = '1' |
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
397 |
if not build.doExport: |
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
398 |
doexport_str = '' |
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
399 |
var.AddOperation(raptor_data.Set("DOEXPORT", doexport_str )) |
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
400 |
|
3 | 401 |
# Pass on '-n' (if specified) to the makefile-generating sbs calls |
402 |
if build.noBuild: |
|
403 |
var.AddOperation(raptor_data.Set("NO_BUILD", "1")) |
|
404 |
specNode.AddVariant(var) |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
405 |
|
3 | 406 |
try: |
407 |
interface = build.cache.FindNamedInterface("build.makefiles") |
|
408 |
specNode.SetInterface(interface) |
|
409 |
except KeyError: |
|
410 |
build.Error("Can't find flm interface 'build.makefiles' ") |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
411 |
|
3 | 412 |
spec_nodes.append(specNode) |
5 | 413 |
binding_makefiles.addInclude(str(makefile_path)+"_all") |
414 |
||
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
415 |
build.InfoDiscovery(object_type = "layers", count = 1) |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
416 |
build.InfoStartTime(object_type = "layer", task = "parse", |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
417 |
key = str(build.topMakefile)) |
5 | 418 |
m = self.realise_makefile(build, spec_nodes) |
419 |
m.close() |
|
420 |
gen_result = build.Make(m) |
|
3 | 421 |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
422 |
build.InfoEndTime(object_type = "layer", task = "parse", |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
423 |
key = str(build.topMakefile)) |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
424 |
build.InfoStartTime(object_type = "layer", task = "build", |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
425 |
key = str(build.topMakefile)) |
5 | 426 |
build.Debug("Binding Makefile base name is %s ", binding_makefiles.filenamebase) |
427 |
binding_makefiles.close() |
|
428 |
b = build.Make(binding_makefiles) |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
429 |
build.InfoEndTime(object_type = "layer", task = "build", |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
430 |
key = str(build.topMakefile)) |
5 | 431 |
return b |
3 | 432 |
|
433 |
||
5 | 434 |
|
435 |
||
436 |
class BuildCannotProgressException(Exception): |
|
3 | 437 |
pass |
438 |
||
439 |
# raptor module classes |
|
440 |
||
441 |
class Raptor(object): |
|
442 |
"""An instance of a running Raptor program. |
|
443 |
||
444 |
When operated from the command-line there is a single Raptor object |
|
445 |
created by the Main function. When operated by an IDE several Raptor |
|
446 |
objects may be created and operated at the same time.""" |
|
447 |
||
498
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
448 |
# mission enumeration |
3 | 449 |
M_BUILD = 1 |
498
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
450 |
M_QUERY = 2 |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
451 |
M_VERSION = 3 |
3 | 452 |
|
453 |
def __init__(self, home = None): |
|
454 |
||
455 |
self.DefaultSetUp(home) |
|
456 |
||
457 |
||
458 |
def DefaultSetUp(self, home = None): |
|
459 |
"revert to the default set-up state" |
|
460 |
self.errorCode = 0 |
|
461 |
self.skipAll = False |
|
462 |
self.summary = True |
|
463 |
self.out = sys.stdout # Just until filters get started. |
|
464 |
||
465 |
# Create a bootstrap output system. |
|
466 |
self.out = filter_list.FilterList() |
|
467 |
||
468 |
if home == None: |
|
469 |
try: |
|
470 |
home = os.environ[env] |
|
471 |
except KeyError: |
|
472 |
home = os.getcwd() |
|
473 |
||
474 |
# make sure the home directory exists |
|
475 |
self.home = generic_path.Path(home).Absolute() |
|
476 |
||
477 |
if not self.home.isDir(): |
|
478 |
self.Error("%s '%s' is not a directory", env, self.home) |
|
479 |
return |
|
480 |
||
481 |
# the set-up file location. |
|
482 |
# use the override "env2/xml2" if it exists |
|
483 |
# else use the primary "env/xml" if it exists |
|
484 |
# else keep the hard-coded defaults. |
|
485 |
self.raptorXML = self.home.Append(xml) |
|
486 |
||
487 |
if env2 in os.environ: |
|
488 |
sbs_init = generic_path.Join(os.environ[env2], xml2) |
|
489 |
if sbs_init.isFile(): |
|
490 |
self.raptorXML = sbs_init |
|
491 |
||
492 |
# things that can be overridden by the set-up file |
|
493 |
for key, value in defaults.items(): |
|
494 |
self.__dict__[key] = value |
|
495 |
||
496 |
# things to initialise |
|
497 |
self.args = [] |
|
498 |
||
5 | 499 |
self.layers = [] |
500 |
self.orderLayers = False |
|
3 | 501 |
self.commandlineComponents = [] |
502 |
||
503 |
self.systemModel = None |
|
504 |
self.systemDefinitionFile = None |
|
505 |
self.systemDefinitionRequestedLayers = [] |
|
506 |
self.systemDefinitionOrderLayers = False |
|
507 |
||
508 |
self.specGroups = {} |
|
509 |
||
510 |
self.configNames = [] |
|
511 |
self.configsToBuild = set() |
|
512 |
self.makeOptions = [] |
|
513 |
self.maker = None |
|
514 |
self.debugOutput = False |
|
515 |
self.doExportOnly = False |
|
11
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
516 |
self.doExport = True |
3 | 517 |
self.noBuild = False |
518 |
self.noDependInclude = False |
|
219 | 519 |
self.noDependGenerate = False |
3 | 520 |
self.projects = set() |
498
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
521 |
self.queries = [] |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
522 |
|
3 | 523 |
self.cache = raptor_cache.Cache(self) |
524 |
self.override = {env: str(self.home)} |
|
525 |
self.targets = [] |
|
526 |
self.defaultTargets = [] |
|
527 |
||
528 |
self.doCheck = False |
|
529 |
self.doWhat = False |
|
530 |
self.doParallelParsing = False |
|
531 |
self.mission = Raptor.M_BUILD |
|
532 |
||
533 |
# what platform and filesystem are we running on? |
|
534 |
self.filesystem = raptor_utilities.getOSFileSystem() |
|
535 |
||
537
164e587fef9f
fix: take action on copy tags at the end of build phases.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
536 |
self.timing = True # Needed by filters such as copy_file to monitor progress |
3 | 537 |
self.toolset = None |
538 |
||
539 |
self.starttime = time.time() |
|
540 |
self.timestring = time.strftime("%Y-%m-%d-%H-%M-%S") |
|
541 |
||
542 |
self.fatalErrorState = False |
|
543 |
||
544 |
def AddConfigList(self, configPathList): |
|
545 |
# this function converts cmd line option into a list |
|
546 |
# and prepends it to default config. |
|
547 |
self.configPath = generic_path.NormalisePathList(configPathList.split(os.pathsep)) + self.configPath |
|
548 |
return True |
|
549 |
||
550 |
def AddConfigName(self, name): |
|
5 | 551 |
if name == "build": |
552 |
traceback.print_stack((sys.stdout)) |
|
553 |
sys.exit(1) |
|
3 | 554 |
self.configNames.append(name) |
555 |
return True |
|
556 |
||
557 |
def RunQuietly(self, TrueOrFalse): |
|
558 |
self.quiet = TrueOrFalse |
|
559 |
return True |
|
560 |
||
561 |
def SetCheck(self, TrueOrFalse): |
|
562 |
self.doCheck = TrueOrFalse |
|
563 |
return True |
|
564 |
||
565 |
def SetWhat(self, TrueOrFalse): |
|
566 |
self.doWhat = TrueOrFalse |
|
567 |
return True |
|
568 |
||
569 |
def SetEnv(self, name, value): |
|
570 |
self.override[name] = value |
|
571 |
||
572 |
def AddTarget(self, target): |
|
573 |
if self.doCheck or self.doWhat: |
|
574 |
self.Warn("ignoring target %s because --what or --check is specified.\n", target) |
|
575 |
else: |
|
576 |
self.targets.append(target) |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
577 |
|
3 | 578 |
def AddSourceTarget(self, filename): |
579 |
# source targets are sanitised and then added as if they were a "normal" makefile target |
|
580 |
# in addition they have a default, empty, top-level target assigned in order that they can |
|
581 |
# be presented to any generated makefile without error |
|
582 |
sourceTarget = generic_path.Path(filename).Absolute() |
|
583 |
sourceTarget = 'SOURCETARGET_' + raptor_utilities.sanitise(str(sourceTarget)) |
|
584 |
self.AddTarget(sourceTarget) |
|
585 |
self.defaultTargets.append(sourceTarget) |
|
586 |
return True |
|
587 |
||
588 |
def SetSysDefFile(self, filename): |
|
589 |
self.systemDefinitionFile = generic_path.Path(filename) |
|
590 |
return True |
|
591 |
||
592 |
def SetSysDefBase(self, path): |
|
593 |
self.systemDefinitionBase = generic_path.Path(path) |
|
594 |
return True |
|
595 |
||
596 |
def AddSysDefLayer(self, layer): |
|
597 |
self.systemDefinitionRequestedLayers.append(layer) |
|
598 |
return True |
|
599 |
||
600 |
def SetSysDefOrderLayers(self, TrueOrFalse): |
|
601 |
self.systemDefinitionOrderLayers = TrueOrFalse |
|
602 |
return True |
|
603 |
||
604 |
def AddBuildInfoFile(self, filename): |
|
605 |
bldinf = generic_path.Path(filename).Absolute() |
|
606 |
self.commandlineComponents.append(bldinf) |
|
607 |
return True |
|
608 |
||
609 |
def SetTopMakefile(self, filename): |
|
610 |
self.topMakefile = generic_path.Path(filename) |
|
611 |
return True |
|
612 |
||
613 |
def SetDebugOutput(self, TrueOrFalse): |
|
614 |
self.debugOutput = TrueOrFalse |
|
615 |
return True |
|
616 |
||
617 |
def SetExportOnly(self, TrueOrFalse): |
|
618 |
self.doExportOnly = TrueOrFalse |
|
21
a695dd5e4c37
Make --noexport and --export-only exclusive
timothy.murphy@nokia.com
parents:
14
diff
changeset
|
619 |
if not self.doExport: |
a695dd5e4c37
Make --noexport and --export-only exclusive
timothy.murphy@nokia.com
parents:
14
diff
changeset
|
620 |
self.Error("The --noexport and --export-only options are incompatible - won't to do anything useful") |
a695dd5e4c37
Make --noexport and --export-only exclusive
timothy.murphy@nokia.com
parents:
14
diff
changeset
|
621 |
return False |
3 | 622 |
return True |
623 |
||
11
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
624 |
def SetNoExport(self, TrueOrFalse): |
14 | 625 |
self.doExport = not TrueOrFalse |
21
a695dd5e4c37
Make --noexport and --export-only exclusive
timothy.murphy@nokia.com
parents:
14
diff
changeset
|
626 |
if self.doExportOnly: |
a695dd5e4c37
Make --noexport and --export-only exclusive
timothy.murphy@nokia.com
parents:
14
diff
changeset
|
627 |
self.Error("The --noexport and --export-only options are incompatible - won't to do anything useful") |
a695dd5e4c37
Make --noexport and --export-only exclusive
timothy.murphy@nokia.com
parents:
14
diff
changeset
|
628 |
return False |
11
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
629 |
return True |
ea23b18a2ff6
Initial implementation of noexport
tnmurphy@4GBL06592.nokia.com
parents:
5
diff
changeset
|
630 |
|
3 | 631 |
def SetNoBuild(self, TrueOrFalse): |
632 |
self.noBuild = TrueOrFalse |
|
633 |
return True |
|
634 |
||
635 |
def SetNoDependInclude(self, TrueOrFalse): |
|
636 |
self.noDependInclude = TrueOrFalse |
|
637 |
return True |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
638 |
|
219 | 639 |
def SetNoDependGenerate(self, TrueOrFalse): |
640 |
self.noDependGenerate = TrueOrFalse |
|
641 |
return True |
|
642 |
||
3 | 643 |
def SetKeepGoing(self, TrueOrFalse): |
644 |
self.keepGoing = TrueOrFalse |
|
645 |
return True |
|
646 |
||
647 |
def SetLogFileName(self, logfile): |
|
648 |
if logfile == "-": |
|
649 |
self.logFileName = None # stdout |
|
650 |
else: |
|
651 |
self.logFileName = generic_path.Path(logfile) |
|
652 |
return True |
|
653 |
||
654 |
def SetMakeEngine(self, makeEngine): |
|
193
8e61308a207e
don't break sbs_init.xml files with make engine validation changes
timothy.murphy@nokia.com
parents:
191
diff
changeset
|
655 |
self.makeEngine = makeEngine |
3 | 656 |
return True |
657 |
||
658 |
def AddMakeOption(self, makeOption): |
|
659 |
self.makeOptions.append(makeOption) |
|
660 |
return True |
|
661 |
||
662 |
def SetJobs(self, numberOfJobs): |
|
663 |
try: |
|
664 |
self.jobs = int(numberOfJobs) |
|
665 |
except ValueError: |
|
666 |
self.jobs = 0 |
|
667 |
||
668 |
if self.jobs < 1: |
|
669 |
self.Warn("The number of jobs (%s) must be a positive integer\n", numberOfJobs) |
|
670 |
self.jobs = 1 |
|
671 |
return False |
|
672 |
return True |
|
673 |
||
674 |
def SetTries(self, numberOfTries): |
|
675 |
try: |
|
676 |
self.tries = int(numberOfTries) |
|
677 |
except ValueError: |
|
678 |
self.tries = 0 |
|
679 |
||
680 |
if self.tries < 1: |
|
681 |
self.Warn("The number of tries (%s) must be a positive integer\n", numberOfTries) |
|
682 |
self.tries = 1 |
|
683 |
return False |
|
684 |
return True |
|
685 |
||
686 |
def SetToolCheck(self, type): |
|
687 |
type = type.lower() |
|
688 |
toolcheck_types= [ "forced", "on", "off" ] |
|
689 |
if type in toolcheck_types: |
|
690 |
self.toolcheck=type |
|
691 |
else: |
|
692 |
self.Warn("toolcheck option must be one of: %s" % toolcheck_types) |
|
693 |
return False |
|
694 |
||
695 |
return True |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
696 |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
697 |
def SetTiming(self, TrueOrFalse): |
537
164e587fef9f
fix: take action on copy tags at the end of build phases.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
698 |
self.Info("--timing switch no longer has any effect - build timing is now permanently on") |
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
699 |
return True |
3 | 700 |
|
701 |
def SetParallelParsing(self, type): |
|
702 |
type = type.lower() |
|
703 |
if type == "on": |
|
704 |
self.doParallelParsing = True |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
705 |
elif type == "slave": |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
706 |
self.isParallelParsingSlave = True |
3 | 707 |
elif type == "off": |
708 |
self.doParallelParsing = False |
|
709 |
else: |
|
710 |
self.Warn(" parallel parsing option must be either 'on' or 'off' (was %s)" % type) |
|
711 |
return False |
|
712 |
||
713 |
return True |
|
714 |
||
715 |
def AddProject(self, projectName): |
|
716 |
self.projects.add(projectName.lower()) |
|
717 |
return True |
|
718 |
||
498
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
719 |
def AddQuery(self, q): |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
720 |
self.queries.append(q) |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
721 |
self.mission = Raptor.M_QUERY |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
722 |
return True |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
723 |
|
3 | 724 |
def FilterList(self, value): |
725 |
self.filterList = value |
|
726 |
return True |
|
727 |
||
728 |
def IgnoreOsDetection(self, value): |
|
729 |
self.ignoreOsDetection = value |
|
730 |
return True |
|
731 |
||
732 |
def PrintVersion(self,dummy): |
|
733 |
global name |
|
5 | 734 |
print name, "version", raptor_version.fullversion() |
3 | 735 |
self.mission = Raptor.M_VERSION |
736 |
return False |
|
737 |
||
738 |
# worker methods |
|
739 |
||
740 |
def Introduction(self): |
|
741 |
"""Print a header of useful information about Raptor""" |
|
742 |
||
5 | 743 |
self.Info("%s: version %s\n", name, raptor_version.fullversion()) |
3 | 744 |
|
745 |
self.Info("%s %s", env, str(self.home)) |
|
746 |
self.Info("Set-up %s", str(self.raptorXML)) |
|
747 |
self.Info("Command-line-arguments %s", " ".join(self.args)) |
|
748 |
self.Info("Current working directory %s", os.getcwd()) |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
749 |
|
3 | 750 |
# the inherited environment |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
751 |
for e, value in sorted( os.environ.items() ): |
5 | 752 |
self.Info("Environment %s=%s", e, value.replace("]]>", "]]>")) |
3 | 753 |
|
754 |
# and some general debug stuff |
|
755 |
self.Debug("Platform %s", "-".join(hostplatform)) |
|
756 |
self.Debug("Filesystem %s", self.filesystem) |
|
757 |
self.Debug("Python %d.%d.%d", *sys.version_info[:3]) |
|
758 |
self.Debug("Command-line-parser %s", self.CLI) |
|
759 |
||
760 |
for e,value in self.override.items(): |
|
761 |
self.Debug("Override %s = %s", e, value) |
|
762 |
||
763 |
for t in self.targets: |
|
764 |
self.Debug("Target %s", t) |
|
765 |
||
766 |
||
767 |
def ConfigFile(self): |
|
768 |
if not self.raptorXML.isFile(): |
|
769 |
return |
|
770 |
||
771 |
self.cache.Load(self.raptorXML) |
|
772 |
||
773 |
# find the 'defaults.raptor' variant and extract the values |
|
774 |
try: |
|
775 |
var = self.cache.FindNamedVariant("defaults.init") |
|
776 |
evaluator = self.GetEvaluator( None, raptor_data.BuildUnit(var.name,[var]) ) |
|
777 |
||
778 |
for key, value in defaults.items(): |
|
779 |
newValue = evaluator.Resolve(key) |
|
780 |
||
781 |
if newValue != None: |
|
782 |
# got a string for the value |
|
783 |
if type(value) == types.BooleanType: |
|
784 |
newValue = (newValue.lower() != "false") |
|
785 |
elif type(value) == types.IntType: |
|
786 |
newValue = int(newValue) |
|
787 |
elif isinstance(value, generic_path.Path): |
|
788 |
newValue = generic_path.Path(newValue) |
|
789 |
||
790 |
self.__dict__[key] = newValue |
|
791 |
||
792 |
except KeyError: |
|
793 |
# it is OK to not have this but useful to say it wasn't there |
|
794 |
self.Info("No 'defaults.init' configuration found in " + str(self.raptorXML)) |
|
795 |
||
796 |
||
797 |
def CommandLine(self, args): |
|
798 |
# remember the arguments for the log |
|
799 |
self.args = args |
|
800 |
||
801 |
# assuming self.CLI = "raptor_cli" |
|
580
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
802 |
if not raptor_cli.GetArgs(self, args): |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
803 |
self.skipAll = True # nothing else to do |
3 | 804 |
|
580
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
805 |
def ParseCommandLineTargets(self): |
3 | 806 |
# resolve inter-argument dependencies. |
807 |
# --what or --check implies the WHAT target and FilterWhat Filter |
|
808 |
if self.doWhat or self.doCheck: |
|
809 |
self.targets = ["WHAT"] |
|
810 |
self.filterList = "filterwhat" |
|
811 |
||
812 |
else: |
|
813 |
# 1. CLEAN/CLEANEXPORT/REALLYCLEAN needs the FilterClean filter. |
|
814 |
# 2. Targets that clean should not be combined with other targets. |
|
815 |
||
816 |
targets = [x.lower() for x in self.targets] |
|
817 |
||
818 |
CL = "clean" |
|
819 |
CE = "cleanexport" |
|
820 |
RC = "reallyclean" |
|
821 |
||
822 |
is_clean = 0 |
|
823 |
is_suspicious_clean = 0 |
|
824 |
||
825 |
if CL in targets and CE in targets: |
|
826 |
is_clean = 1 |
|
827 |
if len(targets) > 2: |
|
828 |
is_suspicious_clean = 1 |
|
829 |
elif RC in targets or CL in targets or CE in targets: |
|
830 |
is_clean = 1 |
|
831 |
if len(targets) > 1: |
|
832 |
is_suspicious_clean = 1 |
|
833 |
||
834 |
if is_clean: |
|
835 |
self.filterList += ",filterclean" |
|
836 |
if is_suspicious_clean: |
|
837 |
self.Warn('CLEAN, CLEANEXPORT and a REALLYCLEAN should not be combined with other targets as the result is unpredictable.') |
|
533
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
374
diff
changeset
|
838 |
else: |
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
374
diff
changeset
|
839 |
""" Copyfile implements the <copy> tag which is primarily useful with cluster builds. |
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
374
diff
changeset
|
840 |
It allows file copying to occur on the primary build host rather than on the cluster. |
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
374
diff
changeset
|
841 |
This is more efficient. |
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
374
diff
changeset
|
842 |
""" |
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
374
diff
changeset
|
843 |
self.filterList += ",filtercopyfile" |
3 | 844 |
|
845 |
||
846 |
def ProcessConfig(self): |
|
847 |
# this function will perform additional processing of config |
|
848 |
||
849 |
# create list of generic paths |
|
850 |
self.configPath = generic_path.NormalisePathList(self.systemConfig.split(os.pathsep)) |
|
851 |
||
852 |
def LoadCache(self): |
|
853 |
def mkAbsolute(aGenericPath): |
|
854 |
""" internal function to make a generic_path.Path |
|
855 |
absolute if required""" |
|
856 |
if not aGenericPath.isAbsolute(): |
|
857 |
return self.home.Append(aGenericPath) |
|
858 |
else: |
|
859 |
return aGenericPath |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
860 |
|
3 | 861 |
# make generic paths absolute (if required) |
862 |
self.configPath = map(mkAbsolute, self.configPath) |
|
863 |
self.cache.Load(self.configPath) |
|
864 |
||
865 |
if not self.systemFLM.isAbsolute(): |
|
866 |
self.systemFLM = self.home.Append(self.systemFLM) |
|
867 |
||
868 |
self.cache.Load(self.systemFLM) |
|
869 |
||
870 |
def GetBuildUnitsToBuild(self, configNames): |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
871 |
"""Return a list of the configuration objects that correspond to the |
3 | 872 |
list of configuration names in the configNames parameter. |
873 |
||
874 |
raptor.GetBuildUnitsToBuild(["armv5", "winscw"]) |
|
875 |
>>> [ config1, config2, ... , configN ] |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
876 |
""" |
3 | 877 |
|
878 |
if len(configNames) == 0: |
|
879 |
# use default config |
|
880 |
if len(self.defaultConfig) == 0: |
|
881 |
self.Warn("No default configuration name") |
|
882 |
else: |
|
883 |
configNames.append(self.defaultConfig) |
|
884 |
||
374
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
885 |
buildUnitsToBuild = raptor_data.GetBuildUnits(configNames, self.cache, self) |
3 | 886 |
|
887 |
for b in buildUnitsToBuild: |
|
888 |
self.Info("Buildable configuration '%s'", b.name) |
|
889 |
||
890 |
if len(buildUnitsToBuild) == 0: |
|
891 |
self.Error("No build configurations given") |
|
892 |
||
893 |
return buildUnitsToBuild |
|
894 |
||
895 |
def CheckToolset(self, evaluator, configname): |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
896 |
"""Check the toolset for a particular config, allow other objects access |
3 | 897 |
to the toolset for this build (e.g. the raptor_make class).""" |
898 |
if self.toolset is None: |
|
899 |
if self.toolcheck == 'on': |
|
900 |
self.toolset = raptor_data.ToolSet(log=self) |
|
901 |
elif self.toolcheck == 'forced' : |
|
902 |
self.toolset = raptor_data.ToolSet(log=self, forced=True) |
|
903 |
else: |
|
904 |
return True |
|
905 |
||
906 |
return self.toolset.check(evaluator, configname) |
|
907 |
||
908 |
||
909 |
def CheckConfigs(self, configs): |
|
910 |
""" Tool checking for all the buildable configurations |
|
911 |
NB. We are allowed to use different tool versions for different |
|
912 |
configurations.""" |
|
913 |
||
914 |
tools_ok = True |
|
915 |
for b in configs: |
|
916 |
self.Debug("Tool check for %s", b.name) |
|
917 |
evaluator = self.GetEvaluator(None, b, gathertools=True) |
|
918 |
tools_ok = tools_ok and self.CheckToolset(evaluator, b.name) |
|
919 |
||
920 |
return tools_ok |
|
921 |
||
922 |
||
923 |
||
924 |
def GatherSysModelLayers(self, systemModel, systemDefinitionRequestedLayers): |
|
925 |
"""Return a list of lists of components to be built. |
|
926 |
||
927 |
components = GatherSysModelLayers(self, configurations) |
|
928 |
>>> set("abc/group/bld.inf","def/group/bld.inf, ....") |
|
929 |
""" |
|
930 |
layersToBuild = [] |
|
931 |
||
932 |
if systemModel: |
|
933 |
# We either process all available layers in the system model, or a subset of |
|
934 |
# layers specified on the command line. In both cases, the processing is the same, |
|
935 |
# and can be subject to ordering if explicitly requested. |
|
936 |
systemModel.DumpInfo() |
|
937 |
||
938 |
if systemDefinitionRequestedLayers: |
|
939 |
layersToProcess = systemDefinitionRequestedLayers |
|
940 |
else: |
|
941 |
layersToProcess = systemModel.GetLayerNames() |
|
942 |
||
943 |
for layer in layersToProcess: |
|
944 |
systemModel.DumpLayerInfo(layer) |
|
945 |
||
946 |
if systemModel.IsLayerBuildable(layer): |
|
5 | 947 |
layersToBuild.append(Layer(layer, |
3 | 948 |
systemModel.GetLayerComponents(layer))) |
949 |
||
950 |
return layersToBuild |
|
951 |
||
952 |
||
5 | 953 |
# Add bld.inf or system definition xml to command line layers (depending on preference) |
3 | 954 |
def FindSysDefIn(self, aDir = None): |
955 |
# Find a system definition file |
|
956 |
||
957 |
if aDir is None: |
|
958 |
dir = generic_path.CurrentDir() |
|
959 |
else: |
|
960 |
dir = generic_path.Path(aDir) |
|
961 |
||
962 |
sysDef = dir.Append(self.systemDefinition) |
|
963 |
if not sysDef.isFile(): |
|
964 |
return None |
|
965 |
||
966 |
return sysDef |
|
967 |
||
968 |
||
969 |
def FindComponentIn(self, aDir = None): |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
970 |
# look for a bld.inf |
3 | 971 |
|
972 |
if aDir is None: |
|
973 |
dir = generic_path.CurrentDir() |
|
974 |
else: |
|
975 |
dir = generic_path.Path(aDir) |
|
976 |
||
977 |
bldInf = dir.Append(self.buildInformation) |
|
978 |
||
979 |
if bldInf.isFile(): |
|
980 |
return bldInf |
|
981 |
||
982 |
return None |
|
983 |
||
984 |
def GenerateGenericSpecs(self, configsToBuild): |
|
985 |
# if a Configuration has any config-wide interfaces |
|
986 |
# then add a Specification node to call each of them. |
|
987 |
configWide = {} |
|
988 |
genericSpecs = [] |
|
989 |
for c in configsToBuild: |
|
990 |
evaluator = self.GetEvaluator(None, c) |
|
991 |
iface = evaluator.Get("INTERFACE.config") |
|
992 |
if iface: |
|
993 |
if iface in configWide: |
|
994 |
# seen it already, so reuse the node |
|
995 |
filter = configWide[iface] |
|
996 |
filter.AddConfigCondition(c.name) |
|
997 |
else: |
|
998 |
# create a new node |
|
5 | 999 |
filter = raptor_data.Filter(name = "config_wide") |
3 | 1000 |
filter.AddConfigCondition(c.name) |
1001 |
for i in iface.split(): |
|
1002 |
spec = raptor_data.Specification(i) |
|
1003 |
spec.SetInterface(i) |
|
1004 |
filter.AddChildSpecification(spec) |
|
1005 |
# remember it, use it |
|
1006 |
configWide[iface] = filter |
|
1007 |
genericSpecs.append(filter) |
|
1008 |
||
1009 |
return genericSpecs |
|
1010 |
||
1011 |
||
1012 |
def GetEvaluator(self, specification, configuration, gathertools=False): |
|
1013 |
""" this will perform some caching later """ |
|
5 | 1014 |
return raptor_data.Evaluator(specification, configuration, gathertools=gathertools, cache = self.cache) |
3 | 1015 |
|
1016 |
||
5 | 1017 |
def Make(self, makefileset): |
1018 |
if not self.noBuild and makefileset is not None: |
|
1019 |
if self.maker.Make(makefileset): |
|
1020 |
self.Info("The make-engine exited successfully.") |
|
1021 |
return True |
|
1022 |
else: |
|
1023 |
self.Error("The make-engine exited with errors.") |
|
1024 |
return False |
|
1025 |
else: |
|
1026 |
self.Info("No build performed") |
|
3 | 1027 |
|
1028 |
||
1029 |
||
1030 |
def Report(self): |
|
1031 |
if self.quiet: |
|
1032 |
return |
|
1033 |
||
1034 |
self.endtime = time.time() |
|
1035 |
self.runtime = int(0.5 + self.endtime - self.starttime) |
|
1036 |
self.raptor_params.runtime = self.runtime |
|
1037 |
self.Info("Run time %s seconds" % self.runtime) |
|
1038 |
||
1039 |
def AssertBuildOK(self): |
|
5 | 1040 |
"""Raise a BuildCannotProgressException if no further processing is required |
3 | 1041 |
""" |
1042 |
if self.Skip(): |
|
5 | 1043 |
raise BuildCannotProgressException("") |
3 | 1044 |
|
1045 |
return True |
|
1046 |
||
1047 |
def Skip(self): |
|
1048 |
"""Indicate not to perform operation if: |
|
1049 |
fatalErrorState is set |
|
1050 |
an error code is set but we're not in keepgoing mode |
|
1051 |
""" |
|
1052 |
return self.fatalErrorState or ((self.errorCode != 0) and (not self.keepGoing)) |
|
1053 |
||
1054 |
||
1055 |
# log file open/close |
|
1056 |
||
1057 |
def OpenLog(self): |
|
1058 |
"""Open a log file for the various I/O methods to write to.""" |
|
1059 |
||
1060 |
try: |
|
1061 |
# Find all the raptor plugins and put them into a pluginbox. |
|
1062 |
if not self.systemPlugins.isAbsolute(): |
|
1063 |
self.systemPlugins = self.home.Append(self.systemPlugins) |
|
1064 |
||
1065 |
self.pbox = pluginbox.PluginBox(str(self.systemPlugins)) |
|
1066 |
||
1067 |
self.raptor_params = BuildStats(self) |
|
1068 |
||
1069 |
# Open the requested plugins using the pluginbox |
|
451
153129bf777e
pass optional parameters to log filters from the command line
Richard Taylor <richard.i.taylor@nokia.com>
parents:
268
diff
changeset
|
1070 |
self.out.open(self.raptor_params, self.filterList, self.pbox) |
3 | 1071 |
|
1072 |
# log header |
|
1073 |
self.out.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n") |
|
1074 |
||
1075 |
namespace = "http://symbian.com/xml/build/log" |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1076 |
progress_namespace = "http://symbian.com/xml/build/log/progress" |
3 | 1077 |
schema = "http://symbian.com/xml/build/log/1_0.xsd" |
1078 |
||
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1079 |
self.out.write("<buildlog sbs_version=\"%s\" xmlns=\"%s\" xmlns:progress=\"%s\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"%s %s\">\n" |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1080 |
% (raptor_version.fullversion(), namespace, progress_namespace, namespace, schema)) |
3 | 1081 |
self.logOpen = True |
1082 |
except Exception,e: |
|
1083 |
self.out = sys.stdout # make sure that we can actually get errors out. |
|
1084 |
self.logOpen = False |
|
9 | 1085 |
self.FatalError("Unable to open the output logs: %s" % str(e)) |
3 | 1086 |
|
1087 |
def CloseLog(self): |
|
1088 |
if self.logOpen: |
|
1089 |
self.out.summary() |
|
1090 |
self.out.write("</buildlog>\n") |
|
1091 |
||
1092 |
if not self.out.close(): |
|
1093 |
self.errorCode = 1 |
|
1094 |
||
1095 |
||
1096 |
def Cleanup(self): |
|
1097 |
# ensure that the toolset cache is flushed. |
|
1098 |
if self.toolset is not None: |
|
1099 |
self.toolset.write() |
|
1100 |
||
1101 |
# I/O methods |
|
1102 |
||
1103 |
@staticmethod |
|
1104 |
def attributeString(dictionary): |
|
1105 |
"turn a dictionary into a string of XML attributes" |
|
1106 |
atts = "" |
|
1107 |
for a,v in dictionary.items(): |
|
1108 |
atts += " " + a + "='" + v + "'" |
|
1109 |
return atts |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1110 |
|
3 | 1111 |
def Info(self, format, *extras, **attributes): |
1112 |
"""Send an information message to the configured channel |
|
1113 |
(XML control characters will be escaped) |
|
1114 |
""" |
|
1115 |
self.out.write("<info" + self.attributeString(attributes) + ">" + |
|
1116 |
escape(format % extras) + "</info>\n") |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1117 |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1118 |
def InfoDiscovery(self, object_type, count): |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1119 |
if self.timing: |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1120 |
try: |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1121 |
self.out.write(raptor_timing.Timing.discovery_string(object_type = object_type, |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1122 |
count = count)) |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1123 |
except Exception, exception: |
374
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
1124 |
self.Error(exception.Text, function = "InfoDiscoveryTime") |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1125 |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1126 |
def InfoStartTime(self, object_type, task, key): |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1127 |
if self.timing: |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1128 |
try: |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1129 |
self.out.write(raptor_timing.Timing.start_string(object_type = object_type, |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1130 |
task = task, key = key)) |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1131 |
except Exception, exception: |
374
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
1132 |
self.Error(exception.Text, function = "InfoStartTime") |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1133 |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1134 |
def InfoEndTime(self, object_type, task, key): |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1135 |
if self.timing: |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1136 |
try: |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1137 |
self.out.write(raptor_timing.Timing.end_string(object_type = object_type, |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1138 |
task = task, key = key)) |
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
21
diff
changeset
|
1139 |
except Exception, exception: |
374
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
1140 |
self.Error(exception.Text, function = "InfoEndTime") |
3 | 1141 |
|
1142 |
def Debug(self, format, *extras, **attributes): |
|
1143 |
"Send a debugging message to the configured channel" |
|
1144 |
||
1145 |
# the debug text is out of our control so wrap it in a CDATA |
|
1146 |
# in case it contains characters special to XML... like <> |
|
1147 |
if self.debugOutput: |
|
1148 |
self.out.write("<debug" + self.attributeString(attributes) + ">" + |
|
1149 |
"><![CDATA[\n" + (format % extras) + "\n]]></debug>\n") |
|
1150 |
||
1151 |
def Warn(self, format, *extras, **attributes): |
|
1152 |
"""Send a warning message to the configured channel |
|
1153 |
(XML control characters will be escaped) |
|
1154 |
""" |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1155 |
self.out.write("<warning" + self.attributeString(attributes) + ">" + |
3 | 1156 |
escape(format % extras) + "</warning>\n") |
1157 |
||
1158 |
def FatalError(self, format, *extras, **attributes): |
|
1159 |
"""Send an error message to the configured channel. This implies such a serious |
|
1160 |
error that the entire build must be shut down asap whilst still finishing off |
|
1161 |
correctly whatever housekeeping is possible e.g. producing error reports. |
|
1162 |
Remains quiet if the raptor object is already in a fatal state since there |
|
1163 |
further errors are probably triggered by the first. |
|
1164 |
""" |
|
1165 |
if not self.fatalErrorState: |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1166 |
self.out.write("<error" + self.attributeString(attributes) + ">" + |
3 | 1167 |
(format % extras) + "</error>\n") |
1168 |
self.errorCode = 1 |
|
1169 |
self.fatalErrorState = True |
|
1170 |
||
1171 |
def Error(self, format, *extras, **attributes): |
|
1172 |
"""Send an error message to the configured channel |
|
1173 |
(XML control characters will be escaped) |
|
1174 |
""" |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1175 |
self.out.write("<error" + self.attributeString(attributes) + ">" + |
3 | 1176 |
escape(format % extras) + "</error>\n") |
1177 |
self.errorCode = 1 |
|
1178 |
||
1179 |
||
1180 |
def PrintXML(self, format, *extras): |
|
1181 |
"Print to configured channel (no newline is added) (assumes valid xml)" |
|
1182 |
if format: |
|
1183 |
self.out.write(format % extras) |
|
1184 |
||
5 | 1185 |
def GetLayersFromCLI(self): |
1186 |
"""Returns the list of layers as specified by the |
|
3 | 1187 |
commandline interface to Raptor e.g. parameters |
1188 |
or the current directory""" |
|
5 | 1189 |
layers=[] |
3 | 1190 |
# Look for bld.infs or sysdefs in the current dir if none were specified |
1191 |
if self.systemDefinitionFile == None and len(self.commandlineComponents) == 0: |
|
1192 |
if not self.preferBuildInfoToSystemDefinition: |
|
1193 |
cwd = os.getcwd() |
|
1194 |
self.systemDefinitionFile = self.FindSysDefIn(cwd) |
|
1195 |
if self.systemDefinitionFile == None: |
|
1196 |
aComponent = self.FindComponentIn(cwd) |
|
1197 |
if aComponent: |
|
5 | 1198 |
layers.append(Layer('default',[aComponent])) |
3 | 1199 |
else: |
1200 |
aComponent = self.FindComponentIn(cwd) |
|
1201 |
if aComponent is None: |
|
1202 |
self.systemDefinitionFile = self.FindSysDefIn(cwd) |
|
1203 |
else: |
|
5 | 1204 |
layers.append(Layer('default',[aComponent])) |
3 | 1205 |
|
5 | 1206 |
if len(layers) <= 0 and self.systemDefinitionFile == None: |
3 | 1207 |
self.Warn("No default bld.inf or system definition file found in current directory (%s)", cwd) |
1208 |
||
1209 |
# If we now have a System Definition to parse then get the layers of components |
|
1210 |
if self.systemDefinitionFile != None: |
|
1211 |
systemModel = raptor_xml.SystemModel(self, self.systemDefinitionFile, self.systemDefinitionBase) |
|
5 | 1212 |
layers = self.GatherSysModelLayers(systemModel, self.systemDefinitionRequestedLayers) |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1213 |
|
3 | 1214 |
# Now get components specified on a commandline - build them after any |
1215 |
# layers in the system definition. |
|
1216 |
if len(self.commandlineComponents) > 0: |
|
5 | 1217 |
layers.append(Layer('commandline',self.commandlineComponents)) |
3 | 1218 |
|
1219 |
# If we aren't building components in order then flatten down |
|
1220 |
# the groups |
|
1221 |
if not self.systemDefinitionOrderLayers: |
|
1222 |
# Flatten the layers into one group of components if |
|
1223 |
# we are not required to build them in order. |
|
5 | 1224 |
newcg = Layer("all") |
1225 |
for cg in layers: |
|
1226 |
for c in cg: |
|
1227 |
newcg.add(c) |
|
1228 |
layers = [newcg] |
|
3 | 1229 |
|
5 | 1230 |
return layers |
3 | 1231 |
|
498
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1232 |
def Query(self): |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1233 |
"process command-line queries." |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1234 |
|
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1235 |
if self.mission != Raptor.M_QUERY: |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1236 |
return 0 |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1237 |
|
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1238 |
# establish an object cache based on the current settings |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1239 |
self.LoadCache() |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1240 |
|
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1241 |
# our "self" is a valid object for initialising an API Context |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1242 |
import raptor_api |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1243 |
api = raptor_api.Context(self) |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1244 |
|
504
ea75c3a64a17
change to lowercase method names
Richard Taylor <richard.i.taylor@nokia.com>
parents:
498
diff
changeset
|
1245 |
print "<sbs version='%s'>" % raptor_version.numericversion() |
498
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1246 |
|
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1247 |
for q in self.queries: |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1248 |
try: |
504
ea75c3a64a17
change to lowercase method names
Richard Taylor <richard.i.taylor@nokia.com>
parents:
498
diff
changeset
|
1249 |
print api.stringquery(q) |
498
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1250 |
|
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1251 |
except Exception, e: |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1252 |
self.Error("exception '%s' with query '%s'", str(e), q) |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1253 |
|
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1254 |
print "</sbs>" |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1255 |
return self.errorCode |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1256 |
|
3 | 1257 |
def Build(self): |
1258 |
||
1259 |
if self.mission != Raptor.M_BUILD: # help or version requested instead. |
|
1260 |
return 0 |
|
1261 |
||
1262 |
# open the log file |
|
1263 |
self.OpenLog() |
|
1264 |
||
1265 |
||
1266 |
try: |
|
1267 |
# show the command and platform info |
|
1268 |
self.AssertBuildOK() |
|
1269 |
self.Introduction() |
|
1270 |
# establish an object cache |
|
1271 |
self.AssertBuildOK() |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1272 |
|
3 | 1273 |
self.LoadCache() |
1274 |
||
1275 |
# find out what configurations to build |
|
1276 |
self.AssertBuildOK() |
|
1277 |
buildUnitsToBuild = self.GetBuildUnitsToBuild(self.configNames) |
|
1278 |
||
374
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
1279 |
if len(buildUnitsToBuild) == 0: |
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
1280 |
raise BuildCannotProgressException("No configurations to build.") |
96629a6f26e4
fault tolerant XML groups
Richard Taylor <richard.i.taylor@nokia.com>
parents:
372
diff
changeset
|
1281 |
|
5 | 1282 |
self.buildUnitsToBuild = buildUnitsToBuild |
1283 |
||
3 | 1284 |
# find out what components to build, and in what way |
5 | 1285 |
layers = [] |
3 | 1286 |
|
1287 |
self.AssertBuildOK() |
|
1288 |
if len(buildUnitsToBuild) >= 0: |
|
5 | 1289 |
layers = self.GetLayersFromCLI() |
3 | 1290 |
|
5 | 1291 |
componentCount = reduce(lambda x,y : x + y, [len(cg) for cg in layers]) |
3 | 1292 |
|
1293 |
if not componentCount > 0: |
|
5 | 1294 |
raise BuildCannotProgressException("No components to build.") |
3 | 1295 |
|
1296 |
# check the configurations (tools versions) |
|
1297 |
self.AssertBuildOK() |
|
1298 |
||
1299 |
if self.toolcheck != 'off': |
|
1300 |
self.CheckConfigs(buildUnitsToBuild) |
|
1301 |
else: |
|
191
3bfc260b6d61
fix: better error messages when an incorrect make engine is specified. Requires that all make engine variants should extend "make_engine".
timothy.murphy@nokia.com
parents:
136
diff
changeset
|
1302 |
self.Info("Not Checking Tool Versions") |
3 | 1303 |
|
1304 |
self.AssertBuildOK() |
|
1305 |
||
5 | 1306 |
# Setup a make engine. |
1307 |
if not self.maker: |
|
191
3bfc260b6d61
fix: better error messages when an incorrect make engine is specified. Requires that all make engine variants should extend "make_engine".
timothy.murphy@nokia.com
parents:
136
diff
changeset
|
1308 |
try: |
193
8e61308a207e
don't break sbs_init.xml files with make engine validation changes
timothy.murphy@nokia.com
parents:
191
diff
changeset
|
1309 |
self.maker = raptor_make.MakeEngine(self, self.makeEngine) |
191
3bfc260b6d61
fix: better error messages when an incorrect make engine is specified. Requires that all make engine variants should extend "make_engine".
timothy.murphy@nokia.com
parents:
136
diff
changeset
|
1310 |
except raptor_make.BadMakeEngineException,e: |
3bfc260b6d61
fix: better error messages when an incorrect make engine is specified. Requires that all make engine variants should extend "make_engine".
timothy.murphy@nokia.com
parents:
136
diff
changeset
|
1311 |
self.Error("Unable to use make engine: %s " % str(e)) |
3bfc260b6d61
fix: better error messages when an incorrect make engine is specified. Requires that all make engine variants should extend "make_engine".
timothy.murphy@nokia.com
parents:
136
diff
changeset
|
1312 |
|
3 | 1313 |
|
5 | 1314 |
self.AssertBuildOK() |
1315 |
||
1316 |
# if self.doParallelParsing and not (len(layers) == 1 and len(layers[0]) == 1): |
|
3 | 1317 |
if self.doParallelParsing: |
1318 |
# Create a Makefile to parse components in parallel and build them |
|
5 | 1319 |
for l in layers: |
1320 |
l.meta_realise(self) |
|
3 | 1321 |
else: |
1322 |
# Parse components serially, creating one set of makefiles |
|
1323 |
# create non-component specs |
|
5 | 1324 |
self.generic_specs = self.GenerateGenericSpecs(buildUnitsToBuild) |
3 | 1325 |
|
1326 |
self.AssertBuildOK() |
|
5 | 1327 |
for l in layers: |
3 | 1328 |
# create specs for a specific group of components |
5 | 1329 |
l.realise(self) |
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1330 |
|
5 | 1331 |
except BuildCannotProgressException,b: |
3 | 1332 |
if str(b) != "": |
1333 |
self.Info(str(b)) |
|
1334 |
||
1335 |
# final report |
|
1336 |
if not self.fatalErrorState: |
|
1337 |
self.Report() |
|
1338 |
||
1339 |
self.Cleanup() |
|
1340 |
||
1341 |
# close the log file |
|
1342 |
self.CloseLog() |
|
1343 |
||
1344 |
return self.errorCode |
|
1345 |
||
1346 |
@classmethod |
|
1347 |
def CreateCommandlineBuild(cls, argv): |
|
1348 |
""" Perform a 'typical' build. """ |
|
1349 |
# configure the framework |
|
1350 |
||
1351 |
build = Raptor() |
|
1352 |
build.AssertBuildOK() |
|
1353 |
build.ConfigFile() |
|
1354 |
build.ProcessConfig() |
|
1355 |
build.CommandLine(argv) |
|
580
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1356 |
build.ParseCommandLineTargets() |
3 | 1357 |
|
59
0f7d6c11c675
Environment variables in the log are sorted alphabetically.
Stefan Karlsson <stefan.karlsson@nokia.com>
parents:
29
diff
changeset
|
1358 |
return build |
580
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1359 |
|
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1360 |
@classmethod |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1361 |
def CreateCommandlineAnalysis(cls, argv): |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1362 |
""" Perform an analysis run where a build is not performed. """ |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1363 |
build = Raptor() |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1364 |
build.AssertBuildOK() |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1365 |
build.ConfigFile() |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1366 |
build.ProcessConfig() |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1367 |
build.CommandLine(argv) |
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1368 |
# Don't parse command line targets - they don't make any sense if you're not doing a build |
3 | 1369 |
|
580
6209aeff0f73
Fixing sbs_filter issue.
Iain Williamson <iain.williamson@nokia.com>
parents:
553
diff
changeset
|
1370 |
return build |
3 | 1371 |
|
1372 |
||
1373 |
# Class for passing constricted parameters to filters |
|
1374 |
class BuildStats(object): |
|
1375 |
||
1376 |
def __init__(self, raptor_instance): |
|
115
5869e06bf2ac
Cause whatcomp output to use the incoming epocroot value. i.e. if epocroot is relative then so is the what output.
timothy.murphy@nokia.com
parents:
59
diff
changeset
|
1377 |
self.incoming_epocroot = incoming_epocroot |
5869e06bf2ac
Cause whatcomp output to use the incoming epocroot value. i.e. if epocroot is relative then so is the what output.
timothy.murphy@nokia.com
parents:
59
diff
changeset
|
1378 |
self.epocroot = epocroot |
3 | 1379 |
self.logFileName = raptor_instance.logFileName |
1380 |
self.quiet = raptor_instance.quiet |
|
1381 |
self.doCheck = raptor_instance.doCheck |
|
1382 |
self.doWhat = raptor_instance.doWhat |
|
1383 |
self.platform = hostplatform |
|
1384 |
self.skipAll = raptor_instance.fatalErrorState |
|
1385 |
self.timestring = raptor_instance.timestring |
|
1386 |
self.targets = raptor_instance.targets |
|
1387 |
self.runtime = 0 |
|
1388 |
self.name = name |
|
1389 |
||
1390 |
||
1391 |
# raptor module functions |
|
1392 |
||
1393 |
def Main(argv): |
|
1394 |
"""The main entry point for Raptor. |
|
1395 |
||
1396 |
argv is a list of command-line parameters, |
|
1397 |
NOT including the name of the calling script. |
|
1398 |
||
1399 |
The return value is zero for success and non-zero for failure.""" |
|
1400 |
||
1401 |
DisplayBanner() |
|
1402 |
||
1403 |
# object which represents a build |
|
1404 |
b = Raptor.CreateCommandlineBuild(argv) |
|
1405 |
||
498
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1406 |
if b.mission == Raptor.M_QUERY: |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1407 |
return b.Query() |
564986768b79
add --query option
Richard Taylor <richard.i.taylor@nokia.com>
parents:
457
diff
changeset
|
1408 |
|
5 | 1409 |
return b.Build() |
3 | 1410 |
|
1411 |
||
1412 |
def DisplayBanner(): |
|
1413 |
"""Stuff that needs printing out for every command.""" |
|
1414 |
pass |
|
1415 |
||
1416 |
||
1417 |
||
5 | 1418 |
|
3 | 1419 |
# end of the raptor module |