sbsv2/raptor/python/raptor_xml.py
changeset 616 24e4ef208cca
parent 590 360bd6b35136
child 625 a1925fb7753a
equal deleted inserted replaced
613:839712f5a78c 616:24e4ef208cca
   315 		component = SystemModelComponent(aBldInfFile, layer, containers, self.__SystemDefinitionFile, self.__SystemDefinitionBase, self.__Version)
   315 		component = SystemModelComponent(aBldInfFile, layer, containers, self.__SystemDefinitionFile, self.__SystemDefinitionBase, self.__Version)
   316 
   316 
   317 		return component
   317 		return component
   318 
   318 
   319 	def __GetEffectiveLayer(self, aElement):
   319 	def __GetEffectiveLayer(self, aElement):
   320 		#' return the ID of the topmost item which has an ID. For 1.x and 2.x, this will always be layer, for 3.x, it will be the topmost ID'd element in the file
   320 		# return the ID of the topmost item which has an ID. For 1.x and 2.x, this will always be layer,
   321 		# never call this on the root element
   321 		# for 3.x, it will be the topmost ID'd element in the file never call this on the root element
   322 		if aElement.parentNode.hasAttribute(self.__IdAttribute):
   322 		if aElement.parentNode.hasAttribute(self.__IdAttribute):
   323 			return self.__GetEffectiveLayer(aElement.parentNode)
   323 			return self.__GetEffectiveLayer(aElement.parentNode)
   324 		elif aElement.hasAttribute(self.__IdAttribute):
   324 		elif aElement.hasAttribute(self.__IdAttribute):
   325 			return aElement.getAttribute(self.__IdAttribute)
   325 			return aElement.getAttribute(self.__IdAttribute)
   326 		return ""
   326 		return ""
   334 
   334 
   335 			if name:
   335 			if name:
   336 				aContainers[parent.tagName] = name
   336 				aContainers[parent.tagName] = name
   337 
   337 
   338 			self.__GetElementContainers(parent, aContainers)
   338 			self.__GetElementContainers(parent, aContainers)
       
   339 	
       
   340 	def __ProcessSystemModelMetaElement(self, aElement):
       
   341 		# stub method - may deal with metadata elements at some point in the future
       
   342 		return	
   339 
   343 
   340 	def __ProcessSystemModelElement(self, aElement):
   344 	def __ProcessSystemModelElement(self, aElement):
   341 		"""Search for XML <unit/> elements with 'bldFile' attributes and resolve concrete bld.inf locations
   345 		"""Search for XML <unit/> elements with 'bldFile' attributes and resolve concrete bld.inf locations
   342 		with an appreciation of different schema versions."""
   346 		with an appreciation of different schema versions."""
   343 
   347 
       
   348 		# Metadata elements are processed separately - there are no further child nodes
       
   349 		# to process in this context
       
   350 		if aElement.tagName == "meta" :
       
   351 			return self.__ProcessSystemModelMetaElement(aElement)
       
   352 
   344 		# The effective "layer" is the item whose parent does not have an id (or name in 2.x and earlier)
   353 		# The effective "layer" is the item whose parent does not have an id (or name in 2.x and earlier)
   345 		if not aElement.parentNode.hasAttribute(self.__IdAttribute) :
   354 		if not aElement.parentNode.hasAttribute(self.__IdAttribute) :
   346 			currentLayer = aElement.getAttribute(self.__IdAttribute)
   355 			currentLayer = aElement.getAttribute(self.__IdAttribute)
   347 
   356 			
   348 			if not self.__LayerDetails.has_key(currentLayer):
   357 			if not self.__LayerDetails.has_key(currentLayer):
   349 				self.__LayerDetails[currentLayer] = []
   358 				self.__LayerDetails[currentLayer] = []
   350 
   359 
   351 			if not currentLayer in self.__LayerList:
   360 			if not currentLayer in self.__LayerList:
   352 				self.__LayerList.append(currentLayer)
   361 				self.__LayerList.append(currentLayer)
   378 				if self.__Version['MAJOR'] < 3:
   387 				if self.__Version['MAJOR'] < 3:
   379 					# absolute paths are not changed by root var in 1.x and 2.x
   388 					# absolute paths are not changed by root var in 1.x and 2.x
   380 					if not group.isAbsolute() and bldInfRoot:
   389 					if not group.isAbsolute() and bldInfRoot:
   381 						group = generic_path.Join(bldInfRoot, group)
   390 						group = generic_path.Join(bldInfRoot, group)
   382 				else:
   391 				else:
   383 					# only absolute paths are changed by root var in 3.x
   392 					# all paths are changed by root var in 3.x
   384 					if group.isAbsolute() and bldInfRoot:
   393 					if bldInfRoot:
   385 						group = generic_path.Join(bldInfRoot, group)
   394 						group = generic_path.Join(bldInfRoot, group)
   386 
   395 
   387 				bldinf = generic_path.Join(group, "bld.inf").FindCaseless()
   396 				bldinf = generic_path.Join(group, "bld.inf").FindCaseless()
   388 
   397 
   389 				if bldinf == None:
   398 				if bldinf == None:
   390 					# recording layers containing non existent bld.infs
   399 					# recording layers containing non existent bld.infs
   391 					bldinfname = group.GetLocalString()
   400 					bldinfname = group.GetLocalString()
   392 					bldinfname = bldinfname + 'bld.inf'
   401 					bldinfname = bldinfname+'/'+'bld.inf'
   393 					layer = self.__GetEffectiveLayer(aElement)
   402 					layer = self.__GetEffectiveLayer(aElement)
   394 					if not layer in self.__MissingBldInfs:
   403 					if not layer in self.__MissingBldInfs:
   395 						self.__MissingBldInfs[layer]=[]
   404 						self.__MissingBldInfs[layer]=[]
   396 					self.__MissingBldInfs[layer].append(bldinfname)
   405 					self.__MissingBldInfs[layer].append(bldinfname)
   397 
   406