]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
Sync BaseTools Branch (version r2271) to EDKII main trunk.
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Object / Parser / InfBinaryObject.py
1 ## @file
2 # This file is used to define class objects of INF file [Binaries] section.
3 # It will consumed by InfParser.
4 #
5 # Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
6 #
7 # This program and the accompanying materials are licensed and made available
8 # under the terms and conditions of the BSD License which accompanies this
9 # distribution. The full text of the license may be found at
10 # http://opensource.org/licenses/bsd-license.php
11 #
12 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 '''
16 InfBinaryObject
17 '''
18
19 import os
20
21 from copy import deepcopy
22 from Library import DataType as DT
23 from Library import GlobalData
24 import Logger.Log as Logger
25 from Logger import ToolError
26 from Logger import StringTable as ST
27 from Library.Misc import Sdict
28
29 from Object.Parser.InfCommonObject import InfSectionCommonDef
30 from Object.Parser.InfCommonObject import CurrentLine
31 from Library.Misc import ConvPathFromAbsToRel
32 from Library.ExpressionValidate import IsValidFeatureFlagExp
33 from Library.Misc import ValidFile
34 from Library.ParserValidate import IsValidPath
35
36
37 class InfBianryItem():
38 def __init__(self):
39 self.FileName = ''
40 self.Target = ''
41 self.FeatureFlagExp = ''
42 self.HelpString = ''
43 self.Type = ''
44 self.SupArchList = []
45
46 def SetFileName(self, FileName):
47 self.FileName = FileName
48 def GetFileName(self):
49 return self.FileName
50
51 def SetTarget(self, Target):
52 self.Target = Target
53 def GetTarget(self):
54 return self.Target
55
56 def SetFeatureFlagExp(self, FeatureFlagExp):
57 self.FeatureFlagExp = FeatureFlagExp
58 def GetFeatureFlagExp(self):
59 return self.FeatureFlagExp
60
61 def SetHelpString(self, HelpString):
62 self.HelpString = HelpString
63 def GetHelpString(self):
64 return self.HelpString
65
66 def SetType(self, Type):
67 self.Type = Type
68 def GetType(self):
69 return self.Type
70 def SetSupArchList(self, SupArchList):
71 self.SupArchList = SupArchList
72 def GetSupArchList(self):
73 return self.SupArchList
74
75 class InfBianryVerItem(InfBianryItem, CurrentLine):
76 def __init__(self):
77 InfBianryItem.__init__(self)
78 CurrentLine.__init__(self)
79 self.VerTypeName = ''
80
81 def SetVerTypeName(self, VerTypeName):
82 self.VerTypeName = VerTypeName
83 def GetVerTypeName(self):
84 return self.VerTypeName
85
86 class InfBianryUiItem(InfBianryItem, CurrentLine):
87 def __init__(self):
88 InfBianryItem.__init__(self)
89 CurrentLine.__init__(self)
90 self.UiTypeName = ''
91
92 def SetUiTypeName(self, UiTypeName):
93 self.UiTypeName = UiTypeName
94 def GetVerTypeName(self):
95 return self.UiTypeName
96
97 class InfBianryCommonItem(InfBianryItem, CurrentLine):
98 def __init__(self):
99 self.CommonType = ''
100 self.TagName = ''
101 self.Family = ''
102 InfBianryItem.__init__(self)
103 CurrentLine.__init__(self)
104
105 def SetCommonType(self, CommonType):
106 self.CommonType = CommonType
107 def GetCommonType(self):
108 return self.CommonType
109
110 def SetTagName(self, TagName):
111 self.TagName = TagName
112 def GetTagName(self):
113 return self.TagName
114
115 def SetFamily(self, Family):
116 self.Family = Family
117 def GetFamily(self):
118 return self.Family
119
120 ##
121 #
122 #
123 #
124 class InfBinariesObject(InfSectionCommonDef):
125 def __init__(self):
126 self.Binaries = Sdict()
127 #
128 # Macro defined in this section should be only used in this section.
129 #
130 self.Macros = {}
131 InfSectionCommonDef.__init__(self)
132
133 ## CheckVer
134 #
135 #
136 def CheckVer(self, Ver, __SupArchList):
137 #
138 # Check Ver
139 #
140 for VerItem in Ver:
141 IsValidFileFlag = False
142 VerContent = VerItem[0]
143 VerComment = VerItem[1]
144 VerCurrentLine = VerItem[2]
145 GlobalData.gINF_CURRENT_LINE = VerCurrentLine
146 InfBianryVerItemObj = None
147 #
148 # Should not less than 2 elements
149 #
150 if len(VerContent) < 2:
151 Logger.Error("InfParser",
152 ToolError.FORMAT_INVALID,
153 ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID % (VerContent[0]),
154 File=VerCurrentLine.GetFileName(),
155 Line=VerCurrentLine.GetLineNo(),
156 ExtraData=VerCurrentLine.GetLineString())
157 return False
158 if len(VerContent) > 4:
159 Logger.Error("InfParser",
160 ToolError.FORMAT_INVALID,
161 ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX % (VerContent[0], 4),
162 File=VerCurrentLine.GetFileName(),
163 Line=VerCurrentLine.GetLineNo(),
164 ExtraData=VerCurrentLine.GetLineString())
165 return False
166 if len(VerContent) >= 2:
167 #
168 # Create a Ver Object.
169 #
170 InfBianryVerItemObj = InfBianryVerItem()
171
172 if VerContent[0] != DT.BINARY_FILE_TYPE_VER:
173 Logger.Error("InfParser",
174 ToolError.FORMAT_INVALID,
175 ST.ERR_INF_PARSER_BINARY_VER_TYPE % DT.BINARY_FILE_TYPE_VER,
176 File=VerCurrentLine.GetFileName(),
177 Line=VerCurrentLine.GetLineNo(),
178 ExtraData=VerCurrentLine.GetLineString())
179
180 InfBianryVerItemObj.SetVerTypeName(VerContent[0])
181 InfBianryVerItemObj.SetType(VerContent[0])
182 #
183 # Verify File exist or not
184 #
185 FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gINF_MODULE_DIR,
186 VerContent[1])))
187 if not (ValidFile(FullFileName) or ValidFile(VerContent[1])):
188 Logger.Error("InfParser",
189 ToolError.FORMAT_INVALID,
190 ST.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST % (VerContent[1]),
191 File=VerCurrentLine.GetFileName(),
192 Line=VerCurrentLine.GetLineNo(),
193 ExtraData=VerCurrentLine.GetLineString())
194 #
195 # Validate file exist/format.
196 #
197 if IsValidPath(VerContent[1], GlobalData.gINF_MODULE_DIR):
198 IsValidFileFlag = True
199 else:
200 Logger.Error("InfParser",
201 ToolError.FORMAT_INVALID,
202 ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (VerContent[1]),
203 File=VerCurrentLine.GetFileName(),
204 Line=VerCurrentLine.GetLineNo(),
205 ExtraData=VerCurrentLine.GetLineString())
206 return False
207 if IsValidFileFlag:
208 VerContent[0] = ConvPathFromAbsToRel(VerContent[0],
209 GlobalData.gINF_MODULE_DIR)
210 InfBianryVerItemObj.SetFileName(VerContent[1])
211 if len(VerContent) >= 3:
212 #
213 # Add Target information
214 #
215 InfBianryVerItemObj.SetTarget(VerContent[2])
216 if len(VerContent) == 4:
217 if VerContent[3].strip() == '':
218 Logger.Error("InfParser",
219 ToolError.FORMAT_INVALID,
220 ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
221 File=VerCurrentLine.GetFileName(),
222 Line=VerCurrentLine.GetLineNo(),
223 ExtraData=VerCurrentLine.GetLineString())
224 #
225 # Validate Feature Flag Express
226 #
227 FeatureFlagRtv = IsValidFeatureFlagExp(VerContent[3].\
228 strip())
229 if not FeatureFlagRtv[0]:
230 Logger.Error("InfParser",
231 ToolError.FORMAT_INVALID,
232 ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
233 File=VerCurrentLine.GetFileName(),
234 Line=VerCurrentLine.GetLineNo(),
235 ExtraData=VerCurrentLine.GetLineString())
236 InfBianryVerItemObj.SetFeatureFlagExp(VerContent[3])
237
238 InfBianryVerItemObj.SetSupArchList(__SupArchList)
239
240 #
241 # Determine binary file name duplicate. Follow below rule:
242 #
243 # A binary filename must not be duplicated within
244 # a [Binaries] section. A binary filename may appear in
245 # multiple architectural [Binaries] sections. A binary
246 # filename listed in an architectural [Binaries] section
247 # must not be listed in the common architectural
248 # [Binaries] section.
249 #
250 # NOTE: This check will not report error now.
251 #
252 for Item in self.Binaries:
253 if Item.GetFileName() == InfBianryVerItemObj.GetFileName():
254 ItemSupArchList = Item.GetSupArchList()
255 for ItemArch in ItemSupArchList:
256 for VerItemObjArch in __SupArchList:
257 if ItemArch == VerItemObjArch:
258 #
259 # ST.ERR_INF_PARSER_ITEM_DUPLICATE
260 #
261 pass
262 if ItemArch.upper() == 'COMMON' or VerItemObjArch.upper() == 'COMMON':
263 #
264 # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
265 #
266 pass
267
268 if InfBianryVerItemObj != None:
269 if self.Binaries.has_key((InfBianryVerItemObj)):
270 BinariesList = self.Binaries[InfBianryVerItemObj]
271 BinariesList.append((InfBianryVerItemObj, VerComment))
272 self.Binaries[InfBianryVerItemObj] = BinariesList
273 else:
274 BinariesList = []
275 BinariesList.append((InfBianryVerItemObj, VerComment))
276 self.Binaries[InfBianryVerItemObj] = BinariesList
277
278 ## ParseCommonBinary
279 #
280 # ParseCommonBinary
281 #
282 def ParseCommonBinary(self, CommonBinary, __SupArchList):
283 #
284 # Check common binary definitions
285 # Type | FileName | Target | Family | TagName | FeatureFlagExp
286 #
287 for Item in CommonBinary:
288 IsValidFileFlag = False
289 ItemContent = Item[0]
290 ItemComment = Item[1]
291 CurrentLineOfItem = Item[2]
292 GlobalData.gINF_CURRENT_LINE = CurrentLineOfItem
293 InfBianryCommonItemObj = None
294 if len(ItemContent) < 2:
295 Logger.Error("InfParser",
296 ToolError.FORMAT_INVALID,
297 ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID % (ItemContent[0]),
298 File=CurrentLineOfItem.GetFileName(),
299 Line=CurrentLineOfItem.GetLineNo(),
300 ExtraData=CurrentLineOfItem.GetLineString())
301 return False
302 if len(ItemContent) > 6:
303 Logger.Error("InfParser",
304 ToolError.FORMAT_INVALID,
305 ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX % (ItemContent[0], 6),
306 File=CurrentLineOfItem.GetFileName(),
307 Line=CurrentLineOfItem.GetLineNo(),
308 ExtraData=CurrentLineOfItem.GetLineString())
309 return False
310 if len(ItemContent) >= 2:
311 #
312 # Create a Common Object.
313 #
314 InfBianryCommonItemObj = InfBianryCommonItem()
315 #
316 # Convert Binary type.
317 #
318 BinaryFileType = ItemContent[0].strip()
319 if BinaryFileType == 'RAW' or BinaryFileType == 'ACPI' or BinaryFileType == 'ASL':
320 BinaryFileType = 'BIN'
321
322 if BinaryFileType not in DT.BINARY_FILE_TYPE_LIST:
323 Logger.Error("InfParser",
324 ToolError.FORMAT_INVALID,
325 ST.ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE % \
326 (DT.BINARY_FILE_TYPE_LIST.__str__()),
327 File=CurrentLineOfItem.GetFileName(),
328 Line=CurrentLineOfItem.GetLineNo(),
329 ExtraData=CurrentLineOfItem.GetLineString())
330
331 if BinaryFileType == 'SUBTYPE_GUID':
332 BinaryFileType = 'FREEFORM'
333
334 if BinaryFileType == 'LIB' or BinaryFileType == 'UEFI_APP':
335 Logger.Error("InfParser",
336 ToolError.FORMAT_INVALID,
337 ST.ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE % \
338 (DT.BINARY_FILE_TYPE_LIST.__str__()),
339 File=CurrentLineOfItem.GetFileName(),
340 Line=CurrentLineOfItem.GetLineNo(),
341 ExtraData=CurrentLineOfItem.GetLineString())
342
343 InfBianryCommonItemObj.SetType(BinaryFileType)
344 InfBianryCommonItemObj.SetCommonType(ItemContent[0])
345 #
346 # Verify File exist or not
347 #
348 FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gINF_MODULE_DIR,
349 ItemContent[1])))
350 if not (ValidFile(FullFileName) or ValidFile(ItemContent[1])):
351 Logger.Error("InfParser",
352 ToolError.FORMAT_INVALID,
353 ST.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST % (ItemContent[1]),
354 File=CurrentLineOfItem.GetFileName(),
355 Line=CurrentLineOfItem.GetLineNo(),
356 ExtraData=CurrentLineOfItem.GetLineString())
357 #
358 # Validate file exist/format.
359 #
360 if IsValidPath(ItemContent[1], GlobalData.gINF_MODULE_DIR):
361 IsValidFileFlag = True
362 else:
363 Logger.Error("InfParser",
364 ToolError.FORMAT_INVALID,
365 ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (ItemContent[1]),
366 File=CurrentLineOfItem.GetFileName(),
367 Line=CurrentLineOfItem.GetLineNo(),
368 ExtraData=CurrentLineOfItem.GetLineString())
369 return False
370 if IsValidFileFlag:
371 ItemContent[0] = ConvPathFromAbsToRel(ItemContent[0], GlobalData.gINF_MODULE_DIR)
372 InfBianryCommonItemObj.SetFileName(ItemContent[1])
373 if len(ItemContent) >= 3:
374 #
375 # Add Target information
376 #
377 InfBianryCommonItemObj.SetTarget(ItemContent[2])
378 if len(ItemContent) >= 4:
379 #
380 # Add Family information
381 #
382 InfBianryCommonItemObj.SetFamily(ItemContent[3])
383 if len(ItemContent) >= 5:
384 #
385 # TagName entries are build system specific. If there
386 # is content in the entry, the tool must exit
387 # gracefully with an error message that indicates build
388 # system specific content cannot be distributed using
389 # the UDP
390 #
391 if ItemContent[4].strip() != '':
392 Logger.Error("InfParser",
393 ToolError.FORMAT_INVALID,
394 ST.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED % (ItemContent[4]),
395 File=CurrentLineOfItem.GetFileName(),
396 Line=CurrentLineOfItem.GetLineNo(),
397 ExtraData=CurrentLineOfItem.GetLineString())
398 if len(ItemContent) == 6:
399 #
400 # Add FeatureFlagExp
401 #
402 if ItemContent[5].strip() == '':
403 Logger.Error("InfParser",
404 ToolError.FORMAT_INVALID,
405 ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
406 File=CurrentLineOfItem.GetFileName(),
407 Line=CurrentLineOfItem.GetLineNo(),
408 ExtraData=CurrentLineOfItem.GetLineString())
409 #
410 # Validate Feature Flag Express
411 #
412 FeatureFlagRtv = IsValidFeatureFlagExp(ItemContent[5].strip())
413 if not FeatureFlagRtv[0]:
414 Logger.Error("InfParser",
415 ToolError.FORMAT_INVALID,
416 ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
417 File=CurrentLineOfItem.GetFileName(),
418 Line=CurrentLineOfItem.GetLineNo(),
419 ExtraData=CurrentLineOfItem.GetLineString())
420 InfBianryCommonItemObj.SetFeatureFlagExp(ItemContent[5])
421
422 InfBianryCommonItemObj.SetSupArchList(__SupArchList)
423
424 #
425 # Determine binary file name duplicate. Follow below rule:
426 #
427 # A binary filename must not be duplicated within
428 # a [Binaries] section. A binary filename may appear in
429 # multiple architectural [Binaries] sections. A binary
430 # filename listed in an architectural [Binaries] section
431 # must not be listed in the common architectural
432 # [Binaries] section.
433 #
434 # NOTE: This check will not report error now.
435 #
436 # for Item in self.Binaries:
437 # if Item.GetFileName() == InfBianryCommonItemObj.GetFileName():
438 # ItemSupArchList = Item.GetSupArchList()
439 # for ItemArch in ItemSupArchList:
440 # for ComItemObjArch in __SupArchList:
441 # if ItemArch == ComItemObjArch:
442 # #
443 # # ST.ERR_INF_PARSER_ITEM_DUPLICATE
444 # #
445 # pass
446 #
447 # if ItemArch.upper() == 'COMMON' or ComItemObjArch.upper() == 'COMMON':
448 # #
449 # # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
450 # #
451 # pass
452
453 if InfBianryCommonItemObj != None:
454 if self.Binaries.has_key((InfBianryCommonItemObj)):
455 BinariesList = self.Binaries[InfBianryCommonItemObj]
456 BinariesList.append((InfBianryCommonItemObj, ItemComment))
457 self.Binaries[InfBianryCommonItemObj] = BinariesList
458 else:
459 BinariesList = []
460 BinariesList.append((InfBianryCommonItemObj, ItemComment))
461 self.Binaries[InfBianryCommonItemObj] = BinariesList
462
463 def SetBinary(self, UiInf=None, Ver=None, CommonBinary=None, ArchList=None):
464
465 __SupArchList = []
466 for ArchItem in ArchList:
467 #
468 # Validate Arch
469 #
470 if (ArchItem == '' or ArchItem == None):
471 ArchItem = 'COMMON'
472 __SupArchList.append(ArchItem)
473
474 if UiInf != None:
475 if len(UiInf) > 0:
476 #
477 # Check UI
478 #
479 for UiItem in UiInf:
480 IsValidFileFlag = False
481 InfBianryUiItemObj = None
482 UiContent = UiItem[0]
483 UiComment = UiItem[1]
484 UiCurrentLine = UiItem[2]
485 GlobalData.gINF_CURRENT_LINE = deepcopy(UiItem[2])
486 #
487 # Should not less than 2 elements
488 #
489 if len(UiContent) < 2:
490 Logger.Error("InfParser",
491 ToolError.FORMAT_INVALID,
492 ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID % (UiContent[0]),
493 File=UiCurrentLine.GetFileName(),
494 Line=UiCurrentLine.GetLineNo(),
495 ExtraData=UiCurrentLine.GetLineString())
496 return False
497
498 if len(UiContent) > 4:
499 Logger.Error("InfParser",
500 ToolError.FORMAT_INVALID,
501 ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX % (UiContent[0], 4),
502 File=UiCurrentLine.GetFileName(),
503 Line=UiCurrentLine.GetLineNo(),
504 ExtraData=UiCurrentLine.GetLineString())
505 return False
506 if len(UiContent) >= 2:
507 #
508 # Create an Ui Object.
509 #
510 InfBianryUiItemObj = InfBianryUiItem()
511 if UiContent[0] != 'UI':
512 Logger.Error("InfParser",
513 ToolError.FORMAT_INVALID,
514 ST.ERR_INF_PARSER_BINARY_VER_TYPE % ('UI'),
515 File=UiCurrentLine.GetFileName(),
516 Line=UiCurrentLine.GetLineNo(),
517 ExtraData=UiCurrentLine.GetLineString())
518 InfBianryUiItemObj.SetUiTypeName(UiContent[0])
519 InfBianryUiItemObj.SetType(UiContent[0])
520 #
521 # Verify File exist or not
522 #
523 FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gINF_MODULE_DIR,
524 UiContent[1])))
525 if not (ValidFile(FullFileName) or ValidFile(UiContent[1])):
526 Logger.Error("InfParser",
527 ToolError.FORMAT_INVALID,
528 ST.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST % (UiContent[1]),
529 File=UiCurrentLine.GetFileName(),
530 Line=UiCurrentLine.GetLineNo(),
531 ExtraData=UiCurrentLine.GetLineString())
532 #
533 # Validate file exist/format.
534 #
535 if IsValidPath(UiContent[1], GlobalData.gINF_MODULE_DIR):
536 IsValidFileFlag = True
537 else:
538 Logger.Error("InfParser",
539 ToolError.FORMAT_INVALID,
540 ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (UiContent[1]),
541 File=UiCurrentLine.GetFileName(),
542 Line=UiCurrentLine.GetLineNo(),
543 ExtraData=UiCurrentLine.GetLineString())
544 return False
545 if IsValidFileFlag:
546 UiContent[0] = ConvPathFromAbsToRel(UiContent[0], GlobalData.gINF_MODULE_DIR)
547 InfBianryUiItemObj.SetFileName(UiContent[1])
548 if len(UiContent) >= 3:
549 #
550 # Add Target information
551 #
552 InfBianryUiItemObj.SetTarget(UiContent[2])
553 if len(UiContent) == 4:
554 if UiContent[3].strip() == '':
555 Logger.Error("InfParser",
556 ToolError.FORMAT_INVALID,
557 ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
558 File=UiCurrentLine.GetFileName(),
559 Line=UiCurrentLine.GetLineNo(),
560 ExtraData=UiCurrentLine.GetLineString())
561 #
562 # Validate Feature Flag Express
563 #
564 FeatureFlagRtv = IsValidFeatureFlagExp(UiContent[3].strip())
565 if not FeatureFlagRtv[0]:
566 Logger.Error("InfParser",
567 ToolError.FORMAT_INVALID,
568 ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
569 File=UiCurrentLine.GetFileName(),
570 Line=UiCurrentLine.GetLineNo(),
571 ExtraData=UiCurrentLine.GetLineString())
572 InfBianryUiItemObj.SetFeatureFlagExp(UiContent[3])
573
574 InfBianryUiItemObj.SetSupArchList(__SupArchList)
575
576 #
577 # Determine binary file name duplicate. Follow below rule:
578 #
579 # A binary filename must not be duplicated within
580 # a [Binaries] section. A binary filename may appear in
581 # multiple architectural [Binaries] sections. A binary
582 # filename listed in an architectural [Binaries] section
583 # must not be listed in the common architectural
584 # [Binaries] section.
585 #
586 # NOTE: This check will not report error now.
587 #
588 # for Item in self.Binaries:
589 # if Item.GetFileName() == InfBianryUiItemObj.GetFileName():
590 # ItemSupArchList = Item.GetSupArchList()
591 # for ItemArch in ItemSupArchList:
592 # for UiItemObjArch in __SupArchList:
593 # if ItemArch == UiItemObjArch:
594 # #
595 # # ST.ERR_INF_PARSER_ITEM_DUPLICATE
596 # #
597 # pass
598 # if ItemArch.upper() == 'COMMON' or UiItemObjArch.upper() == 'COMMON':
599 # #
600 # # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
601 # #
602 # pass
603
604 if InfBianryUiItemObj != None:
605 if self.Binaries.has_key((InfBianryUiItemObj)):
606 BinariesList = self.Binaries[InfBianryUiItemObj]
607 BinariesList.append((InfBianryUiItemObj, UiComment))
608 self.Binaries[InfBianryUiItemObj] = BinariesList
609 else:
610 BinariesList = []
611 BinariesList.append((InfBianryUiItemObj, UiComment))
612 self.Binaries[InfBianryUiItemObj] = BinariesList
613 if Ver != None and len(Ver) > 0:
614 self.CheckVer(Ver, __SupArchList)
615 if CommonBinary and len(CommonBinary) > 0:
616 self.ParseCommonBinary(CommonBinary, __SupArchList)
617
618 return True
619
620 def GetBinary(self):
621 return self.Binaries