55""" Function that determines if a unit should be included or not.
+ 56 returns None => could be included, string reason.
+ 57 """
+ 58
+ 59defhasvalue(filter_list,value):
+ 60""" Check if a filter list contains a particular value.
+ 61 It handles list's item negation using "!".
+ 62 """
+ 63forlist_valueinfilter_list:
+ 64iflist_value==value:
+ 65returnTrue
+ 66returnFalse
+
203""" Initialisation """
+204_UnitGroup.__init__(self,node,sysDef)
+205forunitRefinnode_scan(self._xml,"unitRef"):
+206try:
+207self._units.append(units[unitRef.unit])
+208exceptKeyError,error:
+209sys.stderr.write("ERROR: Could not find unit '%s'\n"%unitRef.unit+"\n"+error)
+
302""" Process unit list from layers """
+303result=[]
+304forrefinnode_scan(self.__xml,"unitListRef"):
+305units=[]
+306try:
+307units=self._config.sdf.unitlists[ref.unitList].units
+308forunitinunits:
+309reason=filter_out(self._config.filters,unit.filters)
+310ifreason==None:
+311result.append(unit)
+312else:
+313sys.stderr.write("Filter-out: %s (%s)\n"%(unit.id,reason))
+314exceptKeyError,error:
+315sys.stderr.write("ERROR: Could not find unitList of layer %s\n"%error)
+316returnresult
+
359""" Unit list references getter method. """
+360result=[]
+361forrefinnode_scan(self.__xml,"unitListRef"):
+362try:
+363result.append(self._sysDef.unitlists[ref.unitList])
+364exceptKeyError,error:
+365sys.stderr.write("ERROR: Could not find unitList %s\n"%error)
+366returnresult
+
369""" Return unit from unitList or layer. """
+370result=[]
+371forrefinnode_scan(self.__xml,"unitListRef|layerRef"):
+372units=[]
+373try:
+374ifref.nodeName=='unitListRef':
+375units=self._sysDef.unitlists[ref.unitList].units
+376else:
+377units=self._sysDef.layers[ref.layerName].units
+378forunitinunits:
+379reason=filter_out(self.filters,unit.filters)
+380ifreason==None:
+381# Get the unit object from the cache if this is a string
+382# TODO - remove once unitlist returns list of Unit objects
+383ifisinstance(unit,types.UnicodeType):
+384unit=self._sysDef[unit]
+385result.append(unit)
+386else:
+387sys.stderr.write("Filter-out: %s (%s)\n"%(unit.id,reason))
+388exceptKeyError,error:
+389sys.stderr.write("ERROR: Could not find unitList or layer %s\n"%error)
+390returnresult
+
449""" Logical representation of the System Definition.
+450
+451 The System Definition is defined in terms of a system model and a
+452 build model. The default physical representation of this is the Symbian
+453 XML format. """
+
560""" Adds SysDef element to cache. """
+561#TODO - handle duplicate names of different types
+562ifnotself._cache.has_key(element.get_id()):
+563self._cache[element.get_id()]=element
+564_logger.info('Adding SysDef element to cache: %s'%str(element))
+565else:
+566_logger.warning("Element already exists: %s"%element.name)
+
573""" Merge binaries based on build log and system definition. """
+574for(unit_name,binaries)inbinaries_reader:
+575unit_name=unit_name.lower()
+576ifself.units.has_key(unit_name):
+577forbininbinaries:
+578#if bin.find('_stolon_ekern') != -1:
+579_logger.debug("Merging: %s"%bin)
+580unit=self.units[unit_name]
+581unit.binaries=[Binary(bin.lower(),self)forbininbinaries]
+582forbinaryinunit.binaries:
+583self.addElement(binary)
+584_logger.info('Merging binary: %s'%str(binary))
+585else:
+586_logger.warning('Component found in the build log but not in sysdef: %s'%unit_name)
+
589""" Merge binary size base on binary sizes input and system definition. """
+590for(binary_name,size,rom_type)inbinary_sizes_reader:
+591#if binary_name.find('_stolon_ekern') != -1:
+592
+593binary_name=binary_name.lower()
+594_logger.debug("Merging binary size: %s"%binary_name)
+595ifself._cache.has_key(binary_name):
+596binary=self._cache[binary_name]
+597binary.size=size
+598binary.rom_type=rom_type
+599else:
+600_logger.warning('Binary found in the binary sizes input but not in the system definition: %s'%binary_name)
+