2 # This file is used to define class objects of INF file [Binaries] section.
3 # It will consumed by InfParser.
5 # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
7 # SPDX-License-Identifier: BSD-2-Clause-Patent
15 from copy
import deepcopy
16 from Library
import DataType
as DT
17 from Library
import GlobalData
18 import Logger
.Log
as Logger
19 from Logger
import ToolError
20 from Logger
import StringTable
as ST
21 from Library
.Misc
import Sdict
23 from Object
.Parser
.InfCommonObject
import InfSectionCommonDef
24 from Object
.Parser
.InfCommonObject
import CurrentLine
25 from Library
.Misc
import ConvPathFromAbsToRel
26 from Library
.ExpressionValidate
import IsValidFeatureFlagExp
27 from Library
.Misc
import ValidFile
28 from Library
.ParserValidate
import IsValidPath
31 class InfBianryItem():
35 self
.FeatureFlagExp
= ''
40 def SetFileName(self
, FileName
):
41 self
.FileName
= FileName
42 def GetFileName(self
):
45 def SetTarget(self
, Target
):
50 def SetFeatureFlagExp(self
, FeatureFlagExp
):
51 self
.FeatureFlagExp
= FeatureFlagExp
52 def GetFeatureFlagExp(self
):
53 return self
.FeatureFlagExp
55 def SetHelpString(self
, HelpString
):
56 self
.HelpString
= HelpString
57 def GetHelpString(self
):
58 return self
.HelpString
60 def SetType(self
, Type
):
64 def SetSupArchList(self
, SupArchList
):
65 self
.SupArchList
= SupArchList
66 def GetSupArchList(self
):
67 return self
.SupArchList
69 class InfBianryVerItem(InfBianryItem
, CurrentLine
):
71 InfBianryItem
.__init
__(self
)
72 CurrentLine
.__init
__(self
)
75 def SetVerTypeName(self
, VerTypeName
):
76 self
.VerTypeName
= VerTypeName
77 def GetVerTypeName(self
):
78 return self
.VerTypeName
80 class InfBianryUiItem(InfBianryItem
, CurrentLine
):
82 InfBianryItem
.__init
__(self
)
83 CurrentLine
.__init
__(self
)
86 def SetUiTypeName(self
, UiTypeName
):
87 self
.UiTypeName
= UiTypeName
88 def GetVerTypeName(self
):
89 return self
.UiTypeName
91 class InfBianryCommonItem(InfBianryItem
, CurrentLine
):
97 InfBianryItem
.__init
__(self
)
98 CurrentLine
.__init
__(self
)
100 def SetCommonType(self
, CommonType
):
101 self
.CommonType
= CommonType
102 def GetCommonType(self
):
103 return self
.CommonType
105 def SetTagName(self
, TagName
):
106 self
.TagName
= TagName
107 def GetTagName(self
):
110 def SetFamily(self
, Family
):
115 def SetGuidValue(self
, GuidValue
):
116 self
.GuidValue
= GuidValue
117 def GetGuidValue(self
):
118 return self
.GuidValue
124 class InfBinariesObject(InfSectionCommonDef
):
126 self
.Binaries
= Sdict()
128 # Macro defined in this section should be only used in this section.
131 InfSectionCommonDef
.__init
__(self
)
136 def CheckVer(self
, Ver
, __SupArchList
):
141 IsValidFileFlag
= False
142 VerContent
= VerItem
[0]
143 VerComment
= VerItem
[1]
144 VerCurrentLine
= VerItem
[2]
145 GlobalData
.gINF_CURRENT_LINE
= VerCurrentLine
146 InfBianryVerItemObj
= None
148 # Should not less than 2 elements
150 if len(VerContent
) < 2:
151 Logger
.Error("InfParser",
152 ToolError
.FORMAT_INVALID
,
153 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID
% (VerContent
[0], 2),
154 File
=VerCurrentLine
.GetFileName(),
155 Line
=VerCurrentLine
.GetLineNo(),
156 ExtraData
=VerCurrentLine
.GetLineString())
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())
166 if len(VerContent
) >= 2:
168 # Create a Ver Object.
170 InfBianryVerItemObj
= InfBianryVerItem()
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())
180 InfBianryVerItemObj
.SetVerTypeName(VerContent
[0])
181 InfBianryVerItemObj
.SetType(VerContent
[0])
183 # Verify File exist or not
185 FullFileName
= os
.path
.normpath(os
.path
.realpath(os
.path
.join(GlobalData
.gINF_MODULE_DIR
,
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())
195 # Validate file exist/format.
197 if IsValidPath(VerContent
[1], GlobalData
.gINF_MODULE_DIR
):
198 IsValidFileFlag
= True
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())
208 VerContent
[0] = ConvPathFromAbsToRel(VerContent
[0],
209 GlobalData
.gINF_MODULE_DIR
)
210 InfBianryVerItemObj
.SetFileName(VerContent
[1])
211 if len(VerContent
) >= 3:
213 # Add Target information
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())
225 # Validate Feature Flag Express
227 FeatureFlagRtv
= IsValidFeatureFlagExp(VerContent
[3].\
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])
238 InfBianryVerItemObj
.SetSupArchList(__SupArchList
)
241 # Determine binary file name duplicate. Follow below rule:
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.
250 # NOTE: This check will not report error now.
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
:
259 # ST.ERR_INF_PARSER_ITEM_DUPLICATE
262 if ItemArch
.upper() == 'COMMON' or VerItemObjArch
.upper() == 'COMMON':
264 # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
268 if InfBianryVerItemObj
is not None:
269 if (InfBianryVerItemObj
) in self
.Binaries
:
270 BinariesList
= self
.Binaries
[InfBianryVerItemObj
]
271 BinariesList
.append((InfBianryVerItemObj
, VerComment
))
272 self
.Binaries
[InfBianryVerItemObj
] = BinariesList
275 BinariesList
.append((InfBianryVerItemObj
, VerComment
))
276 self
.Binaries
[InfBianryVerItemObj
] = BinariesList
282 def ParseCommonBinary(self
, CommonBinary
, __SupArchList
):
284 # Check common binary definitions
285 # Type | FileName | Target | Family | TagName | FeatureFlagExp
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 ItemContent
[0] == 'SUBTYPE_GUID':
295 if len(ItemContent
) < 3:
296 Logger
.Error("InfParser",
297 ToolError
.FORMAT_INVALID
,
298 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID
% (ItemContent
[0], 3),
299 File
=CurrentLineOfItem
.GetFileName(),
300 Line
=CurrentLineOfItem
.GetLineNo(),
301 ExtraData
=CurrentLineOfItem
.GetLineString())
304 if len(ItemContent
) < 2:
305 Logger
.Error("InfParser",
306 ToolError
.FORMAT_INVALID
,
307 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID
% (ItemContent
[0], 2),
308 File
=CurrentLineOfItem
.GetFileName(),
309 Line
=CurrentLineOfItem
.GetLineNo(),
310 ExtraData
=CurrentLineOfItem
.GetLineString())
313 if len(ItemContent
) > 7:
314 Logger
.Error("InfParser",
315 ToolError
.FORMAT_INVALID
,
316 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX
% (ItemContent
[0], 7),
317 File
=CurrentLineOfItem
.GetFileName(),
318 Line
=CurrentLineOfItem
.GetLineNo(),
319 ExtraData
=CurrentLineOfItem
.GetLineString())
321 if len(ItemContent
) >= 2:
323 # Create a Common Object.
325 InfBianryCommonItemObj
= InfBianryCommonItem()
327 # Convert Binary type.
329 BinaryFileType
= ItemContent
[0].strip()
330 if BinaryFileType
== 'RAW' or BinaryFileType
== 'ACPI' or BinaryFileType
== 'ASL':
331 BinaryFileType
= 'BIN'
333 if BinaryFileType
not in DT
.BINARY_FILE_TYPE_LIST
:
334 Logger
.Error("InfParser",
335 ToolError
.FORMAT_INVALID
,
336 ST
.ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE
% \
337 (DT
.BINARY_FILE_TYPE_LIST
.__str
__()),
338 File
=CurrentLineOfItem
.GetFileName(),
339 Line
=CurrentLineOfItem
.GetLineNo(),
340 ExtraData
=CurrentLineOfItem
.GetLineString())
342 if BinaryFileType
== 'SUBTYPE_GUID':
343 BinaryFileType
= 'FREEFORM'
345 if BinaryFileType
== 'LIB' or BinaryFileType
== 'UEFI_APP':
346 Logger
.Error("InfParser",
347 ToolError
.FORMAT_INVALID
,
348 ST
.ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE
% \
349 (DT
.BINARY_FILE_TYPE_LIST
.__str
__()),
350 File
=CurrentLineOfItem
.GetFileName(),
351 Line
=CurrentLineOfItem
.GetLineNo(),
352 ExtraData
=CurrentLineOfItem
.GetLineString())
354 InfBianryCommonItemObj
.SetType(BinaryFileType
)
355 InfBianryCommonItemObj
.SetCommonType(ItemContent
[0])
357 if BinaryFileType
== 'FREEFORM':
358 InfBianryCommonItemObj
.SetGuidValue(ItemContent
[1])
359 if len(ItemContent
) >= 3:
360 FileName
= ItemContent
[2]
362 Logger
.Error("InfParser",
363 ToolError
.FORMAT_INVALID
,
364 ST
.ERR_INF_PARSER_BINARY_ITEM_FILENAME_NOT_EXIST
,
365 File
=CurrentLineOfItem
.GetFileName(),
366 Line
=CurrentLineOfItem
.GetLineNo(),
367 ExtraData
=CurrentLineOfItem
.GetLineString())
369 FileName
= ItemContent
[1]
371 # Verify File exist or not
373 FullFileName
= os
.path
.normpath(os
.path
.realpath(os
.path
.join(GlobalData
.gINF_MODULE_DIR
,
375 if not (ValidFile(FullFileName
) or ValidFile(FileName
)):
376 Logger
.Error("InfParser",
377 ToolError
.FORMAT_INVALID
,
378 ST
.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST
% (FileName
),
379 File
=CurrentLineOfItem
.GetFileName(),
380 Line
=CurrentLineOfItem
.GetLineNo(),
381 ExtraData
=CurrentLineOfItem
.GetLineString())
383 # Validate file exist/format.
385 if IsValidPath(FileName
, GlobalData
.gINF_MODULE_DIR
):
386 IsValidFileFlag
= True
388 Logger
.Error("InfParser",
389 ToolError
.FORMAT_INVALID
,
390 ST
.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID
% (FileName
),
391 File
=CurrentLineOfItem
.GetFileName(),
392 Line
=CurrentLineOfItem
.GetLineNo(),
393 ExtraData
=CurrentLineOfItem
.GetLineString())
396 ItemContent
[0] = ConvPathFromAbsToRel(ItemContent
[0], GlobalData
.gINF_MODULE_DIR
)
397 InfBianryCommonItemObj
.SetFileName(FileName
)
398 if len(ItemContent
) >= 3:
400 # Add Target information
402 if BinaryFileType
!= 'FREEFORM':
403 InfBianryCommonItemObj
.SetTarget(ItemContent
[2])
405 if len(ItemContent
) >= 4:
407 # Add Family information
409 if BinaryFileType
!= 'FREEFORM':
410 InfBianryCommonItemObj
.SetFamily(ItemContent
[3])
412 InfBianryCommonItemObj
.SetTarget(ItemContent
[3])
414 if len(ItemContent
) >= 5:
416 # TagName entries are build system specific. If there
417 # is content in the entry, the tool must exit
418 # gracefully with an error message that indicates build
419 # system specific content cannot be distributed using
422 if BinaryFileType
!= 'FREEFORM':
423 if ItemContent
[4].strip() != '':
424 Logger
.Error("InfParser",
425 ToolError
.FORMAT_INVALID
,
426 ST
.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED
% (ItemContent
[4]),
427 File
=CurrentLineOfItem
.GetFileName(),
428 Line
=CurrentLineOfItem
.GetLineNo(),
429 ExtraData
=CurrentLineOfItem
.GetLineString())
431 InfBianryCommonItemObj
.SetFamily(ItemContent
[4])
433 if len(ItemContent
) >= 6:
437 if BinaryFileType
!= 'FREEFORM':
438 if ItemContent
[5].strip() == '':
439 Logger
.Error("InfParser",
440 ToolError
.FORMAT_INVALID
,
441 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING
,
442 File
=CurrentLineOfItem
.GetFileName(),
443 Line
=CurrentLineOfItem
.GetLineNo(),
444 ExtraData
=CurrentLineOfItem
.GetLineString())
446 # Validate Feature Flag Express
448 FeatureFlagRtv
= IsValidFeatureFlagExp(ItemContent
[5].strip())
449 if not FeatureFlagRtv
[0]:
450 Logger
.Error("InfParser",
451 ToolError
.FORMAT_INVALID
,
452 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID
% (FeatureFlagRtv
[1]),
453 File
=CurrentLineOfItem
.GetFileName(),
454 Line
=CurrentLineOfItem
.GetLineNo(),
455 ExtraData
=CurrentLineOfItem
.GetLineString())
456 InfBianryCommonItemObj
.SetFeatureFlagExp(ItemContent
[5])
458 if ItemContent
[5].strip() != '':
459 Logger
.Error("InfParser",
460 ToolError
.FORMAT_INVALID
,
461 ST
.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED
% (ItemContent
[5]),
462 File
=CurrentLineOfItem
.GetFileName(),
463 Line
=CurrentLineOfItem
.GetLineNo(),
464 ExtraData
=CurrentLineOfItem
.GetLineString())
466 if len(ItemContent
) == 7:
467 if ItemContent
[6].strip() == '':
468 Logger
.Error("InfParser",
469 ToolError
.FORMAT_INVALID
,
470 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING
,
471 File
=CurrentLineOfItem
.GetFileName(),
472 Line
=CurrentLineOfItem
.GetLineNo(),
473 ExtraData
=CurrentLineOfItem
.GetLineString())
475 # Validate Feature Flag Express
477 FeatureFlagRtv
= IsValidFeatureFlagExp(ItemContent
[6].strip())
478 if not FeatureFlagRtv
[0]:
479 Logger
.Error("InfParser",
480 ToolError
.FORMAT_INVALID
,
481 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID
% (FeatureFlagRtv
[1]),
482 File
=CurrentLineOfItem
.GetFileName(),
483 Line
=CurrentLineOfItem
.GetLineNo(),
484 ExtraData
=CurrentLineOfItem
.GetLineString())
485 InfBianryCommonItemObj
.SetFeatureFlagExp(ItemContent
[6])
487 InfBianryCommonItemObj
.SetSupArchList(__SupArchList
)
490 # Determine binary file name duplicate. Follow below rule:
492 # A binary filename must not be duplicated within
493 # a [Binaries] section. A binary filename may appear in
494 # multiple architectural [Binaries] sections. A binary
495 # filename listed in an architectural [Binaries] section
496 # must not be listed in the common architectural
497 # [Binaries] section.
499 # NOTE: This check will not report error now.
501 # for Item in self.Binaries:
502 # if Item.GetFileName() == InfBianryCommonItemObj.GetFileName():
503 # ItemSupArchList = Item.GetSupArchList()
504 # for ItemArch in ItemSupArchList:
505 # for ComItemObjArch in __SupArchList:
506 # if ItemArch == ComItemObjArch:
508 # # ST.ERR_INF_PARSER_ITEM_DUPLICATE
512 # if ItemArch.upper() == 'COMMON' or ComItemObjArch.upper() == 'COMMON':
514 # # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
518 if InfBianryCommonItemObj
is not None:
519 if (InfBianryCommonItemObj
) in self
.Binaries
:
520 BinariesList
= self
.Binaries
[InfBianryCommonItemObj
]
521 BinariesList
.append((InfBianryCommonItemObj
, ItemComment
))
522 self
.Binaries
[InfBianryCommonItemObj
] = BinariesList
525 BinariesList
.append((InfBianryCommonItemObj
, ItemComment
))
526 self
.Binaries
[InfBianryCommonItemObj
] = BinariesList
528 def SetBinary(self
, UiInf
=None, Ver
=None, CommonBinary
=None, ArchList
=None):
531 for ArchItem
in ArchList
:
535 if (ArchItem
== '' or ArchItem
is None):
537 __SupArchList
.append(ArchItem
)
539 if UiInf
is not None:
545 IsValidFileFlag
= False
546 InfBianryUiItemObj
= None
547 UiContent
= UiItem
[0]
548 UiComment
= UiItem
[1]
549 UiCurrentLine
= UiItem
[2]
550 GlobalData
.gINF_CURRENT_LINE
= deepcopy(UiItem
[2])
552 # Should not less than 2 elements
554 if len(UiContent
) < 2:
555 Logger
.Error("InfParser",
556 ToolError
.FORMAT_INVALID
,
557 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID
% (UiContent
[0], 2),
558 File
=UiCurrentLine
.GetFileName(),
559 Line
=UiCurrentLine
.GetLineNo(),
560 ExtraData
=UiCurrentLine
.GetLineString())
563 if len(UiContent
) > 4:
564 Logger
.Error("InfParser",
565 ToolError
.FORMAT_INVALID
,
566 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX
% (UiContent
[0], 4),
567 File
=UiCurrentLine
.GetFileName(),
568 Line
=UiCurrentLine
.GetLineNo(),
569 ExtraData
=UiCurrentLine
.GetLineString())
571 if len(UiContent
) >= 2:
573 # Create an Ui Object.
575 InfBianryUiItemObj
= InfBianryUiItem()
576 if UiContent
[0] != 'UI':
577 Logger
.Error("InfParser",
578 ToolError
.FORMAT_INVALID
,
579 ST
.ERR_INF_PARSER_BINARY_VER_TYPE
% ('UI'),
580 File
=UiCurrentLine
.GetFileName(),
581 Line
=UiCurrentLine
.GetLineNo(),
582 ExtraData
=UiCurrentLine
.GetLineString())
583 InfBianryUiItemObj
.SetUiTypeName(UiContent
[0])
584 InfBianryUiItemObj
.SetType(UiContent
[0])
586 # Verify File exist or not
588 FullFileName
= os
.path
.normpath(os
.path
.realpath(os
.path
.join(GlobalData
.gINF_MODULE_DIR
,
590 if not (ValidFile(FullFileName
) or ValidFile(UiContent
[1])):
591 Logger
.Error("InfParser",
592 ToolError
.FORMAT_INVALID
,
593 ST
.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST
% (UiContent
[1]),
594 File
=UiCurrentLine
.GetFileName(),
595 Line
=UiCurrentLine
.GetLineNo(),
596 ExtraData
=UiCurrentLine
.GetLineString())
598 # Validate file exist/format.
600 if IsValidPath(UiContent
[1], GlobalData
.gINF_MODULE_DIR
):
601 IsValidFileFlag
= True
603 Logger
.Error("InfParser",
604 ToolError
.FORMAT_INVALID
,
605 ST
.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID
% (UiContent
[1]),
606 File
=UiCurrentLine
.GetFileName(),
607 Line
=UiCurrentLine
.GetLineNo(),
608 ExtraData
=UiCurrentLine
.GetLineString())
611 UiContent
[0] = ConvPathFromAbsToRel(UiContent
[0], GlobalData
.gINF_MODULE_DIR
)
612 InfBianryUiItemObj
.SetFileName(UiContent
[1])
613 if len(UiContent
) >= 3:
615 # Add Target information
617 InfBianryUiItemObj
.SetTarget(UiContent
[2])
618 if len(UiContent
) == 4:
619 if UiContent
[3].strip() == '':
620 Logger
.Error("InfParser",
621 ToolError
.FORMAT_INVALID
,
622 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING
,
623 File
=UiCurrentLine
.GetFileName(),
624 Line
=UiCurrentLine
.GetLineNo(),
625 ExtraData
=UiCurrentLine
.GetLineString())
627 # Validate Feature Flag Express
629 FeatureFlagRtv
= IsValidFeatureFlagExp(UiContent
[3].strip())
630 if not FeatureFlagRtv
[0]:
631 Logger
.Error("InfParser",
632 ToolError
.FORMAT_INVALID
,
633 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID
% (FeatureFlagRtv
[1]),
634 File
=UiCurrentLine
.GetFileName(),
635 Line
=UiCurrentLine
.GetLineNo(),
636 ExtraData
=UiCurrentLine
.GetLineString())
637 InfBianryUiItemObj
.SetFeatureFlagExp(UiContent
[3])
639 InfBianryUiItemObj
.SetSupArchList(__SupArchList
)
642 # Determine binary file name duplicate. Follow below rule:
644 # A binary filename must not be duplicated within
645 # a [Binaries] section. A binary filename may appear in
646 # multiple architectural [Binaries] sections. A binary
647 # filename listed in an architectural [Binaries] section
648 # must not be listed in the common architectural
649 # [Binaries] section.
651 # NOTE: This check will not report error now.
653 # for Item in self.Binaries:
654 # if Item.GetFileName() == InfBianryUiItemObj.GetFileName():
655 # ItemSupArchList = Item.GetSupArchList()
656 # for ItemArch in ItemSupArchList:
657 # for UiItemObjArch in __SupArchList:
658 # if ItemArch == UiItemObjArch:
660 # # ST.ERR_INF_PARSER_ITEM_DUPLICATE
663 # if ItemArch.upper() == 'COMMON' or UiItemObjArch.upper() == 'COMMON':
665 # # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
669 if InfBianryUiItemObj
is not None:
670 if (InfBianryUiItemObj
) in self
.Binaries
:
671 BinariesList
= self
.Binaries
[InfBianryUiItemObj
]
672 BinariesList
.append((InfBianryUiItemObj
, UiComment
))
673 self
.Binaries
[InfBianryUiItemObj
] = BinariesList
676 BinariesList
.append((InfBianryUiItemObj
, UiComment
))
677 self
.Binaries
[InfBianryUiItemObj
] = BinariesList
678 if Ver
is not None and len(Ver
) > 0:
679 self
.CheckVer(Ver
, __SupArchList
)
680 if CommonBinary
and len(CommonBinary
) > 0:
681 self
.ParseCommonBinary(CommonBinary
, __SupArchList
)