sbsv2/raptor/python/raptor_meta.py
changeset 18 de5b887c98f7
parent 13 c327db0664bb
child 28 b8fa7dfeeaa1
equal deleted inserted replaced
14:eb060913c963 18:de5b887c98f7
    33 import zipfile
    33 import zipfile
    34 from xml.sax.saxutils import escape
    34 from xml.sax.saxutils import escape
    35 from mmpparser import *
    35 from mmpparser import *
    36 
    36 
    37 import time
    37 import time
       
    38 import generic_path
    38 
    39 
    39 
    40 
    40 PiggyBackedBuildPlatforms = {'ARMV5':['GCCXML']}
    41 PiggyBackedBuildPlatforms = {'ARMV5':['GCCXML']}
    41 
    42 
    42 PlatformDefaultDefFileDir = {'WINSCW':'bwins',
    43 PlatformDefaultDefFileDir = {'WINSCW':'bwins',
   766 			eiloc="." # Someone building with a relative raptor path
   767 			eiloc="." # Someone building with a relative raptor path
   767 		if biloc is None or biloc == "":
   768 		if biloc is None or biloc == "":
   768 			biloc="." # Someone building with a relative raptor path
   769 			biloc="." # Someone building with a relative raptor path
   769 
   770 
   770 		self.__StandardVariables = {}
   771 		self.__StandardVariables = {}
   771 		# Relative step-down to the root - let's try ignoring this for now, as it
   772 		# The source root directory is SRCROOT if set in the environment
   772 		# should amount to the same thing in a world where absolute paths are king
   773 		# Set TO_ROOT to SRCROOT in case SBS_BUILD_DIR is on a different drive
   773 		self.__StandardVariables['TO_ROOT'] = ""
   774 		if 'SRCROOT' in os.environ:
       
   775 			self.__StandardVariables['TO_ROOT'] = str(generic_path.Path(os.environ['SRCROOT']))
       
   776 		else:
       
   777 			self.__StandardVariables['TO_ROOT'] = ""
       
   778 		
   774 		# Top-level bld.inf location
   779 		# Top-level bld.inf location
   775 		self.__StandardVariables['TO_BLDINF'] = biloc
   780 		self.__StandardVariables['TO_BLDINF'] = biloc
   776 		self.__StandardVariables['EXTENSION_ROOT'] = eiloc
   781 		self.__StandardVariables['EXTENSION_ROOT'] = eiloc
   777 
   782 
   778 		# Get the directory and filename from the full path containing the extension makefile
   783 		# Get the directory and filename from the full path containing the extension makefile
   836 		eiloc = str(extInfLocation)
   841 		eiloc = str(extInfLocation)
   837 		if eiloc is None or eiloc == "":
   842 		if eiloc is None or eiloc == "":
   838 			eiloc="." # Someone building with a relative raptor path
   843 			eiloc="." # Someone building with a relative raptor path
   839 
   844 
   840 		self.__StandardVariables = {}
   845 		self.__StandardVariables = {}
   841 		# Relative step-down to the root - let's try ignoring this for now, as it
   846 		# The source root directory is SRCROOT if set in the environment	
   842 		# should amount to the same thing in a world where absolute paths are king
   847 		# Set TO_ROOT to SRCROOT in case SBS_BUILD_DIR is on a different drive
   843 		self.__StandardVariables['TO_ROOT'] = ""
   848 		if 'SRCROOT' in os.environ:
       
   849 			self.__StandardVariables['TO_ROOT'] = str(generic_path.Path(os.environ['SRCROOT']))
       
   850 		else:
       
   851 			self.__StandardVariables['TO_ROOT'] = ""
   844 		# Top-level bld.inf location
   852 		# Top-level bld.inf location
   845 		self.__StandardVariables['TO_BLDINF'] = biloc
   853 		self.__StandardVariables['TO_BLDINF'] = biloc
   846 		# Location of bld.inf file containing the current EXTENSION block
   854 		# Location of bld.inf file containing the current EXTENSION block
   847 		self.__StandardVariables['EXTENSION_ROOT'] = eiloc
   855 		self.__StandardVariables['EXTENSION_ROOT'] = eiloc
   848 
   856 
  1069 
  1077 
  1070 		for extensionLine in self.__getSection(aBuildPlatform, aType):
  1078 		for extensionLine in self.__getSection(aBuildPlatform, aType):
  1071 			if (re.search(r'^\s*START ',extensionLine, re.I)):
  1079 			if (re.search(r'^\s*START ',extensionLine, re.I)):
  1072 				start = extensionLine
  1080 				start = extensionLine
  1073 			elif re.search(r'^\s*END\s*$',extensionLine, re.I):
  1081 			elif re.search(r'^\s*END\s*$',extensionLine, re.I):
  1074 				extensionObjects.append(Extension(self.filename, start, options, aBuildPlatform, self.__Raptor))
  1082 				if start == "":
  1075 				start = ""
  1083 					self.log.Error("unmatched END statement in %s section", aType, bldinf=str(self.filename))
  1076 				options = []
  1084 				else:
       
  1085 					extensionObjects.append(Extension(self.filename, start, options, aBuildPlatform, self.__Raptor))
       
  1086 					start = ""
       
  1087 					options = []
  1077 			elif re.search(r'^\s*$',extensionLine, re.I):
  1088 			elif re.search(r'^\s*$',extensionLine, re.I):
  1078 				continue
  1089 				continue
  1079 			elif start:
  1090 			elif start:
  1080 				options.append(extensionLine)
  1091 				options.append(extensionLine)
  1081 
  1092 
  1486 				else:
  1497 				else:
  1487 					self.__Raptor.Warn("VERSION (%s) missing '.minor' in %s, using '.0'" % (toks[1],self.__currentMmpFile))
  1498 					self.__Raptor.Warn("VERSION (%s) missing '.minor' in %s, using '.0'" % (toks[1],self.__currentMmpFile))
  1488 
  1499 
  1489 				self.__versionhex = "%04x%04x" % (major, minor)
  1500 				self.__versionhex = "%04x%04x" % (major, minor)
  1490 				self.BuildVariant.AddOperation(raptor_data.Set(varname, "%d.%d" %(major, minor)))
  1501 				self.BuildVariant.AddOperation(raptor_data.Set(varname, "%d.%d" %(major, minor)))
  1491 				self.BuildVariant.AddOperation(raptor_data.Set(varname+"HEX", self.__versionhex))
  1502 				self.BuildVariant.AddOperation(raptor_data.Set("VERSIONHEX", self.__versionhex))
  1492 				self.__debug("Set "+toks[0]+"  OPTION to " + toks[1])
  1503 				self.__debug("Set "+toks[0]+"  OPTION to " + toks[1])
  1493 				self.__debug("Set "+toks[0]+"HEX OPTION to " + "%04x%04x" % (major,minor))
  1504 				self.__debug("Set VERSIONHEX OPTION to " + self.__versionhex)
  1494 
  1505 
  1495 			else:
  1506 			else:
  1496 				self.__Raptor.Warn("Invalid version supplied to VERSION (%s), using default value" % toks[1])
  1507 				self.__Raptor.Warn("Invalid version supplied to VERSION (%s), using default value" % toks[1])
  1497 
  1508 
  1498 		elif varname=='EPOCHEAPSIZE':
  1509 		elif varname=='EPOCHEAPSIZE':
  3077 			for option in options:
  3088 			for option in options:
  3078 				self.__Raptor.Debug("Set %s=%s", option, options[option])
  3089 				self.__Raptor.Debug("Set %s=%s", option, options[option])
  3079 				value = options[option].replace('$(EPOCROOT)', '$(EPOCROOT)/')
  3090 				value = options[option].replace('$(EPOCROOT)', '$(EPOCROOT)/')
  3080 				value = value.replace('$(', '$$$$(')
  3091 				value = value.replace('$(', '$$$$(')
  3081 				value = value.replace('$/', '/').replace('$;', ':')
  3092 				value = value.replace('$/', '/').replace('$;', ':')
  3082 				value = value.replace('$/', '/').replace('$;', ':')
       
  3083 
  3093 
  3084 				if customInterface:
  3094 				if customInterface:
  3085 					var.AddOperation(raptor_data.Set(option, value))
  3095 					var.AddOperation(raptor_data.Set(option, value))
  3086 				else:
  3096 				else:
  3087 					var.AddOperation(raptor_data.Append("O._MEMBERS", option))
  3097 					var.AddOperation(raptor_data.Append("O._MEMBERS", option))
  3294 			if self.__Raptor.projects:
  3304 			if self.__Raptor.projects:
  3295 				if not projectname in self.__Raptor.projects:
  3305 				if not projectname in self.__Raptor.projects:
  3296 					self.__Raptor.Debug("Skipping %s", str(m.getMakefileName()))
  3306 					self.__Raptor.Debug("Skipping %s", str(m.getMakefileName()))
  3297 					continue
  3307 					continue
  3298 				elif projectname in self.projectList:
  3308 				elif projectname in self.projectList:
  3299 					projectList.remove(projectname)
  3309 					self.projectList.remove(projectname)
  3300 
  3310 
  3301 			self.__Raptor.Debug("%i makefile extension makefiles for %s",
  3311 			self.__Raptor.Debug("%i makefile extension makefiles for %s",
  3302 						len(makefileList), str(componentNode.component.bldinf.filename))
  3312 						len(makefileList), str(componentNode.component.bldinf.filename))
  3303 			var = raptor_data.Variant()
  3313 			var = raptor_data.Variant()
  3304 			gnuSpec = raptor_data.Specification("makefile " + str(m.getMakefileName()))
  3314 			gnuSpec = raptor_data.Specification("makefile " + str(m.getMakefileName()))