sbsv2/raptor/python/raptor_meta.py
branchwip
changeset 5 593a8820b912
parent 3 e1eecf4d390d
child 9 b211d87c390a
child 11 ea23b18a2ff6
equal deleted inserted replaced
3:e1eecf4d390d 5:593a8820b912
   230 		commentDetail.append(linenumber)
   230 		commentDetail.append(linenumber)
   231 
   231 
   232 	return commentDetail
   232 	return commentDetail
   233 
   233 
   234 
   234 
       
   235 def getSpecName(aFileRoot, fullPath=False):
       
   236 	"""Returns a build spec name: this is the file root (full path
       
   237 	or simple file name) made safe for use as a file name."""
       
   238 
       
   239 	if fullPath:
       
   240 		specName = str(aFileRoot).replace("/","_")
       
   241 		specName = specName.replace(":","")
       
   242 	else:
       
   243 		specName = aFileRoot.File()
       
   244 
       
   245 	return specName.lower()
       
   246 
       
   247 
   235 # Classes
   248 # Classes
   236 
   249 
   237 class MetaDataError(Exception):
   250 class MetaDataError(Exception):
   238 	"""Fatal error wrapper, to be thrown directly back to whatever is calling."""
   251 	"""Fatal error wrapper, to be thrown directly back to whatever is calling."""
   239 
   252 
   396 
   409 
   397 	Symbian metadata files are subject to preprocessing, primarily with macros based
   410 	Symbian metadata files are subject to preprocessing, primarily with macros based
   398 	on the selected build platform.  This class provides a generic means of wrapping
   411 	on the selected build platform.  This class provides a generic means of wrapping
   399 	up the preprocessing of such files."""
   412 	up the preprocessing of such files."""
   400 
   413 
   401 	def __init__(self, aFilename, gnucpp, aRootLocation=None, log=None):
   414 	def __init__(self, aFilename, gnucpp, depfiles, aRootLocation=None, log=None):
   402 		"""
   415 		"""
   403 		@param aFilename	An MMP, bld.inf or other preprocessable build spec file
   416 		@param aFilename	An MMP, bld.inf or other preprocessable build spec file
   404 		@param aDefaultPlatform  Default preprocessed version of this file
   417 		@param aDefaultPlatform  Default preprocessed version of this file
   405 		@param aCPP 		location of GNU CPP
   418 		@param aCPP 		location of GNU CPP
       
   419 		@param depfiles     	list to add dependency file tuples to
       
   420 		@param aRootLocation    where the file is 
   406 		@param log 		A class with Debug(<string>), Info(<string>) and Error(<string>) methods
   421 		@param log 		A class with Debug(<string>), Info(<string>) and Error(<string>) methods
   407 		"""
   422 		"""
   408 		self.filename = aFilename
   423 		self.filename = aFilename
   409 		self.__RootLocation = aRootLocation
   424 		self.__RootLocation = aRootLocation
   410 		# Dictionary with key of build platform and a text string of processed output as values
   425 		# Dictionary with key of build platform and a text string of processed output as values
   411 		self.__PreProcessedContent = {}
   426 		self.__PreProcessedContent = {}
   412 		self.log = log
   427 		self.log = log
       
   428 		self.depfiles = depfiles
   413 
   429 
   414 		self.__gnucpp = gnucpp
   430 		self.__gnucpp = gnucpp
   415 		if gnucpp is None:
   431 		if gnucpp is None:
   416 			raise ValueError('gnucpp must be set')
   432 			raise ValueError('gnucpp must be set')
   417 
   433 
   434 			if raptor_utilities.getOSPlatform().startswith("win"):
   450 			if raptor_utilities.getOSPlatform().startswith("win"):
   435 				metatarget = "$(PARSETARGET)"
   451 				metatarget = "$(PARSETARGET)"
   436 			else:
   452 			else:
   437 				metatarget = "'$(PARSETARGET)'"
   453 				metatarget = "'$(PARSETARGET)'"
   438 			generateDepsOptions = "-MD -MF%s -MT%s" % (adepfilename, metatarget)
   454 			generateDepsOptions = "-MD -MF%s -MT%s" % (adepfilename, metatarget)
   439 			aBuildPlatform['METADEPS'].append((adepfilename, metatarget))
   455 			self.depfiles.append((adepfilename, metatarget))
   440 			try:
   456 			try:
   441 				os.makedirs(os.path.dirname(adepfilename))
   457 				os.makedirs(os.path.dirname(adepfilename))
   442 			except Exception, e:
   458 			except Exception, e:
   443 				self.log.Debug("Couldn't make bldinf outputpath for dependency generation")
   459 				self.log.Debug("Couldn't make bldinf outputpath for dependency generation")
   444 
   460 
   513 
   529 
   514 	Symbian metadata files are subject to preprocessing, primarily with macros based
   530 	Symbian metadata files are subject to preprocessing, primarily with macros based
   515 	on the selected build platform.  This class provides a generic means of wrapping
   531 	on the selected build platform.  This class provides a generic means of wrapping
   516 	up the preprocessing of such files."""
   532 	up the preprocessing of such files."""
   517 
   533 
   518 	def __init__(self, aFilename, gnucpp, bldinf, log=None):
   534 	def __init__(self, aFilename, gnucpp, bldinf, depfiles, log=None):
   519 		"""
   535 		"""
   520 		@param aFilename	An MMP, bld.inf or other preprocessable build spec file
   536 		@param aFilename	An MMP, bld.inf or other preprocessable build spec file
   521 		@param gnucpp 		location of GNU CPP
   537 		@param gnucpp 		location of GNU CPP
   522 		@param bldinf   	the bldinf file that this mmp comes from
   538 		@param bldinf		the bld.inf file this mmp was specified in
   523 		@param log 			A class with Debug(<string>), Info(<string>) and Error(<string>) methods
   539 		@param depfiles         list to fill with mmp dependency files
       
   540 		@param log 		A class with Debug(<string>), Info(<string>) and Error(<string>) methods
   524 		"""
   541 		"""
   525 		super(MMPFile, self).__init__(aFilename, gnucpp, str(bldinf.filename.Dir()), log)
   542 		super(MMPFile, self).__init__(aFilename, gnucpp, depfiles, str(bldinf.filename.Dir()),  log)
   526 		self.__bldinf = bldinf
   543 		self.__bldinf = bldinf
       
   544 		self.depfiles = depfiles
   527 
   545 
   528 		self.__gnucpp = gnucpp
   546 		self.__gnucpp = gnucpp
   529 		if gnucpp is None:
   547 		if gnucpp is None:
   530 			raise ValueError('gnucpp must be set')
   548 			raise ValueError('gnucpp must be set')
   531 
   549 
   876 
   894 
   877 
   895 
   878 class BldInfFile(MetaDataFile):
   896 class BldInfFile(MetaDataFile):
   879 	"""Representation of a Symbian bld.inf file"""
   897 	"""Representation of a Symbian bld.inf file"""
   880 
   898 
   881 	def __init__(self, aFilename, gnucpp, log=None):
   899 	def __init__(self, aFilename, gnucpp, depfiles, log=None):
   882 		MetaDataFile.__init__(self, aFilename, gnucpp, None, log)
   900 		MetaDataFile.__init__(self, aFilename, gnucpp, depfiles, None, log)
   883 		self.__Raptor = log
   901 		self.__Raptor = log
   884 		self.testManual = 0
   902 		self.testManual = 0
   885 		self.testAuto = 0
   903 		self.testAuto = 0
   886 	# Generic
   904 	# Generic
   887 
   905 
  1192 
  1210 
  1193 	def __init__(self, aRaptor, aMmpfilename, aBldInfFilename):
  1211 	def __init__(self, aRaptor, aMmpfilename, aBldInfFilename):
  1194 		super(MMPRaptorBackend,self).__init__()
  1212 		super(MMPRaptorBackend,self).__init__()
  1195 		self.platformblock = None
  1213 		self.platformblock = None
  1196 		self.__Raptor = aRaptor
  1214 		self.__Raptor = aRaptor
  1197 		self.BuildVariant = raptor_data.Variant()
  1215 		self.__debug("-----+++++ %s " % aMmpfilename)
       
  1216 		self.BuildVariant = raptor_data.Variant(name = "mmp")
  1198 		self.ResourceVariants = []
  1217 		self.ResourceVariants = []
  1199 		self.BitmapVariants = []
  1218 		self.BitmapVariants = []
  1200 		self.StringTableVariants = []
  1219 		self.StringTableVariants = []
  1201 		self.__bldInfFilename = aBldInfFilename
  1220 		self.__bldInfFilename = aBldInfFilename
  1202 		self.__targettype = "UNKNOWN"
  1221 		self.__targettype = "UNKNOWN"
  1206 		self.__sourcepath = raptor_utilities.resolveSymbianPath(self.__currentMmpFile, "")
  1225 		self.__sourcepath = raptor_utilities.resolveSymbianPath(self.__currentMmpFile, "")
  1207 		self.__userinclude = ""
  1226 		self.__userinclude = ""
  1208 		self.__systeminclude = ""
  1227 		self.__systeminclude = ""
  1209 		self.__bitmapSourcepath = self.__sourcepath
  1228 		self.__bitmapSourcepath = self.__sourcepath
  1210 		self.__current_resource = ""
  1229 		self.__current_resource = ""
  1211 		self.__capabilities = []
       
  1212 		self.__resourceFiles = []
       
  1213 		self.__pageConflict = []
  1230 		self.__pageConflict = []
  1214 		self.__debuggable = ""
  1231 		self.__debuggable = ""
       
  1232 		self.__resourceFiles = []
  1215 		self.sources = []
  1233 		self.sources = []
       
  1234 		self.capabilities = []
  1216 
  1235 
  1217 		self.__TARGET = ""
  1236 		self.__TARGET = ""
  1218 		self.__TARGETEXT = ""
  1237 		self.__TARGETEXT = ""
  1219 		self.deffile = ""
  1238 		self.deffile = ""
  1220 		self.__LINKAS = ""
  1239 		self.__LINKAS = ""
  1421 			self.__debug("Set "+varname+" to " + libName)
  1440 			self.__debug("Set "+varname+" to " + libName)
  1422 			self.BuildVariant.AddOperation(raptor_data.Set(varname,"".join(libName)))
  1441 			self.BuildVariant.AddOperation(raptor_data.Set(varname,"".join(libName)))
  1423 
  1442 
  1424 		elif varname=='CAPABILITY':
  1443 		elif varname=='CAPABILITY':
  1425 			for cap in toks[1]:
  1444 			for cap in toks[1]:
  1426 				self.BuildVariant.AddOperation(raptor_data.Append(varname,cap," "))
       
  1427 				self.__debug("Setting  "+toks[0]+": " + cap)
  1445 				self.__debug("Setting  "+toks[0]+": " + cap)
  1428 				self.__capabilities.append(cap.lower())
  1446 				self.capabilities.append(cap)
  1429 		elif varname=='DEFFILE':
  1447 		elif varname=='DEFFILE':
  1430 			self.__defFileRoot = self.__currentMmpFile
  1448 			self.__defFileRoot = self.__currentMmpFile
  1431 			self.deffile = toks[1]
  1449 			self.deffile = toks[1]
  1432 		elif varname=='LINKAS':
  1450 		elif varname=='LINKAS':
  1433 			self.__debug("Set "+toks[0]+"  OPTION to " + str(toks[1]))
  1451 			self.__debug("Set "+toks[0]+"  OPTION to " + str(toks[1]))
  1765 					# be a replacement to consider
  1783 					# be a replacement to consider
  1766 					search = match
  1784 					search = match
  1767 					replace = ""
  1785 					replace = ""
  1768 					if len(matches):
  1786 					if len(matches):
  1769 						replace = matches.pop()
  1787 						replace = matches.pop()
  1770 					
  1788 
  1771 					searchReplacePairs.append('%s<->%s' % (search, replace))
  1789 					searchReplacePairs.append('%s<->%s' % (search, replace))
  1772 
  1790 
  1773 			# Replace spaces to maintain word-based grouping in downstream makefile lists
  1791 			# Replace spaces to maintain word-based grouping in downstream makefile lists
  1774 			for i in range(0,len(searchReplacePairs)):
  1792 			for i in range(0,len(searchReplacePairs)):
  1775 				searchReplacePairs[i] = searchReplacePairs[i].replace(' ','%20')
  1793 				searchReplacePairs[i] = searchReplacePairs[i].replace(' ','%20')
  1884 
  1902 
  1885 	def doStartBitmap(self,s,loc,toks):
  1903 	def doStartBitmap(self,s,loc,toks):
  1886 		self.__currentLineNumber += 1
  1904 		self.__currentLineNumber += 1
  1887 		self.__debug("Start BITMAP "+toks[1])
  1905 		self.__debug("Start BITMAP "+toks[1])
  1888 
  1906 
  1889 		self.__currentBitmapVariant = raptor_data.Variant(toks[1].replace('.','_'))
  1907 		self.__currentBitmapVariant = raptor_data.Variant(name = toks[1].replace('.','_'))
  1890 		# Use BMTARGET and BMTARGET_lower because that prevents
  1908 		# Use BMTARGET and BMTARGET_lower because that prevents
  1891 		# confusion with the TARGET and TARGET_lower of our parent MMP
  1909 		# confusion with the TARGET and TARGET_lower of our parent MMP
  1892 		# when setting the OUTPUTPATH.  This in turn allows us to
  1910 		# when setting the OUTPUTPATH.  This in turn allows us to
  1893 		# not get tripped up by multiple mbms being generated with
  1911 		# not get tripped up by multiple mbms being generated with
  1894 		# the same name to the same directory.
  1912 		# the same name to the same directory.
  1974 
  1992 
  1975 		self.__debug("sourcepath: " + self.__sourcepath)
  1993 		self.__debug("sourcepath: " + self.__sourcepath)
  1976 		self.__debug("stringtable: " + toks[1])
  1994 		self.__debug("stringtable: " + toks[1])
  1977 		self.__debug("adjusted stringtable source=" + source)
  1995 		self.__debug("adjusted stringtable source=" + source)
  1978 
  1996 
  1979 		self.__currentStringTableVariant = raptor_data.Variant(uniqname)
  1997 		self.__currentStringTableVariant = raptor_data.Variant(name = uniqname)
  1980 		self.__currentStringTableVariant.AddOperation(raptor_data.Set("SOURCE", source))
  1998 		self.__currentStringTableVariant.AddOperation(raptor_data.Set("SOURCE", source))
  1981 		self.__currentStringTableVariant.AddOperation(raptor_data.Set("EXPORTPATH", ""))
  1999 		self.__currentStringTableVariant.AddOperation(raptor_data.Set("EXPORTPATH", ""))
  1982 		self.__stringtableExported = False
  2000 		self.__stringtableExported = False
  1983 
  2001 
  1984 		# The target name by default is the name of the stringtable without the extension
  2002 		# The target name by default is the name of the stringtable without the extension
  2167 
  2185 
  2168 		for i,var in enumerate(self.ResourceVariants):
  2186 		for i,var in enumerate(self.ResourceVariants):
  2169 			self.ResourceVariants[i].AddOperation(raptor_data.Set("MAIN_TARGET_lower", self.__TARGET.lower()))
  2187 			self.ResourceVariants[i].AddOperation(raptor_data.Set("MAIN_TARGET_lower", self.__TARGET.lower()))
  2170 			self.ResourceVariants[i].AddOperation(raptor_data.Set("MAIN_REQUESTEDTARGETEXT", self.__TARGETEXT.lower()))
  2188 			self.ResourceVariants[i].AddOperation(raptor_data.Set("MAIN_REQUESTEDTARGETEXT", self.__TARGETEXT.lower()))
  2171 
  2189 
       
  2190 		# Create Capability variable in one SET operation (more efficient than multiple appends)
       
  2191 		self.BuildVariant.AddOperation(raptor_data.Set("CAPABILITY"," ".join(self.capabilities)))
       
  2192 
  2172 		# Resolve combined capabilities as hex flags, for configurations that require them
  2193 		# Resolve combined capabilities as hex flags, for configurations that require them
  2173 		capabilityFlag1 = 0
  2194 		capabilityFlag1 = 0
  2174 		capabilityFlag2 = 0			# Always 0
  2195 		capabilityFlag2 = 0			# Always 0
  2175 
  2196 
  2176 		for capability in self.__capabilities:
  2197 		for capability in [c.lower() for c in self.capabilities]:
  2177 			invert = 0
  2198 			invert = 0
  2178 
  2199 
  2179 			if capability.startswith('-'):
  2200 			if capability.startswith('-'):
  2180 				invert = 0xffffffff
  2201 				invert = 0xffffffff
  2181 				capability = capability.lstrip('-')
  2202 				capability = capability.lstrip('-')
  2283 				resolvedDefFile = raptor_utilities.resolveSymbianPath(self.__defFileRoot, resolvedDefFile, 'DEFFILE', "", str(aBuildPlatform['EPOCROOT']))
  2304 				resolvedDefFile = raptor_utilities.resolveSymbianPath(self.__defFileRoot, resolvedDefFile, 'DEFFILE', "", str(aBuildPlatform['EPOCROOT']))
  2284 
  2305 
  2285 		return resolvedDefFile
  2306 		return resolvedDefFile
  2286 
  2307 
  2287 
  2308 
       
  2309 def CheckedGet(self, key, default = None):
       
  2310 	"""extract a value from an self and raise an exception if None.
       
  2311 
       
  2312 	An optional default can be set to replace a None value.
       
  2313 
       
  2314 	This function belongs in the Evaluator class logically. But
       
  2315 	Evaluator doesn't know how to raise a Metadata error. Since
       
  2316 	being able to raise a metadata error is the whole point of
       
  2317 	the method, it makes sense to adapt the Evaluator class from
       
  2318 	raptor_meta for the use of everything inside raptor_meta.
       
  2319 
       
  2320 	... so it will be added to the Evaluator class.
       
  2321 	"""
       
  2322 
       
  2323 	value = self.Get(key)
       
  2324 	if value == None:
       
  2325 		if default == None:
       
  2326 			raise MetaDataError("configuration " + self.buildUnit.name +
       
  2327 							    " has no variable " + key)
       
  2328 		else:
       
  2329 			return default
       
  2330 	return value
       
  2331 
       
  2332 raptor_data.Evaluator.CheckedGet = CheckedGet 
       
  2333 
       
  2334 
  2288 class MetaReader(object):
  2335 class MetaReader(object):
  2289 	"""Entry point class for Symbian metadata processing.
  2336 	"""Entry point class for Symbian metadata processing.
  2290 
  2337 
  2291 	Provides a means of integrating "traditional" Symbian metadata processing
  2338 	Provides a means of integrating "traditional" Symbian metadata processing
  2292 	with the new Raptor build system."""
  2339 	with the new Raptor build system."""
  2299 		self.ExportPlatforms = []
  2346 		self.ExportPlatforms = []
  2300 
  2347 
  2301 		# Get the version of CPP that we are using
  2348 		# Get the version of CPP that we are using
  2302 		metadata = self.__Raptor.cache.FindNamedVariant("meta")
  2349 		metadata = self.__Raptor.cache.FindNamedVariant("meta")
  2303 		evaluator = self.__Raptor.GetEvaluator(None, raptor_data.BuildUnit(metadata.name, [metadata]) )
  2350 		evaluator = self.__Raptor.GetEvaluator(None, raptor_data.BuildUnit(metadata.name, [metadata]) )
  2304 		self.__gnucpp = self.CheckValue(evaluator, "GNUCPP")
  2351 		self.__gnucpp = evaluator.CheckedGet("GNUCPP")
  2305 		self.__defaultplatforms = self.CheckValue(evaluator, "DEFAULT_PLATFORMS")
  2352 		self.__defaultplatforms = evaluator.CheckedGet("DEFAULT_PLATFORMS")
  2306 		self.__basedefaultplatforms = self.CheckValue(evaluator, "BASE_DEFAULT_PLATFORMS")
  2353 		self.__basedefaultplatforms = evaluator.CheckedGet("BASE_DEFAULT_PLATFORMS")
  2307 		self.__baseuserdefaultplatforms = self.CheckValue(evaluator, "BASE_USER_DEFAULT_PLATFORMS")
  2354 		self.__baseuserdefaultplatforms = evaluator.CheckedGet("BASE_USER_DEFAULT_PLATFORMS")
  2308 
  2355 
  2309 		# Only read each variant.cfg once
  2356 		# Only read each variant.cfg once
  2310 		variantCfgs = {}
  2357 		variantCfgs = {}
  2311 
  2358 
  2312 		# Group the list of configurations into "build platforms".
  2359 		# Group the list of configurations into "build platforms".
  2321 		# and VARIANT_HRH values. Each "build platform" has one associated
  2368 		# and VARIANT_HRH values. Each "build platform" has one associated
  2322 		# "export platform" but several "build platforms" can be associated
  2369 		# "export platform" but several "build platforms" can be associated
  2323 		# with the same "export platform".
  2370 		# with the same "export platform".
  2324 		exports = {}
  2371 		exports = {}
  2325 
  2372 
       
  2373 		self.__Raptor.Debug("MetaReader: configsToBuild:  %s", [b.name for b in configsToBuild])
  2326 		for buildConfig in configsToBuild:
  2374 		for buildConfig in configsToBuild:
  2327 			# get everything we need to know about the configuration
  2375 			# get everything we need to know about the configuration
  2328 			evaluator = self.__Raptor.GetEvaluator(None, buildConfig)
  2376 			evaluator = self.__Raptor.GetEvaluator(None, buildConfig)
  2329 
  2377 
  2330 			detail = {}
  2378 			detail = {}
  2331 			detail['PLATFORM'] = self.CheckValue(evaluator, "TRADITIONAL_PLATFORM")
  2379 			detail['PLATFORM'] = evaluator.CheckedGet("TRADITIONAL_PLATFORM")
  2332 			epocroot = self.CheckValue(evaluator, "EPOCROOT")
  2380 			epocroot = evaluator.CheckedGet("EPOCROOT")
  2333 			detail['EPOCROOT'] = generic_path.Path(epocroot)
  2381 			detail['EPOCROOT'] = generic_path.Path(epocroot)
  2334 
  2382 
  2335 			sbs_build_dir = self.CheckValue(evaluator, "SBS_BUILD_DIR")
  2383 			sbs_build_dir = evaluator.CheckedGet("SBS_BUILD_DIR")
  2336 			detail['SBS_BUILD_DIR'] = generic_path.Path(sbs_build_dir)
  2384 			detail['SBS_BUILD_DIR'] = generic_path.Path(sbs_build_dir)
  2337 			flm_export_dir = self.CheckValue(evaluator, "FLM_EXPORT_DIR")
  2385 			flm_export_dir = evaluator.CheckedGet("FLM_EXPORT_DIR")
  2338 			detail['FLM_EXPORT_DIR'] = generic_path.Path(flm_export_dir)
  2386 			detail['FLM_EXPORT_DIR'] = generic_path.Path(flm_export_dir)
  2339 			detail['CACHEID'] = flm_export_dir
  2387 			detail['CACHEID'] = flm_export_dir
  2340 			if raptor_utilities.getOSPlatform().startswith("win"):
  2388 			if raptor_utilities.getOSPlatform().startswith("win"):
  2341 				detail['PLATMACROS'] = self.CheckValue(evaluator,"PLATMACROS.WINDOWS")
  2389 				detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.WINDOWS")
  2342 			else:
  2390 			else:
  2343 				detail['PLATMACROS'] = self.CheckValue(evaluator,"PLATMACROS.LINUX")
  2391 				detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.LINUX")
  2344 
  2392 
  2345 			# Apply OS variant provided we are not ignoring this
  2393 			# Apply OS variant provided we are not ignoring this
  2346 			if not self.__Raptor.ignoreOsDetection:
  2394 			if not self.__Raptor.ignoreOsDetection:
  2347 				self.__Raptor.Debug("Automatic OS detection enabled.")
  2395 				self.__Raptor.Debug("Automatic OS detection enabled.")
  2348 				self.ApplyOSVariant(buildConfig, epocroot)
  2396 				self.ApplyOSVariant(buildConfig, epocroot)
  2350 				self.__Raptor.Debug("Automatic OS detection disabled.")
  2398 				self.__Raptor.Debug("Automatic OS detection disabled.")
  2351 
  2399 
  2352 			# is this a feature variant config or an ordinary variant
  2400 			# is this a feature variant config or an ordinary variant
  2353 			fv = evaluator.Get("FEATUREVARIANTNAME")
  2401 			fv = evaluator.Get("FEATUREVARIANTNAME")
  2354 			if fv:
  2402 			if fv:
  2355 				variantHdr = self.CheckValue(evaluator, "VARIANT_HRH")
  2403 				variantHdr = evaluator.CheckedGet("VARIANT_HRH")
  2356 				variantHRH = generic_path.Path(variantHdr)
  2404 				variantHRH = generic_path.Path(variantHdr)
  2357 				detail['ISFEATUREVARIANT'] = True
  2405 				detail['ISFEATUREVARIANT'] = True
  2358 			else:
  2406 			else:
  2359 				variantCfg = self.CheckValue(evaluator, "VARIANT_CFG")
  2407 				variantCfg = evaluator.CheckedGet("VARIANT_CFG")
  2360 				variantCfg = generic_path.Path(variantCfg)
  2408 				variantCfg = generic_path.Path(variantCfg)
  2361 				if not variantCfg in variantCfgs:
  2409 				if not variantCfg in variantCfgs:
  2362 					# get VARIANT_HRH from the variant.cfg file
  2410 					# get VARIANT_HRH from the variant.cfg file
  2363 					varCfg = getVariantCfgDetail(detail['EPOCROOT'], variantCfg)
  2411 					varCfg = getVariantCfgDetail(detail['EPOCROOT'], variantCfg)
  2364 					variantCfgs[variantCfg] = varCfg['VARIANT_HRH']
  2412 					variantCfgs[variantCfg] = varCfg['VARIANT_HRH']
  2369 				variantHRH = variantCfgs[variantCfg]
  2417 				variantHRH = variantCfgs[variantCfg]
  2370 				detail['ISFEATUREVARIANT'] = False
  2418 				detail['ISFEATUREVARIANT'] = False
  2371 
  2419 
  2372 			detail['VARIANT_HRH'] = variantHRH
  2420 			detail['VARIANT_HRH'] = variantHRH
  2373 			self.__Raptor.Info("'%s' uses variant hrh file '%s'", buildConfig.name, variantHRH)
  2421 			self.__Raptor.Info("'%s' uses variant hrh file '%s'", buildConfig.name, variantHRH)
  2374 			detail['SYSTEMINCLUDE'] = self.CheckValue(evaluator, "SYSTEMINCLUDE")
  2422 			detail['SYSTEMINCLUDE'] = evaluator.CheckedGet("SYSTEMINCLUDE")
  2375 
  2423 
  2376 			detail['METADEPS'] = [] # Dependency targets for all metadata files in this platform
       
  2377 
  2424 
  2378 			# find all the interface names we need
  2425 			# find all the interface names we need
  2379 			ifaceTypes = self.CheckValue(evaluator, "INTERFACE_TYPES")
  2426 			ifaceTypes = evaluator.CheckedGet("INTERFACE_TYPES")
  2380 			interfaces = ifaceTypes.split()
  2427 			interfaces = ifaceTypes.split()
  2381 
  2428 
  2382 			for iface in interfaces:
  2429 			for iface in interfaces:
  2383 				detail[iface] = self.CheckValue(evaluator, "INTERFACE." + iface)
  2430 				detail[iface] = evaluator.CheckedGet("INTERFACE." + iface)
  2384 
  2431 
  2385 			# not test code unless positively specified
  2432 			# not test code unless positively specified
  2386 			detail['TESTCODE'] = self.CheckValue(evaluator, "TESTCODE", "")
  2433 			detail['TESTCODE'] = evaluator.CheckedGet("TESTCODE", "")
  2387 
  2434 
  2388 			# make a key that identifies this platform uniquely
  2435 			# make a key that identifies this platform uniquely
  2389 			# - used to tell us whether we have done the pre-processing
  2436 			# - used to tell us whether we have done the pre-processing
  2390 			# we need already using another platform with compatible values.
  2437 			# we need already using another platform with compatible values.
  2391 
  2438 
  2452 
  2499 
  2453 		# one platform is picked as the "default" for extracting things
  2500 		# one platform is picked as the "default" for extracting things
  2454 		# that are supposedly platform independent (e.g. PRJ_PLATFORMS)
  2501 		# that are supposedly platform independent (e.g. PRJ_PLATFORMS)
  2455 		self.defaultPlatform = self.ExportPlatforms[0]
  2502 		self.defaultPlatform = self.ExportPlatforms[0]
  2456 
  2503 
  2457 	def CheckValue(self, evaluator, key, default = None):
  2504 
  2458 		"""extract a value from an evaluator and raise an exception if None.
  2505 	def ReadBldInfFiles(self, aComponentList, doExportOnly):
  2459 
       
  2460 		An optional default can be set to replace a None value."""
       
  2461 		value = evaluator.Get(key)
       
  2462 		if value == None:
       
  2463 			if default == None:
       
  2464 				raise MetaDataError("configuration " + evaluator.config.name +
       
  2465 								    " has no variable " + key)
       
  2466 			else:
       
  2467 				return default
       
  2468 		return value
       
  2469 
       
  2470 	def ReadBldInfFiles(self, aFileList, doExportOnly):
       
  2471 		"""Take a list of bld.inf files and return a list of build specs.
  2506 		"""Take a list of bld.inf files and return a list of build specs.
  2472 
  2507 
  2473 		The returned specification nodes will be suitable for all the build
  2508 		The returned specification nodes will be suitable for all the build
  2474 		configurations under consideration (using Filter nodes where required).
  2509 		configurations under consideration (using Filter nodes where required).
  2475 		"""
  2510 		"""
  2476 
  2511 
  2477 		# we need a Filter node per export platform
  2512 		# we need a Filter node per export platform
  2478 		exportNodes = []
  2513 		exportNodes = []
  2479 		for i,ep in enumerate(self.ExportPlatforms):
  2514 		for i,ep in enumerate(self.ExportPlatforms):
  2480 			filter = raptor_data.Filter("export_" + str(i))
  2515 			filter = raptor_data.Filter(name = "export_" + str(i))
  2481 
  2516 
  2482 			# what configurations is this node active for?
  2517 			# what configurations is this node active for?
  2483 			for config in ep['configs']:
  2518 			for config in ep['configs']:
  2484 				filter.AddConfigCondition(config.name)
  2519 				filter.AddConfigCondition(config.name)
  2485 
  2520 
  2486 			exportNodes.append(filter)
  2521 			exportNodes.append(filter)
  2487 
  2522 
  2488 		# we need a Filter node per build platform
  2523 		# we need a Filter node per build platform
  2489 		platformNodes = []
  2524 		platformNodes = []
  2490 		for i,bp in enumerate(self.BuildPlatforms):
  2525 		for i,bp in enumerate(self.BuildPlatforms):
  2491 			filter = raptor_data.Filter("build_" + str(i))
  2526 			filter = raptor_data.Filter(name = "build_" + str(i))
  2492 
  2527 
  2493 			# what configurations is this node active for?
  2528 			# what configurations is this node active for?
  2494 			for config in bp['configs']:
  2529 			for config in bp['configs']:
  2495 				filter.AddConfigCondition(config.name)
  2530 				filter.AddConfigCondition(config.name)
  2496 
  2531 
  2502 			filter.AddVariant(platformVar)
  2537 			filter.AddVariant(platformVar)
  2503 			platformNodes.append(filter)
  2538 			platformNodes.append(filter)
  2504 
  2539 
  2505 		# check that each bld.inf exists and add a Specification node for it
  2540 		# check that each bld.inf exists and add a Specification node for it
  2506 		# to the nodes of the export and build platforms that it supports.
  2541 		# to the nodes of the export and build platforms that it supports.
  2507 		for bif in aFileList:
  2542 		for c in aComponentList:
  2508 			if bif.isFile():
  2543 			if c.bldinf_filename.isFile():
  2509 				self.__Raptor.Info("Processing %s", str(bif))
  2544 				self.__Raptor.Info("Processing %s", str(c.bldinf_filename))
  2510 				try:
  2545 				try:
  2511 					self.AddComponentNodes(bif, exportNodes, platformNodes)
  2546 					self.AddComponentNodes(c, exportNodes, platformNodes)
  2512 
  2547 
  2513 				except MetaDataError, e:
  2548 				except MetaDataError, e:
  2514 					self.__Raptor.Error(e.Text, bldinf=str(bif))
  2549 					self.__Raptor.Error(e.Text, bldinf=str(c.bldinf_filename))
  2515 					if not self.__Raptor.keepGoing:
  2550 					if not self.__Raptor.keepGoing:
  2516 						return []
  2551 						return []
  2517 			else:
  2552 			else:
  2518 				self.__Raptor.Error("build info file does not exist", bldinf=str(bif))
  2553 				self.__Raptor.Error("build info file does not exist", bldinf=str(c.bldinf_filename))
  2519 				if not self.__Raptor.keepGoing:
  2554 				if not self.__Raptor.keepGoing:
  2520 					return []
  2555 					return []
  2521 
  2556 
  2522 		# now we have the top-level structure in place...
  2557 		# now we have the top-level structure in place...
  2523 		#
  2558 		#
  2615 		if moduleName == "" or moduleName.endswith(":"):
  2650 		if moduleName == "" or moduleName.endswith(":"):
  2616 			moduleName = "module"
  2651 			moduleName = "module"
  2617 		return moduleName
  2652 		return moduleName
  2618 
  2653 
  2619 
  2654 
  2620 	def AddComponentNodes(self, buildFile, exportNodes, platformNodes):
  2655 	def AddComponentNodes(self, component, exportNodes, platformNodes):	
  2621 		"""Add Specification nodes for a bld.inf to the appropriate platforms."""
  2656 		"""Add Specification nodes for a bld.inf to the appropriate platforms."""
  2622 		bldInfFile = BldInfFile(buildFile, self.__gnucpp, self.__Raptor)
  2657 		bldInfFile = BldInfFile(component.bldinf_filename, self.__gnucpp, component.depfiles, self.__Raptor)
  2623 
  2658 		component.bldinf = bldInfFile 
  2624 		specName = self.getSpecName(buildFile, fullPath=True)
  2659 
  2625 
  2660 		specName = getSpecName(component.bldinf_filename, fullPath=True)
  2626 		if isinstance(buildFile, raptor_xml.SystemModelComponent):
  2661 
       
  2662 		if isinstance(component.bldinf, raptor_xml.SystemModelComponent):
  2627 			# this component came from a system_definition.xml
  2663 			# this component came from a system_definition.xml
  2628 			layer = buildFile.GetContainerName("layer")
  2664 			layer = component.bldinf.GetContainerName("layer")
  2629 			component = buildFile.GetContainerName("component")
  2665 			componentName = component.bldinf.GetContainerName("component")
  2630 		else:
  2666 		else:
  2631 			# this is a plain old bld.inf file from the command-line
  2667 			# this is a plain old bld.inf file from the command-line
  2632 			layer = ""
  2668 			layer = ""
  2633 			component = ""
  2669 			componentName = ""
  2634 
  2670 
  2635 		# exports are independent of build platform
  2671 		# exports are independent of build platform
  2636 		for i,ep in enumerate(self.ExportPlatforms):
  2672 		for i,ep in enumerate(self.ExportPlatforms):
  2637 			specNode = raptor_data.Specification(specName)
  2673 			specNode = raptor_data.Specification(name = specName)
  2638 
  2674 
  2639 			# keep the BldInfFile object for later
  2675 			# keep the BldInfFile object for later
  2640 			specNode.bldinf = bldInfFile
  2676 			specNode.component = component
  2641 
  2677 
  2642 			# add some basic data in a component-wide variant
  2678 			# add some basic data in a component-wide variant
  2643 			var = raptor_data.Variant()
  2679 			var = raptor_data.Variant(name='component-wide')
  2644 			var.AddOperation(raptor_data.Set("COMPONENT_META", str(buildFile)))
  2680 			var.AddOperation(raptor_data.Set("COMPONENT_META", str(component.bldinf_filename)))
  2645 			var.AddOperation(raptor_data.Set("COMPONENT_NAME", component))
  2681 			var.AddOperation(raptor_data.Set("COMPONENT_NAME", componentName))
  2646 			var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer))
  2682 			var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer))
  2647 			specNode.AddVariant(var)
  2683 			specNode.AddVariant(var)
  2648 
  2684 
  2649 			# add this bld.inf Specification to the export platform
  2685 			# add this bld.inf Specification to the export platform
  2650 			exportNodes[i].AddChild(specNode)
  2686 			exportNodes[i].AddChild(specNode)
       
  2687 			component.exportspecs.append(specNode)
  2651 
  2688 
  2652 		# get the relevant build platforms
  2689 		# get the relevant build platforms
  2653 		listedPlatforms = bldInfFile.getBuildPlatforms(self.defaultPlatform)
  2690 		listedPlatforms = bldInfFile.getBuildPlatforms(self.defaultPlatform)
  2654 		platforms = getBuildableBldInfBuildPlatforms(listedPlatforms,
  2691 		platforms = getBuildableBldInfBuildPlatforms(listedPlatforms,
  2655 													self.__defaultplatforms,
  2692 								self.__defaultplatforms,
  2656 													self.__basedefaultplatforms,
  2693 								self.__basedefaultplatforms,
  2657 													self.__baseuserdefaultplatforms)
  2694 								self.__baseuserdefaultplatforms)
  2658 
  2695 
  2659 
  2696 
  2660 
  2697 		outputDir = BldInfFile.outputPathFragment(component.bldinf_filename)
  2661 		outputDir = BldInfFile.outputPathFragment(buildFile)
       
  2662 
  2698 
  2663 		# Calculate "module name"
  2699 		# Calculate "module name"
  2664 		modulename = self.ModuleName(str(buildFile))
  2700 		modulename = self.ModuleName(str(component.bldinf_filename))
  2665 
  2701 
  2666 		for i,bp in enumerate(self.BuildPlatforms):
  2702 		for i,bp in enumerate(self.BuildPlatforms):
       
  2703 			plat = bp['PLATFORM']
  2667 			if bp['PLATFORM'] in platforms:
  2704 			if bp['PLATFORM'] in platforms:
  2668 				specNode = raptor_data.Specification(specName)
  2705 				specNode = raptor_data.Specification(name = specName)
  2669 
  2706 
  2670 				# keep the BldInfFile object for later
  2707 				# remember what component this spec node comes from for later
  2671 				specNode.bldinf = bldInfFile
  2708 				specNode.component = component
  2672 
  2709 
  2673 				# add some basic data in a component-wide variant
  2710 				# add some basic data in a component-wide variant
  2674 				var = raptor_data.Variant()
  2711 				var = raptor_data.Variant(name='component-wide-settings-' + plat)
  2675 				var.AddOperation(raptor_data.Set("COMPONENT_META",str(buildFile)))
  2712 				var.AddOperation(raptor_data.Set("COMPONENT_META",str(component.bldinf_filename)))
  2676 				var.AddOperation(raptor_data.Set("COMPONENT_NAME", component))
  2713 				var.AddOperation(raptor_data.Set("COMPONENT_NAME", componentName))
  2677 				var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer))
  2714 				var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer))
  2678 				var.AddOperation(raptor_data.Set("MODULE", modulename))
  2715 				var.AddOperation(raptor_data.Set("MODULE", modulename))
  2679 				var.AddOperation(raptor_data.Append("OUTPUTPATHOFFSET", outputDir, '/'))
  2716 				var.AddOperation(raptor_data.Append("OUTPUTPATHOFFSET", outputDir, '/'))
  2680 				var.AddOperation(raptor_data.Append("OUTPUTPATH", outputDir, '/'))
  2717 				var.AddOperation(raptor_data.Append("OUTPUTPATH", outputDir, '/'))
  2681 				var.AddOperation(raptor_data.Append("BLDINF_OUTPUTPATH",outputDir, '/'))
  2718 				var.AddOperation(raptor_data.Append("BLDINF_OUTPUTPATH",outputDir, '/'))
  2682 
  2719 
  2683 				var.AddOperation(raptor_data.Set("TEST_OPTION", specNode.bldinf.getRomTestType(bp)))
  2720 				var.AddOperation(raptor_data.Set("TEST_OPTION", component.bldinf.getRomTestType(bp)))
  2684 				specNode.AddVariant(var)
  2721 				specNode.AddVariant(var)
  2685 
  2722 
  2686 				# add this bld.inf Specification to the build platform
  2723 				# add this bld.inf Specification to the build platform
  2687 				platformNodes[i].AddChild(specNode)
  2724 				platformNodes[i].AddChild(specNode)
       
  2725 				# also attach it into the component
       
  2726 				component.specs.append(specNode)
  2688 
  2727 
  2689 	def ProcessExports(self, componentNode, exportPlatform):
  2728 	def ProcessExports(self, componentNode, exportPlatform):
  2690 		"""Do the exports for a given platform and skeleton bld.inf node.
  2729 		"""Do the exports for a given platform and skeleton bld.inf node.
  2691 
  2730 
  2692 		This will actually perform exports as certain types of files (.mmh)
  2731 		This will actually perform exports as certain types of files (.mmh)
  2694 		(and parts of other bld.inf nodes) can be processed.
  2733 		(and parts of other bld.inf nodes) can be processed.
  2695 
  2734 
  2696 		[some MMP files #include exported .mmh files]
  2735 		[some MMP files #include exported .mmh files]
  2697 		"""
  2736 		"""
  2698 		if exportPlatform["TESTCODE"]:
  2737 		if exportPlatform["TESTCODE"]:
  2699 			exports = componentNode.bldinf.getTestExports(exportPlatform)
  2738 			exports = componentNode.component.bldinf.getTestExports(exportPlatform)
  2700 		else:
  2739 		else:
  2701 			exports = componentNode.bldinf.getExports(exportPlatform)
  2740 			exports = componentNode.component.bldinf.getExports(exportPlatform)
  2702 
  2741 
  2703 		self.__Raptor.Debug("%i exports for %s",
  2742 		self.__Raptor.Debug("%i exports for %s",
  2704 							len(exports), str(componentNode.bldinf.filename))
  2743 							len(exports), str(componentNode.component.bldinf.filename))
  2705 		if exports:
  2744 		if exports:
  2706 
  2745 
  2707 			# each export is either a 'copy' or 'unzip'
  2746 			# each export is either a 'copy' or 'unzip'
  2708 			# maybe we should trap multiple exports to the same location here?
  2747 			# maybe we should trap multiple exports to the same location here?
  2709 			epocroot = str(exportPlatform["EPOCROOT"])
  2748 			epocroot = str(exportPlatform["EPOCROOT"])
  2710 			bldinf_filename = str(componentNode.bldinf.filename)
  2749 			bldinf_filename = str(componentNode.component.bldinf.filename)
  2711 			exportwhatlog="<whatlog bldinf='%s' mmp='' config=''>\n" % bldinf_filename
  2750 			exportwhatlog="<whatlog bldinf='%s' mmp='' config=''>\n" % bldinf_filename
  2712 			for export in exports:
  2751 			for export in exports:
  2713 				expSrc = export.getSource()
  2752 				expSrc = export.getSource()
  2714 				expDstList = export.getDestination() # Might not be a list in all circumstances
  2753 				expDstList = export.getDestination() # Might not be a list in all circumstances
  2715 
  2754 
  2728 					try:
  2767 					try:
  2729 						if export.getAction() == "copy":
  2768 						if export.getAction() == "copy":
  2730 							# export the file
  2769 							# export the file
  2731 							exportwhatlog += self.CopyExport(fromFile, toFile, bldinf_filename)
  2770 							exportwhatlog += self.CopyExport(fromFile, toFile, bldinf_filename)
  2732 						else:
  2771 						else:
  2733 							# unzip the zip
       
  2734 							exportwhatlog += ("<archive zipfile='" + str(fromFile) + "'>\n")
  2772 							exportwhatlog += ("<archive zipfile='" + str(fromFile) + "'>\n")
  2735 							members = self.UnzipExport(fromFile, toFile,
  2773 							members = self.UnzipExport(fromFile, toFile,
  2736 									str(exportPlatform['SBS_BUILD_DIR']),
  2774 									str(exportPlatform['SBS_BUILD_DIR']),
  2737 									bldinf_filename)
  2775 									bldinf_filename)
  2738 							if members != None:
  2776 							if members != None:
  2915 		"""
  2953 		"""
  2916 		if buildPlatform["ISFEATUREVARIANT"]:
  2954 		if buildPlatform["ISFEATUREVARIANT"]:
  2917 			return	# feature variation does not run extensions at all
  2955 			return	# feature variation does not run extensions at all
  2918 		
  2956 		
  2919 		if buildPlatform["TESTCODE"]:
  2957 		if buildPlatform["TESTCODE"]:
  2920 			extensions = componentNode.bldinf.getTestExtensions(buildPlatform)
  2958 			extensions = componentNode.component.bldinf.getTestExtensions(buildPlatform)
  2921 		else:
  2959 		else:
  2922 			extensions = componentNode.bldinf.getExtensions(buildPlatform)
  2960 			extensions = componentNode.component.bldinf.getExtensions(buildPlatform)
  2923 
  2961 
  2924 		self.__Raptor.Debug("%i template extension makefiles for %s",
  2962 		self.__Raptor.Debug("%i template extension makefiles for %s",
  2925 							len(extensions), str(componentNode.bldinf.filename))
  2963 							len(extensions), str(componentNode.component.bldinf.filename))
  2926 
  2964 
  2927 		for i,extension in enumerate(extensions):
  2965 		for i,extension in enumerate(extensions):
  2928 			if self.__Raptor.projects:
  2966 			if self.__Raptor.projects:
  2929 				if not extension.nametag in self.__Raptor.projects:
  2967 				if not extension.nametag in self.__Raptor.projects:
  2930 					self.__Raptor.Debug("Skipping %s", extension.getMakefile())
  2968 					self.__Raptor.Debug("Skipping %s", extension.getMakefile())
  2999 		This happens after exports have been handled.
  3037 		This happens after exports have been handled.
  3000 		"""
  3038 		"""
  3001 		gnuList = []
  3039 		gnuList = []
  3002 		makefileList = []
  3040 		makefileList = []
  3003 
  3041 
       
  3042 
       
  3043 		component = componentNode.component
       
  3044 
       
  3045 
  3004 		if buildPlatform["TESTCODE"]:
  3046 		if buildPlatform["TESTCODE"]:
  3005 			MMPList = componentNode.bldinf.getTestMMPList(buildPlatform)
  3047 			MMPList = component.bldinf.getTestMMPList(buildPlatform)
  3006 		else:
  3048 		else:
  3007 			MMPList = componentNode.bldinf.getMMPList(buildPlatform)
  3049 			MMPList = component.bldinf.getMMPList(buildPlatform)
  3008 
  3050 
  3009 		bldInfFile = componentNode.bldinf.filename
  3051 		bldInfFile = component.bldinf.filename
  3010 
  3052 
  3011 		for mmpFileEntry in MMPList['mmpFileList']:
  3053 		for mmpFileEntry in MMPList['mmpFileList']:
       
  3054 			component.AddMMP(mmpFileEntry.filename) # Tell the component another mmp is specified (for this platform)
       
  3055 
  3012 			projectname = mmpFileEntry.filename.File().lower()
  3056 			projectname = mmpFileEntry.filename.File().lower()
  3013 
  3057 
  3014 			if self.__Raptor.projects:
  3058 			if self.__Raptor.projects:
  3015 				if not projectname in self.__Raptor.projects:
  3059 				if not projectname in self.__Raptor.projects:
  3016 					self.__Raptor.Debug("Skipping %s", str(mmpFileEntry.filename))
  3060 					self.__Raptor.Debug("Skipping %s", str(mmpFileEntry.filename))
  3024 				self.__Raptor.Error("Can't find mmp file '%s'", str(mmpFileEntry.filename), bldinf=str(bldInfFile))
  3068 				self.__Raptor.Error("Can't find mmp file '%s'", str(mmpFileEntry.filename), bldinf=str(bldInfFile))
  3025 				continue
  3069 				continue
  3026 
  3070 
  3027 			mmpFile = MMPFile(foundmmpfile,
  3071 			mmpFile = MMPFile(foundmmpfile,
  3028 								   self.__gnucpp,
  3072 								   self.__gnucpp,
  3029 								   bldinf = componentNode.bldinf,
  3073 								   component.bldinf,
       
  3074 								   component.depfiles,
  3030 								   log = self.__Raptor)
  3075 								   log = self.__Raptor)
  3031 
  3076 
  3032 			mmpFilename = mmpFile.filename
  3077 			mmpFilename = mmpFile.filename
  3033 
  3078 
  3034 			self.__Raptor.Info("Processing %s for platform %s",
  3079 			self.__Raptor.Info("Processing %s for platform %s",
  3058 			# feature variation only processes FEATUREVARIANT binaries
  3103 			# feature variation only processes FEATUREVARIANT binaries
  3059 			if buildPlatform["ISFEATUREVARIANT"] and not backend.featureVariant:
  3104 			if buildPlatform["ISFEATUREVARIANT"] and not backend.featureVariant:
  3060 				continue
  3105 				continue
  3061 			
  3106 			
  3062 			# now build the specification tree
  3107 			# now build the specification tree
  3063 			mmpSpec = raptor_data.Specification(self.getSpecName(mmpFilename))
  3108 			mmpSpec = raptor_data.Specification(generic_path.Path(getSpecName(mmpFilename)))
  3064 			var = backend.BuildVariant
  3109 			var = backend.BuildVariant
  3065 
  3110 
  3066 			var.AddOperation(raptor_data.Set("PROJECT_META", str(mmpFilename)))
  3111 			var.AddOperation(raptor_data.Set("PROJECT_META", str(mmpFilename)))
  3067 
  3112 
  3068 			# If it is a TESTMMPFILE section, the FLM needs to know about it
  3113 			# If it is a TESTMMPFILE section, the FLM needs to know about it
  3094 								    bldinf=str(bldInfFile))
  3139 								    bldinf=str(bldInfFile))
  3095 				continue
  3140 				continue
  3096 
  3141 
  3097 			# Although not part of the MMP, some MMP-based build specs additionally require knowledge of their
  3142 			# Although not part of the MMP, some MMP-based build specs additionally require knowledge of their
  3098 			# container bld.inf exported headers
  3143 			# container bld.inf exported headers
  3099 			for export in componentNode.bldinf.getExports(buildPlatform):
  3144 			for export in componentNode.component.bldinf.getExports(buildPlatform):
  3100 				destination = export.getDestination()
  3145 				destination = export.getDestination()
  3101 				if isinstance(destination, list):
  3146 				if isinstance(destination, list):
  3102 					exportfile = str(destination[0])
  3147 					exportfile = str(destination[0])
  3103 				else:
  3148 				else:
  3104 					exportfile = str(destination)
  3149 					exportfile = str(destination)
  3150 					continue
  3195 					continue
  3151 				elif projectname in self.projectList:
  3196 				elif projectname in self.projectList:
  3152 					self.projectList.remove(projectname)
  3197 					self.projectList.remove(projectname)
  3153 
  3198 
  3154 			self.__Raptor.Debug("%i gnumakefile extension makefiles for %s",
  3199 			self.__Raptor.Debug("%i gnumakefile extension makefiles for %s",
  3155 						len(gnuList), str(componentNode.bldinf.filename))
  3200 						len(gnuList), str(componentNode.component.bldinf.filename))
  3156 			var = raptor_data.Variant()
  3201 			var = raptor_data.Variant()
  3157 			gnuSpec = raptor_data.Specification("gnumakefile " + str(g.getMakefileName()))
  3202 			gnuSpec = raptor_data.Specification("gnumakefile " + str(g.getMakefileName()))
  3158 			interface = buildPlatform["ext_makefile"]
  3203 			interface = buildPlatform["ext_makefile"]
  3159 			gnuSpec.SetInterface(interface)
  3204 			gnuSpec.SetInterface(interface)
  3160 			gnumakefilePath = raptor_utilities.resolveSymbianPath(str(bldInfFile), g.getMakefileName())
  3205 			gnumakefilePath = raptor_utilities.resolveSymbianPath(str(bldInfFile), g.getMakefileName())
  3182 					continue
  3227 					continue
  3183 				elif projectname in self.projectList:
  3228 				elif projectname in self.projectList:
  3184 					projectList.remove(projectname)
  3229 					projectList.remove(projectname)
  3185 
  3230 
  3186 			self.__Raptor.Debug("%i makefile extension makefiles for %s",
  3231 			self.__Raptor.Debug("%i makefile extension makefiles for %s",
  3187 						len(makefileList), str(componentNode.bldinf.filename))
  3232 						len(makefileList), str(componentNode.component.bldinf.filename))
  3188 			var = raptor_data.Variant()
  3233 			var = raptor_data.Variant()
  3189 			gnuSpec = raptor_data.Specification("makefile " + str(m.getMakefileName()))
  3234 			gnuSpec = raptor_data.Specification("makefile " + str(m.getMakefileName()))
  3190 			interface = buildPlatform["ext_makefile"]
  3235 			interface = buildPlatform["ext_makefile"]
  3191 			gnuSpec.SetInterface(interface)
  3236 			gnuSpec.SetInterface(interface)
  3192 			gnumakefilePath = raptor_utilities.resolveSymbianPath(str(bldInfFile), m.getMakefileName())
  3237 			gnumakefilePath = raptor_utilities.resolveSymbianPath(str(bldInfFile), m.getMakefileName())
  3203 				value = value.replace('$/', '/').replace('$;', ':')
  3248 				value = value.replace('$/', '/').replace('$;', ':')
  3204 				var.AddOperation(raptor_data.Set(standardVariable, value))
  3249 				var.AddOperation(raptor_data.Set(standardVariable, value))
  3205 			gnuSpec.AddVariant(var)
  3250 			gnuSpec.AddVariant(var)
  3206 			componentNode.AddChild(gnuSpec)
  3251 			componentNode.AddChild(gnuSpec)
  3207 
  3252 
  3208 	def getSpecName(self, aFileRoot, fullPath=False):
       
  3209 		"""Returns a build spec name: this is the file root (full path
       
  3210 		or simple file name) made safe for use as a file name."""
       
  3211 
       
  3212 		if fullPath:
       
  3213 			specName = str(aFileRoot).replace("/","_")
       
  3214 			specName = specName.replace(":","")
       
  3215 		else:
       
  3216 			specName = aFileRoot.File()
       
  3217 
       
  3218 		return specName.lower()
       
  3219 
  3253 
  3220 	def ApplyOSVariant(self, aBuildUnit, aEpocroot):
  3254 	def ApplyOSVariant(self, aBuildUnit, aEpocroot):
  3221 		# Form path to kif.xml and path to buildinfo.txt
  3255 		# Form path to kif.xml and path to buildinfo.txt
  3222 		kifXmlPath = generic_path.Join(aEpocroot, "epoc32", "data","kif.xml")
  3256 		kifXmlPath = generic_path.Join(aEpocroot, "epoc32", "data","kif.xml")
  3223 		buildInfoTxtPath = generic_path.Join(aEpocroot, "epoc32", "data","buildinfo.txt")
  3257 		buildInfoTxtPath = generic_path.Join(aEpocroot, "epoc32", "data","buildinfo.txt")