5
|
1 |
#
|
|
2 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
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 |
#
|
|
14 |
# Description:
|
|
15 |
# Classes, methods and regex available for use in log filters
|
|
16 |
#
|
|
17 |
|
|
18 |
# This particular file is preliminary and under development.
|
|
19 |
|
|
20 |
class BuildPlatform(object):
|
|
21 |
""" A build platform is a set of configurations which share
|
|
22 |
the same metadata. In other words, a set of configurations
|
|
23 |
for which the bld.inf and MMP files pre-process to exactly
|
|
24 |
the same text."""
|
|
25 |
|
|
26 |
def __init__(self, build):
|
|
27 |
evaluator = build.GetEvaluator(None, buildConfig)
|
|
28 |
self.selfform= evaluator.CheckedGet("TRADITIONAL_PLATFORM")
|
|
29 |
epocroot = evaluator.CheckedGet("EPOCROOT")
|
|
30 |
self.epocroot = generic_path.Path(epocroot)
|
|
31 |
|
|
32 |
sbs_build_dir = evaluator.CheckedGet("SBS_BUILD_DIR")
|
|
33 |
self.sbs_build_dir = generic_path.Path(sbs_build_dir)
|
|
34 |
flm_export_dir = evaluator.CheckedGet("FLM_EXPORT_DIR")
|
|
35 |
self.flm_export_dir = generic_path.Path(flm_export_dir)
|
|
36 |
self.cacheid = flm_export_dir
|
|
37 |
if raptor_utilities.getOSPlatform().startswith("win"):
|
|
38 |
self.platmacros = evaluator.CheckedGet( "PLATMACROS.WINDOWS")
|
|
39 |
else:
|
|
40 |
self.platmacros = evaluator.CheckedGet( "PLATMACROS.LINUX")
|
|
41 |
|
|
42 |
|
|
43 |
# is this a feature variant config or an ordinary variant
|
|
44 |
fv = evaluator.Get("FEATUREVARIANTNAME")
|
|
45 |
if fv:
|
|
46 |
variantHdr = evaluator.CheckedGet("VARIANT_HRH")
|
|
47 |
variantHRH = generic_path.Path(variantHdr)
|
|
48 |
self.isfeaturevariant = True
|
|
49 |
else:
|
|
50 |
variantCfg = evaluator.CheckedGet("VARIANT_CFG")
|
|
51 |
variantCfg = generic_path.Path(variantCfg)
|
|
52 |
if not variantCfg in variantCfgs:
|
|
53 |
# get VARIANT_HRH from the variant.cfg file
|
|
54 |
varCfg = getVariantCfgDetail(self.epocroot, variantCfg)
|
|
55 |
variantCfgs[variantCfg] = varCfg['VARIANT_HRH']
|
|
56 |
# we expect to always build ABIv2
|
|
57 |
if not 'ENABLE_ABIV2_MODE' in varCfg:
|
|
58 |
build.Warn("missing flag ENABLE_ABIV2_MODE in %s file. ABIV1 builds are not supported.",
|
|
59 |
str(variantCfg))
|
|
60 |
variantHRH = variantCfgs[variantCfg]
|
|
61 |
self.isfeaturevariant = False
|
|
62 |
|
|
63 |
self.variant_hrh = variantHRH
|
|
64 |
build.Info("'%s' uses variant hrh file '%s'", buildConfig.name, variantHRH)
|
|
65 |
self.systeminclude = evaluator.CheckedGet("SYSTEMINCLUDE")
|
|
66 |
|
|
67 |
|
|
68 |
# find all the interface names we need
|
|
69 |
ifaceTypes = evaluator.CheckedGet("INTERFACE_TYPES")
|
|
70 |
interfaces = ifaceTypes.split()
|
|
71 |
|
|
72 |
for iface in interfaces:
|
|
73 |
detail[iface] = evaluator.CheckedGet("INTERFACE." + iface)
|
|
74 |
|
|
75 |
# not test code unless positively specified
|
|
76 |
self.testcode = evaluator.CheckedGet("TESTCODE", "")
|
|
77 |
|
|
78 |
# make a key that identifies this platform uniquely
|
|
79 |
# - used to tell us whether we have done the pre-processing
|
|
80 |
# we need already using another platform with compatible values.
|
|
81 |
|
|
82 |
key = str(self.variant_hrh) \
|
|
83 |
+ str(self.epocroot) \
|
|
84 |
+ self.systeminclude \
|
|
85 |
+ self.platform
|
|
86 |
|
|
87 |
# Keep a short version of the key for use in filenames.
|
|
88 |
uniq = hashlib.md5()
|
|
89 |
uniq.update(key)
|
|
90 |
|
|
91 |
plat.key = key
|
|
92 |
plat.key_md5 = "p_" + uniq.hexdigest()
|
|
93 |
del uniq
|
|
94 |
|
|
95 |
def __hash__(self):
|
|
96 |
return hash(self.platform) + hash(self.epocroot) + hash(self.variant_hrh) + hash(self.systeminclude) + hash(self.testcode)
|
|
97 |
|
|
98 |
def __cmp__(self,other):
|
|
99 |
return cmp(self.hash(), other.hash())
|
|
100 |
|
|
101 |
|
|
102 |
@classmethod
|
|
103 |
def fromConfigs(configsToBuild, build):
|
|
104 |
""" Group the list of configurations into "build platforms"."""
|
|
105 |
platforms = Set()
|
|
106 |
|
|
107 |
for buildConfig in configsToBuild:
|
|
108 |
# get everything we need to know about the configuration
|
|
109 |
plat = BuildPlatform(build = build)
|
|
110 |
|
|
111 |
# compare this configuration to the ones we have already seen
|
|
112 |
|
|
113 |
# Is this an unseen export platform?
|
|
114 |
# concatenate all the values we care about in a fixed order
|
|
115 |
# and use that as a signature for the exports.
|
|
116 |
items = ['EPOCROOT', 'VARIANT_HRH', 'SYSTEMINCLUDE', 'TESTCODE', 'export']
|
|
117 |
export = ""
|
|
118 |
for i in items:
|
|
119 |
if i in detail:
|
|
120 |
export += i + str(detail[i])
|
|
121 |
|
|
122 |
if export in exports:
|
|
123 |
# add this configuration to an existing export platform
|
|
124 |
index = exports[export]
|
|
125 |
self.ExportPlatforms[index]['configs'].append(buildConfig)
|
|
126 |
else:
|
|
127 |
# create a new export platform with this configuration
|
|
128 |
exports[export] = len(self.ExportPlatforms)
|
|
129 |
exp = copy.copy(detail)
|
|
130 |
exp['PLATFORM'] = 'EXPORT'
|
|
131 |
exp['configs'] = [buildConfig]
|
|
132 |
self.ExportPlatforms.append(exp)
|
|
133 |
|
|
134 |
# Is this an unseen build platform?
|
|
135 |
# concatenate all the values we care about in a fixed order
|
|
136 |
# and use that as a signature for the platform.
|
|
137 |
items = ['PLATFORM', 'EPOCROOT', 'VARIANT_HRH', 'SYSTEMINCLUDE', 'TESTCODE']
|
|
138 |
if raptor_utilities.getOSPlatform().startswith("win"):
|
|
139 |
items.append('PLATMACROS.WINDOWS')
|
|
140 |
else:
|
|
141 |
items.append('PLATMACROS.LINUX')
|
|
142 |
|
|
143 |
items.extend(interfaces)
|
|
144 |
platform = ""
|
|
145 |
for i in items:
|
|
146 |
if i in detail:
|
|
147 |
platform += i + str(detail[i])
|
|
148 |
|
|
149 |
if platform in platforms:
|
|
150 |
# add this configuration to an existing build platform
|
|
151 |
index = platforms[platform]
|
|
152 |
BuildPlatforms[index]['configs'].append(buildConfig)
|
|
153 |
else:
|
|
154 |
# create a new build platform with this configuration
|
|
155 |
platforms[platform] = len(self.BuildPlatforms)
|
|
156 |
plat.configs = [buildConfig]
|
|
157 |
BuildPlatforms.append(detail)
|
|
158 |
|