sbsv2/raptor/python/raptor_meta.py
changeset 674 37ee82a83d43
parent 641 8dd670a9f34f
equal deleted inserted replaced
673:7ae5f757318b 674:37ee82a83d43
  1438 			lowercase_TARGET = self.__TARGET.lower()
  1438 			lowercase_TARGET = self.__TARGET.lower()
  1439 			self.__debug("Set "+toks[0]+" to " + lowercase_TARGET)
  1439 			self.__debug("Set "+toks[0]+" to " + lowercase_TARGET)
  1440 			self.__debug("Set REQUESTEDTARGETEXT to " + self.__TARGETEXT.lower())
  1440 			self.__debug("Set REQUESTEDTARGETEXT to " + self.__TARGETEXT.lower())
  1441 
  1441 
  1442 			self.BuildVariant.AddOperation(raptor_data.Set("TARGET", self.__TARGET))
  1442 			self.BuildVariant.AddOperation(raptor_data.Set("TARGET", self.__TARGET))
  1443 			self.BuildVariant.AddOperation(raptor_data.Set("TARGET_lower", lowercase_TARGET))
  1443 			# case folding: case insensitive for resources
       
  1444 			if self.__Raptor.doCaseFolding_rsg:
       
  1445 				self.BuildVariant.AddOperation(raptor_data.Set("TARGET_var", lowercase_TARGET))
       
  1446 			else:
       
  1447 				self.BuildVariant.AddOperation(raptor_data.Set("TARGET_var", self.__TARGET))
       
  1448 
  1444 			if  lowercase_TARGET !=  self.__TARGET:
  1449 			if  lowercase_TARGET !=  self.__TARGET:
  1445 				self.__debug("TARGET is not lowercase: '%s' - might cause BC problems." % self.__TARGET)
  1450 				self.__debug("TARGET is not lowercase: '%s' - might cause BC problems." % self.__TARGET)
  1446 		elif varname=='TARGETTYPE':
  1451 		elif varname=='TARGETTYPE':
  1447 			self.__debug("Set "+toks[0]+" to " + str(toks[1]))
  1452 			self.__debug("Set "+toks[0]+" to " + str(toks[1]))
  1448 			self.__targettype=toks[1]
  1453 			self.__targettype=toks[1]
  1449 			if  self.__targettype.lower() == "none":
  1454 			if  self.__targettype.lower() == "none":
  1450 				self.BuildVariant.AddOperation(raptor_data.Set("TARGET", ""))
  1455 				self.BuildVariant.AddOperation(raptor_data.Set("TARGET", ""))
  1451 				self.BuildVariant.AddOperation(raptor_data.Set("TARGET_lower",""))
  1456 				self.BuildVariant.AddOperation(raptor_data.Set("TARGET_var",""))
  1452 				self.BuildVariant.AddOperation(raptor_data.Set("REQUESTEDTARGETEXT", ""))
  1457 				self.BuildVariant.AddOperation(raptor_data.Set("REQUESTEDTARGETEXT", ""))
  1453 			self.BuildVariant.AddOperation(raptor_data.Set(varname,toks[1].lower()))
  1458 			self.BuildVariant.AddOperation(raptor_data.Set(varname,toks[1].lower()))
  1454 
  1459 
  1455 		elif varname=='TARGETPATH':
  1460 		elif varname=='TARGETPATH':
  1456 			value = toks[1].lower().replace('\\','/')
  1461 			value = toks[1].lower().replace('\\','/')
  1783 			variant.AddOperation(raptor_data.Set("SOURCE", str(source)))
  1788 			variant.AddOperation(raptor_data.Set("SOURCE", str(source)))
  1784 			self.__resourceFiles.append(str(source))
  1789 			self.__resourceFiles.append(str(source))
  1785 
  1790 
  1786 			target = source.File().rsplit(".", 1)[0]	# remove the extension
  1791 			target = source.File().rsplit(".", 1)[0]	# remove the extension
  1787 			variant.AddOperation(raptor_data.Set("TARGET", target))
  1792 			variant.AddOperation(raptor_data.Set("TARGET", target))
  1788 			variant.AddOperation(raptor_data.Set("TARGET_lower", target.lower()))
  1793 			
  1789 
  1794 			if self.__Raptor.doCaseFolding_rsg:
  1790 			header = target.lower() + ".rsg"			# filename policy
  1795 				variant.AddOperation(raptor_data.Set("TARGET_var", target.lower()))
       
  1796 				header = target.lower() + ".rsg"
       
  1797 			else:
       
  1798 				variant.AddOperation(raptor_data.Set("TARGET_var", target))
       
  1799 				header = target + ".rsg"
       
  1800 			 
  1791 			variant.AddOperation(raptor_data.Set("HEADER", header))
  1801 			variant.AddOperation(raptor_data.Set("HEADER", header))
  1792 
  1802 
  1793 			if sysRes:
  1803 			if sysRes:
  1794 				dsrtp = self.getDefaultSystemResourceTargetPath()
  1804 				dsrtp = self.getDefaultSystemResourceTargetPath()
  1795 				variant.AddOperation(raptor_data.Set("TARGETPATH", dsrtp))
  1805 				variant.AddOperation(raptor_data.Set("TARGETPATH", dsrtp))
  1913 		# The target name is the basename of the resource without the extension
  1923 		# The target name is the basename of the resource without the extension
  1914 		# e.g. "/fred/129ab34f.rss" would have a target name of "129ab34f"
  1924 		# e.g. "/fred/129ab34f.rss" would have a target name of "129ab34f"
  1915 		target = self.__current_resource.rsplit("/",1)[-1]
  1925 		target = self.__current_resource.rsplit("/",1)[-1]
  1916 		target = target.rsplit(".",1)[0]
  1926 		target = target.rsplit(".",1)[0]
  1917 		self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET", target))
  1927 		self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET", target))
  1918 		self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_lower", target.lower()))
  1928 
       
  1929 		if self.__Raptor.doCaseFolding_rsg:
       
  1930 			self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_var", target.lower()))
       
  1931 			self.__current_resource_header = target.lower() + ".rsg"
       
  1932 		else:
       
  1933 			self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_var", target))
       
  1934 			self.__current_resource_header = target + ".rsg"
       
  1935 
  1919 		self.__headerspecified = False
  1936 		self.__headerspecified = False
  1920 		self.__headeronlyspecified = False
  1937 		self.__headeronlyspecified = False
  1921 		self.__current_resource_header = target.lower() + ".rsg"
       
  1922 
  1938 
  1923 		return "OK"
  1939 		return "OK"
  1924 
  1940 
  1925 	def doResourceAssignment(self,s,loc,toks):
  1941 	def doResourceAssignment(self,s,loc,toks):
  1926 		""" Assign variables for resource files """
  1942 		""" Assign variables for resource files """
  1933 		# for other purposes and # we aren't going to make it
  1949 		# for other purposes and # we aren't going to make it
  1934 		# optional anyhow.
  1950 		# optional anyhow.
  1935 		if varname == "TARGET":
  1951 		if varname == "TARGET":
  1936 			target_withext = varvalue.rsplit("/\\",1)[-1]
  1952 			target_withext = varvalue.rsplit("/\\",1)[-1]
  1937 			target = target_withext.rsplit(".",1)[0]
  1953 			target = target_withext.rsplit(".",1)[0]
  1938 			self.__current_resource_header = target.lower() + ".rsg"
  1954 
  1939 			self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_lower", target.lower()))
  1955 			if self.__Raptor.doCaseFolding_rsg:
       
  1956 				self.__current_resource_header = target.lower() + ".rsg"
       
  1957 				self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_var", target.lower()))
       
  1958 			else:
       
  1959 				self.__current_resource_header = target + ".rsg"
       
  1960 				self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_var", target))
       
  1961 
  1940 			self.__debug("Set resource "+varname+" to " + target)
  1962 			self.__debug("Set resource "+varname+" to " + target)
  1941 			self.__currentResourceVariant.AddOperation(raptor_data.Set(varname,target))
  1963 			self.__currentResourceVariant.AddOperation(raptor_data.Set(varname,target))
  1942 		if varname == "TARGETPATH":
  1964 		if varname == "TARGETPATH":
  1943 			varvalue=varvalue.replace('\\','/')
  1965 			varvalue=varvalue.replace('\\','/')
  1944 			self.__debug("Set resource "+varname+" to " + varvalue)
  1966 			self.__debug("Set resource "+varname+" to " + varvalue)
  2005 		self.__currentLineNumber += 1
  2027 		self.__currentLineNumber += 1
  2006 		self.__debug("Start BITMAP "+toks[1])
  2028 		self.__debug("Start BITMAP "+toks[1])
  2007 
  2029 
  2008 		self.__currentBitmapVariant = raptor_data.Variant(name = toks[1].replace('.','_'))
  2030 		self.__currentBitmapVariant = raptor_data.Variant(name = toks[1].replace('.','_'))
  2009 		# Use BMTARGET and BMTARGET_lower because that prevents
  2031 		# Use BMTARGET and BMTARGET_lower because that prevents
  2010 		# confusion with the TARGET and TARGET_lower of our parent MMP
  2032 		# confusion with the TARGET and TARGET_var of our parent MMP
  2011 		# when setting the OUTPUTPATH.  This in turn allows us to
  2033 		# when setting the OUTPUTPATH.  This in turn allows us to
  2012 		# not get tripped up by multiple mbms being generated with
  2034 		# not get tripped up by multiple mbms being generated with
  2013 		# the same name to the same directory.
  2035 		# the same name to the same directory.
  2014 		self.__currentBitmapVariant.AddOperation(raptor_data.Set("BMTARGET", toks[1]))
  2036 		self.__currentBitmapVariant.AddOperation(raptor_data.Set("BMTARGET", toks[1]))
  2015 		self.__currentBitmapVariant.AddOperation(raptor_data.Set("BMTARGET_lower", toks[1].lower()))
  2037 		self.__currentBitmapVariant.AddOperation(raptor_data.Set("BMTARGET_lower", toks[1].lower()))
  2358 
  2380 
  2359 		# Set Debuggable
  2381 		# Set Debuggable
  2360 		self.BuildVariant.AddOperation(raptor_data.Set("DEBUGGABLE", self.__debuggable))
  2382 		self.BuildVariant.AddOperation(raptor_data.Set("DEBUGGABLE", self.__debuggable))
  2361 
  2383 
  2362 		if self.__explicitversion:
  2384 		if self.__explicitversion:
  2363 			self.BuildVariant.AddOperation(raptor_data.Append("UNIQUETARGETPATH","$(TARGET_lower)_$(VERSIONHEX)_$(REQUESTEDTARGETEXT)",'/'))
  2385 			self.BuildVariant.AddOperation(raptor_data.Append("UNIQUETARGETPATH","$(TARGET_var)_$(VERSIONHEX)_$(REQUESTEDTARGETEXT)",'/'))
  2364 		else:
  2386 		else:
  2365 			self.BuildVariant.AddOperation(raptor_data.Append("UNIQUETARGETPATH","$(TARGET_lower)_$(REQUESTEDTARGETEXT)",'/'))
  2387 			self.BuildVariant.AddOperation(raptor_data.Append("UNIQUETARGETPATH","$(TARGET_var)_$(REQUESTEDTARGETEXT)",'/'))
  2366 
  2388 
  2367 		# Put the list of sourcefiles in with one Set operation - saves memory
  2389 		# Put the list of sourcefiles in with one Set operation - saves memory
  2368 		# and performance over using multiple Append operations.
  2390 		# and performance over using multiple Append operations.
  2369 		self.BuildVariant.AddOperation(raptor_data.Set("SOURCE",
  2391 		self.BuildVariant.AddOperation(raptor_data.Set("SOURCE",
  2370 						   " ".join(self.sources)))
  2392 						   " ".join(self.sources)))
  2584 			sbs_build_dir = evaluator.CheckedGet("SBS_BUILD_DIR")
  2606 			sbs_build_dir = evaluator.CheckedGet("SBS_BUILD_DIR")
  2585 			detail['SBS_BUILD_DIR'] = generic_path.Path(sbs_build_dir)
  2607 			detail['SBS_BUILD_DIR'] = generic_path.Path(sbs_build_dir)
  2586 			flm_export_dir = evaluator.CheckedGet("FLM_EXPORT_DIR")
  2608 			flm_export_dir = evaluator.CheckedGet("FLM_EXPORT_DIR")
  2587 			detail['FLM_EXPORT_DIR'] = generic_path.Path(flm_export_dir)
  2609 			detail['FLM_EXPORT_DIR'] = generic_path.Path(flm_export_dir)
  2588 			detail['CACHEID'] = flm_export_dir
  2610 			detail['CACHEID'] = flm_export_dir
       
  2611 			detail['INTERFACE.component'] = evaluator.Get('INTERFACE.component')
  2589 			if raptor_utilities.getOSPlatform().startswith("win"):
  2612 			if raptor_utilities.getOSPlatform().startswith("win"):
  2590 				detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.WINDOWS")
  2613 				detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.WINDOWS")
  2591 			else:
  2614 			else:
  2592 				detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.LINUX")
  2615 				detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.LINUX")
  2593 
  2616 
  2644 			 	+ str(detail['EPOCROOT']) \
  2667 			 	+ str(detail['EPOCROOT']) \
  2645 		    	+ detail['SYSTEMINCLUDE'] \
  2668 		    	+ detail['SYSTEMINCLUDE'] \
  2646 		    	+ detail['PLATFORM'] \
  2669 		    	+ detail['PLATFORM'] \
  2647 		    	+ detail['PLATMACROS']
  2670 		    	+ detail['PLATMACROS']
  2648 
  2671 
  2649 		    # Keep a short version of the key for use in filenames.
  2672 			# Keep a short version of the key for use in filenames.
  2650 			uniq = hashlib.md5()
  2673 			uniq = hashlib.md5()
  2651 			uniq.update(key)
  2674 			uniq.update(key)
  2652 
  2675 
  2653 			detail['key'] = key
  2676 			detail['key'] = key
  2654 			detail['key_md5'] = "p_" + uniq.hexdigest()
  2677 			detail['key_md5'] = "p_" + uniq.hexdigest()
  2838 		return exportNodes + platformNodes
  2861 		return exportNodes + platformNodes
  2839 
  2862 
  2840 	def ModuleName(self,aBldInfPath):
  2863 	def ModuleName(self,aBldInfPath):
  2841 		"""Calculate the name of the ROM/emulator batch files that run the tests"""
  2864 		"""Calculate the name of the ROM/emulator batch files that run the tests"""
  2842 
  2865 
  2843 		def LeftPortionOf(pth,sep):
  2866 		epocroot = str(self.ExportPlatforms[0]['EPOCROOT'])
  2844 			""" Internal function to return portion of str that is to the left of sep. 
  2867 		modulePath = os.path.dirname(aBldInfPath).replace(epocroot, '', 1).lower().replace('group', '')
  2845 			The split is case-insensitive."""
  2868 		# Only join the last 3 folder names in case the path is very long
  2846 			length = len((pth.lower().split(sep.lower()))[0])
  2869 		moduleName = '_'.join([i for i in modulePath.split('/') if i][-3:])
  2847 			return pth[0:length]
       
  2848 			
       
  2849 		modulePath = LeftPortionOf(LeftPortionOf(os.path.dirname(aBldInfPath), "group"), "ongoing")
       
  2850 		moduleName = os.path.basename(modulePath.strip("/"))
       
  2851 		
  2870 		
  2852 		# Ensure that ModuleName does not return blank, if the above calculation determines
  2871 		# Ensure that ModuleName does not return blank, if the above calculation determines
  2853 		# that moduleName is blank
  2872 		# that moduleName is blank
  2854 		if moduleName == "" or moduleName.endswith(":"):
  2873 		if moduleName == "" or moduleName.endswith(":"):
  2855 			moduleName = "module"
  2874 			moduleName = "module"
  2900 				specNode = raptor_data.Specification(name = specName)
  2919 				specNode = raptor_data.Specification(name = specName)
  2901 
  2920 
  2902 				# remember what component this spec node comes from for later
  2921 				# remember what component this spec node comes from for later
  2903 				specNode.component = component
  2922 				specNode.component = component
  2904 
  2923 
       
  2924 				# if there is a per-component interface for this platform
       
  2925 				# then set it for this spec node.
       
  2926 				if bp['INTERFACE.component']:
       
  2927 					specNode.SetInterface(bp['INTERFACE.component'])
       
  2928 					
  2905 				# add some basic data in a component-wide variant
  2929 				# add some basic data in a component-wide variant
  2906 				var = raptor_data.Variant(name='component-wide-settings-' + plat)
  2930 				var = raptor_data.Variant(name='component-wide-settings-' + plat)
  2907 				var.AddOperation(raptor_data.Set("COMPONENT_META",str(component.bldinf_filename)))
  2931 				var.AddOperation(raptor_data.Set("COMPONENT_META",str(component.bldinf_filename)))
  2908 				var.AddOperation(raptor_data.Set("COMPONENT_NAME", component.componentname))
  2932 				var.AddOperation(raptor_data.Set("COMPONENT_NAME", component.componentname))
  2909 				var.AddOperation(raptor_data.Set("COMPONENT_LAYER", component.layername))
  2933 				var.AddOperation(raptor_data.Set("COMPONENT_LAYER", component.layername))