| Index: scripts/common/archive_utils.py
|
| diff --git a/scripts/common/archive_utils.py b/scripts/common/archive_utils.py
|
| index 32b45f29e3dbd34a1952aed708f4cfc30bdde141..a2fa1d858c90b1da55b309ed23b369078736ca09 100644
|
| --- a/scripts/common/archive_utils.py
|
| +++ b/scripts/common/archive_utils.py
|
| @@ -78,33 +78,33 @@
|
| self._buildtype = buildtype
|
| self._arch = arch
|
| self._files_cfg = self._ParseFilesCfg(files_file)
|
| - self._files_list = self._FilterFilesCfg()
|
| + self.files_dict = self._FilterFilesCfg()
|
|
|
| def _SetArch(self, value):
|
| - """Set build arch and reset files_list to reflect new build criteria."""
|
| + """Set build arch and reset files_dict to reflect new build criteria."""
|
| self._arch = value
|
| - del self._files_list[:]
|
| - self._files_list.extend(self._FilterFilesCfg())
|
| + self.files_dict.clear()
|
| + self.files_dict.update(self._FilterFilesCfg())
|
|
|
| arch = property(fset=_SetArch)
|
|
|
| def _SetBuildType(self, value):
|
| - """Set build type and reset files_list to reflect new build criteria."""
|
| + """Set build type and reset files_dict to reflect new build criteria."""
|
| self._buildtype = value
|
| - del self._files_list[:]
|
| - self._files_list.extend(self._FilterFilesCfg())
|
| + self.files_dict.clear()
|
| + self.files_dict.update(self._FilterFilesCfg())
|
|
|
| buildtype = property(fset=_SetBuildType)
|
|
|
| def _FilterFilesCfg(self):
|
| - """Return a list of file items that match the current build criteria."""
|
| - files_list = []
|
| + """Return a dict of file items that match the current build criteria."""
|
| + files_dict = {}
|
| for fileobj in self._files_cfg:
|
| if self._buildtype not in fileobj['buildtype']:
|
| continue
|
| if not fileobj.get('arch') or self._arch in fileobj['arch']:
|
| - files_list.append(fileobj)
|
| - return files_list
|
| + files_dict[fileobj['filename']] = fileobj
|
| + return files_dict
|
|
|
| @staticmethod
|
| def _ParseFilesCfg(files_file):
|
| @@ -133,24 +133,19 @@
|
|
|
| def IsOptional(self, filename):
|
| """Determine if the given filename is marked optional for this config."""
|
| - found_optional = False
|
| - for fileobj in self._files_list:
|
| - if fileobj['filename'] == filename:
|
| - found_optional = True
|
| - if self._buildtype not in fileobj['optional']:
|
| - return False
|
| - return found_optional
|
| + return (self.files_dict.get(filename) and self._buildtype in
|
| + self.files_dict[filename].get('optional', []))
|
|
|
| def ParseGroup(self, filegroup):
|
| """Return the list of filenames in the given group (e.g. "symbols")."""
|
| - return [fileobj['filename'] for fileobj in self._files_list
|
| + return [fileobj['filename'] for fileobj in self.files_dict.itervalues()
|
| if (fileobj.get('filegroup') and filegroup in fileobj.get('filegroup'))
|
| ]
|
|
|
| def ParseArchiveLists(self):
|
| """Generate a dict of all the file items in all archives."""
|
| archive_lists = {}
|
| - for fileobj in self._files_list:
|
| + for fileobj in self.files_dict.itervalues():
|
| if fileobj.get('archive'):
|
| archive_lists.setdefault(fileobj['archive'], []).append(fileobj)
|
| return archive_lists
|
| @@ -162,7 +157,7 @@
|
| filegroup (i.e. legacy entries from before the filegroup field was added.)
|
| """
|
| files_list = [
|
| - fileobj['filename'] for fileobj in self._files_list
|
| + fileobj['filename'] for fileobj in self.files_dict.itervalues()
|
| if (not fileobj.get('archive') and
|
| (not fileobj.get('filegroup') or 'default' in
|
| fileobj.get('filegroup')))
|
|
|