2 # This file is used to define class objects of INF file [Binaries] section.
3 # It will consumed by InfParser.
5 # Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
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
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.
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
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
37 class InfBianryItem():
41 self
.FeatureFlagExp
= ''
46 def SetFileName(self
, FileName
):
47 self
.FileName
= FileName
48 def GetFileName(self
):
51 def SetTarget(self
, Target
):
56 def SetFeatureFlagExp(self
, FeatureFlagExp
):
57 self
.FeatureFlagExp
= FeatureFlagExp
58 def GetFeatureFlagExp(self
):
59 return self
.FeatureFlagExp
61 def SetHelpString(self
, HelpString
):
62 self
.HelpString
= HelpString
63 def GetHelpString(self
):
64 return self
.HelpString
66 def SetType(self
, Type
):
70 def SetSupArchList(self
, SupArchList
):
71 self
.SupArchList
= SupArchList
72 def GetSupArchList(self
):
73 return self
.SupArchList
75 class InfBianryVerItem(InfBianryItem
, CurrentLine
):
77 InfBianryItem
.__init
__(self
)
78 CurrentLine
.__init
__(self
)
81 def SetVerTypeName(self
, VerTypeName
):
82 self
.VerTypeName
= VerTypeName
83 def GetVerTypeName(self
):
84 return self
.VerTypeName
86 class InfBianryUiItem(InfBianryItem
, CurrentLine
):
88 InfBianryItem
.__init
__(self
)
89 CurrentLine
.__init
__(self
)
92 def SetUiTypeName(self
, UiTypeName
):
93 self
.UiTypeName
= UiTypeName
94 def GetVerTypeName(self
):
95 return self
.UiTypeName
97 class InfBianryCommonItem(InfBianryItem
, CurrentLine
):
103 InfBianryItem
.__init
__(self
)
104 CurrentLine
.__init
__(self
)
106 def SetCommonType(self
, CommonType
):
107 self
.CommonType
= CommonType
108 def GetCommonType(self
):
109 return self
.CommonType
111 def SetTagName(self
, TagName
):
112 self
.TagName
= TagName
113 def GetTagName(self
):
116 def SetFamily(self
, Family
):
121 def SetGuidValue(self
, GuidValue
):
122 self
.GuidValue
= GuidValue
123 def GetGuidValue(self
):
124 return self
.GuidValue
130 class InfBinariesObject(InfSectionCommonDef
):
132 self
.Binaries
= Sdict()
134 # Macro defined in this section should be only used in this section.
137 InfSectionCommonDef
.__init
__(self
)
142 def CheckVer(self
, Ver
, __SupArchList
):
147 IsValidFileFlag
= False
148 VerContent
= VerItem
[0]
149 VerComment
= VerItem
[1]
150 VerCurrentLine
= VerItem
[2]
151 GlobalData
.gINF_CURRENT_LINE
= VerCurrentLine
152 InfBianryVerItemObj
= None
154 # Should not less than 2 elements
156 if len(VerContent
) < 2:
157 Logger
.Error("InfParser",
158 ToolError
.FORMAT_INVALID
,
159 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID
% (VerContent
[0], 2),
160 File
=VerCurrentLine
.GetFileName(),
161 Line
=VerCurrentLine
.GetLineNo(),
162 ExtraData
=VerCurrentLine
.GetLineString())
164 if len(VerContent
) > 4:
165 Logger
.Error("InfParser",
166 ToolError
.FORMAT_INVALID
,
167 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX
% (VerContent
[0], 4),
168 File
=VerCurrentLine
.GetFileName(),
169 Line
=VerCurrentLine
.GetLineNo(),
170 ExtraData
=VerCurrentLine
.GetLineString())
172 if len(VerContent
) >= 2:
174 # Create a Ver Object.
176 InfBianryVerItemObj
= InfBianryVerItem()
178 if VerContent
[0] != DT
.BINARY_FILE_TYPE_VER
:
179 Logger
.Error("InfParser",
180 ToolError
.FORMAT_INVALID
,
181 ST
.ERR_INF_PARSER_BINARY_VER_TYPE
% DT
.BINARY_FILE_TYPE_VER
,
182 File
=VerCurrentLine
.GetFileName(),
183 Line
=VerCurrentLine
.GetLineNo(),
184 ExtraData
=VerCurrentLine
.GetLineString())
186 InfBianryVerItemObj
.SetVerTypeName(VerContent
[0])
187 InfBianryVerItemObj
.SetType(VerContent
[0])
189 # Verify File exist or not
191 FullFileName
= os
.path
.normpath(os
.path
.realpath(os
.path
.join(GlobalData
.gINF_MODULE_DIR
,
193 if not (ValidFile(FullFileName
) or ValidFile(VerContent
[1])):
194 Logger
.Error("InfParser",
195 ToolError
.FORMAT_INVALID
,
196 ST
.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST
% (VerContent
[1]),
197 File
=VerCurrentLine
.GetFileName(),
198 Line
=VerCurrentLine
.GetLineNo(),
199 ExtraData
=VerCurrentLine
.GetLineString())
201 # Validate file exist/format.
203 if IsValidPath(VerContent
[1], GlobalData
.gINF_MODULE_DIR
):
204 IsValidFileFlag
= True
206 Logger
.Error("InfParser",
207 ToolError
.FORMAT_INVALID
,
208 ST
.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID
% (VerContent
[1]),
209 File
=VerCurrentLine
.GetFileName(),
210 Line
=VerCurrentLine
.GetLineNo(),
211 ExtraData
=VerCurrentLine
.GetLineString())
214 VerContent
[0] = ConvPathFromAbsToRel(VerContent
[0],
215 GlobalData
.gINF_MODULE_DIR
)
216 InfBianryVerItemObj
.SetFileName(VerContent
[1])
217 if len(VerContent
) >= 3:
219 # Add Target information
221 InfBianryVerItemObj
.SetTarget(VerContent
[2])
222 if len(VerContent
) == 4:
223 if VerContent
[3].strip() == '':
224 Logger
.Error("InfParser",
225 ToolError
.FORMAT_INVALID
,
226 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING
,
227 File
=VerCurrentLine
.GetFileName(),
228 Line
=VerCurrentLine
.GetLineNo(),
229 ExtraData
=VerCurrentLine
.GetLineString())
231 # Validate Feature Flag Express
233 FeatureFlagRtv
= IsValidFeatureFlagExp(VerContent
[3].\
235 if not FeatureFlagRtv
[0]:
236 Logger
.Error("InfParser",
237 ToolError
.FORMAT_INVALID
,
238 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID
% (FeatureFlagRtv
[1]),
239 File
=VerCurrentLine
.GetFileName(),
240 Line
=VerCurrentLine
.GetLineNo(),
241 ExtraData
=VerCurrentLine
.GetLineString())
242 InfBianryVerItemObj
.SetFeatureFlagExp(VerContent
[3])
244 InfBianryVerItemObj
.SetSupArchList(__SupArchList
)
247 # Determine binary file name duplicate. Follow below rule:
249 # A binary filename must not be duplicated within
250 # a [Binaries] section. A binary filename may appear in
251 # multiple architectural [Binaries] sections. A binary
252 # filename listed in an architectural [Binaries] section
253 # must not be listed in the common architectural
254 # [Binaries] section.
256 # NOTE: This check will not report error now.
258 for Item
in self
.Binaries
:
259 if Item
.GetFileName() == InfBianryVerItemObj
.GetFileName():
260 ItemSupArchList
= Item
.GetSupArchList()
261 for ItemArch
in ItemSupArchList
:
262 for VerItemObjArch
in __SupArchList
:
263 if ItemArch
== VerItemObjArch
:
265 # ST.ERR_INF_PARSER_ITEM_DUPLICATE
268 if ItemArch
.upper() == 'COMMON' or VerItemObjArch
.upper() == 'COMMON':
270 # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
274 if InfBianryVerItemObj
is not None:
275 if self
.Binaries
.has_key((InfBianryVerItemObj
)):
276 BinariesList
= self
.Binaries
[InfBianryVerItemObj
]
277 BinariesList
.append((InfBianryVerItemObj
, VerComment
))
278 self
.Binaries
[InfBianryVerItemObj
] = BinariesList
281 BinariesList
.append((InfBianryVerItemObj
, VerComment
))
282 self
.Binaries
[InfBianryVerItemObj
] = BinariesList
288 def ParseCommonBinary(self
, CommonBinary
, __SupArchList
):
290 # Check common binary definitions
291 # Type | FileName | Target | Family | TagName | FeatureFlagExp
293 for Item
in CommonBinary
:
294 IsValidFileFlag
= False
295 ItemContent
= Item
[0]
296 ItemComment
= Item
[1]
297 CurrentLineOfItem
= Item
[2]
298 GlobalData
.gINF_CURRENT_LINE
= CurrentLineOfItem
299 InfBianryCommonItemObj
= None
300 if ItemContent
[0] == 'SUBTYPE_GUID':
301 if len(ItemContent
) < 3:
302 Logger
.Error("InfParser",
303 ToolError
.FORMAT_INVALID
,
304 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID
% (ItemContent
[0], 3),
305 File
=CurrentLineOfItem
.GetFileName(),
306 Line
=CurrentLineOfItem
.GetLineNo(),
307 ExtraData
=CurrentLineOfItem
.GetLineString())
310 if len(ItemContent
) < 2:
311 Logger
.Error("InfParser",
312 ToolError
.FORMAT_INVALID
,
313 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID
% (ItemContent
[0], 2),
314 File
=CurrentLineOfItem
.GetFileName(),
315 Line
=CurrentLineOfItem
.GetLineNo(),
316 ExtraData
=CurrentLineOfItem
.GetLineString())
319 if len(ItemContent
) > 7:
320 Logger
.Error("InfParser",
321 ToolError
.FORMAT_INVALID
,
322 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX
% (ItemContent
[0], 7),
323 File
=CurrentLineOfItem
.GetFileName(),
324 Line
=CurrentLineOfItem
.GetLineNo(),
325 ExtraData
=CurrentLineOfItem
.GetLineString())
327 if len(ItemContent
) >= 2:
329 # Create a Common Object.
331 InfBianryCommonItemObj
= InfBianryCommonItem()
333 # Convert Binary type.
335 BinaryFileType
= ItemContent
[0].strip()
336 if BinaryFileType
== 'RAW' or BinaryFileType
== 'ACPI' or BinaryFileType
== 'ASL':
337 BinaryFileType
= 'BIN'
339 if BinaryFileType
not in DT
.BINARY_FILE_TYPE_LIST
:
340 Logger
.Error("InfParser",
341 ToolError
.FORMAT_INVALID
,
342 ST
.ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE
% \
343 (DT
.BINARY_FILE_TYPE_LIST
.__str
__()),
344 File
=CurrentLineOfItem
.GetFileName(),
345 Line
=CurrentLineOfItem
.GetLineNo(),
346 ExtraData
=CurrentLineOfItem
.GetLineString())
348 if BinaryFileType
== 'SUBTYPE_GUID':
349 BinaryFileType
= 'FREEFORM'
351 if BinaryFileType
== 'LIB' or BinaryFileType
== 'UEFI_APP':
352 Logger
.Error("InfParser",
353 ToolError
.FORMAT_INVALID
,
354 ST
.ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE
% \
355 (DT
.BINARY_FILE_TYPE_LIST
.__str
__()),
356 File
=CurrentLineOfItem
.GetFileName(),
357 Line
=CurrentLineOfItem
.GetLineNo(),
358 ExtraData
=CurrentLineOfItem
.GetLineString())
360 InfBianryCommonItemObj
.SetType(BinaryFileType
)
361 InfBianryCommonItemObj
.SetCommonType(ItemContent
[0])
363 if BinaryFileType
== 'FREEFORM':
364 InfBianryCommonItemObj
.SetGuidValue(ItemContent
[1])
365 if len(ItemContent
) >= 3:
366 FileName
= ItemContent
[2]
368 Logger
.Error("InfParser",
369 ToolError
.FORMAT_INVALID
,
370 ST
.ERR_INF_PARSER_BINARY_ITEM_FILENAME_NOT_EXIST
,
371 File
=CurrentLineOfItem
.GetFileName(),
372 Line
=CurrentLineOfItem
.GetLineNo(),
373 ExtraData
=CurrentLineOfItem
.GetLineString())
375 FileName
= ItemContent
[1]
377 # Verify File exist or not
379 FullFileName
= os
.path
.normpath(os
.path
.realpath(os
.path
.join(GlobalData
.gINF_MODULE_DIR
,
381 if not (ValidFile(FullFileName
) or ValidFile(FileName
)):
382 Logger
.Error("InfParser",
383 ToolError
.FORMAT_INVALID
,
384 ST
.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST
% (FileName
),
385 File
=CurrentLineOfItem
.GetFileName(),
386 Line
=CurrentLineOfItem
.GetLineNo(),
387 ExtraData
=CurrentLineOfItem
.GetLineString())
389 # Validate file exist/format.
391 if IsValidPath(FileName
, GlobalData
.gINF_MODULE_DIR
):
392 IsValidFileFlag
= True
394 Logger
.Error("InfParser",
395 ToolError
.FORMAT_INVALID
,
396 ST
.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID
% (FileName
),
397 File
=CurrentLineOfItem
.GetFileName(),
398 Line
=CurrentLineOfItem
.GetLineNo(),
399 ExtraData
=CurrentLineOfItem
.GetLineString())
402 ItemContent
[0] = ConvPathFromAbsToRel(ItemContent
[0], GlobalData
.gINF_MODULE_DIR
)
403 InfBianryCommonItemObj
.SetFileName(FileName
)
404 if len(ItemContent
) >= 3:
406 # Add Target information
408 if BinaryFileType
!= 'FREEFORM':
409 InfBianryCommonItemObj
.SetTarget(ItemContent
[2])
411 if len(ItemContent
) >= 4:
413 # Add Family information
415 if BinaryFileType
!= 'FREEFORM':
416 InfBianryCommonItemObj
.SetFamily(ItemContent
[3])
418 InfBianryCommonItemObj
.SetTarget(ItemContent
[3])
420 if len(ItemContent
) >= 5:
422 # TagName entries are build system specific. If there
423 # is content in the entry, the tool must exit
424 # gracefully with an error message that indicates build
425 # system specific content cannot be distributed using
428 if BinaryFileType
!= 'FREEFORM':
429 if ItemContent
[4].strip() != '':
430 Logger
.Error("InfParser",
431 ToolError
.FORMAT_INVALID
,
432 ST
.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED
% (ItemContent
[4]),
433 File
=CurrentLineOfItem
.GetFileName(),
434 Line
=CurrentLineOfItem
.GetLineNo(),
435 ExtraData
=CurrentLineOfItem
.GetLineString())
437 InfBianryCommonItemObj
.SetFamily(ItemContent
[4])
439 if len(ItemContent
) >= 6:
443 if BinaryFileType
!= 'FREEFORM':
444 if ItemContent
[5].strip() == '':
445 Logger
.Error("InfParser",
446 ToolError
.FORMAT_INVALID
,
447 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING
,
448 File
=CurrentLineOfItem
.GetFileName(),
449 Line
=CurrentLineOfItem
.GetLineNo(),
450 ExtraData
=CurrentLineOfItem
.GetLineString())
452 # Validate Feature Flag Express
454 FeatureFlagRtv
= IsValidFeatureFlagExp(ItemContent
[5].strip())
455 if not FeatureFlagRtv
[0]:
456 Logger
.Error("InfParser",
457 ToolError
.FORMAT_INVALID
,
458 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID
% (FeatureFlagRtv
[1]),
459 File
=CurrentLineOfItem
.GetFileName(),
460 Line
=CurrentLineOfItem
.GetLineNo(),
461 ExtraData
=CurrentLineOfItem
.GetLineString())
462 InfBianryCommonItemObj
.SetFeatureFlagExp(ItemContent
[5])
464 if ItemContent
[5].strip() != '':
465 Logger
.Error("InfParser",
466 ToolError
.FORMAT_INVALID
,
467 ST
.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED
% (ItemContent
[5]),
468 File
=CurrentLineOfItem
.GetFileName(),
469 Line
=CurrentLineOfItem
.GetLineNo(),
470 ExtraData
=CurrentLineOfItem
.GetLineString())
472 if len(ItemContent
) == 7:
473 if ItemContent
[6].strip() == '':
474 Logger
.Error("InfParser",
475 ToolError
.FORMAT_INVALID
,
476 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING
,
477 File
=CurrentLineOfItem
.GetFileName(),
478 Line
=CurrentLineOfItem
.GetLineNo(),
479 ExtraData
=CurrentLineOfItem
.GetLineString())
481 # Validate Feature Flag Express
483 FeatureFlagRtv
= IsValidFeatureFlagExp(ItemContent
[6].strip())
484 if not FeatureFlagRtv
[0]:
485 Logger
.Error("InfParser",
486 ToolError
.FORMAT_INVALID
,
487 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID
% (FeatureFlagRtv
[1]),
488 File
=CurrentLineOfItem
.GetFileName(),
489 Line
=CurrentLineOfItem
.GetLineNo(),
490 ExtraData
=CurrentLineOfItem
.GetLineString())
491 InfBianryCommonItemObj
.SetFeatureFlagExp(ItemContent
[6])
493 InfBianryCommonItemObj
.SetSupArchList(__SupArchList
)
496 # Determine binary file name duplicate. Follow below rule:
498 # A binary filename must not be duplicated within
499 # a [Binaries] section. A binary filename may appear in
500 # multiple architectural [Binaries] sections. A binary
501 # filename listed in an architectural [Binaries] section
502 # must not be listed in the common architectural
503 # [Binaries] section.
505 # NOTE: This check will not report error now.
507 # for Item in self.Binaries:
508 # if Item.GetFileName() == InfBianryCommonItemObj.GetFileName():
509 # ItemSupArchList = Item.GetSupArchList()
510 # for ItemArch in ItemSupArchList:
511 # for ComItemObjArch in __SupArchList:
512 # if ItemArch == ComItemObjArch:
514 # # ST.ERR_INF_PARSER_ITEM_DUPLICATE
518 # if ItemArch.upper() == 'COMMON' or ComItemObjArch.upper() == 'COMMON':
520 # # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
524 if InfBianryCommonItemObj
is not None:
525 if self
.Binaries
.has_key((InfBianryCommonItemObj
)):
526 BinariesList
= self
.Binaries
[InfBianryCommonItemObj
]
527 BinariesList
.append((InfBianryCommonItemObj
, ItemComment
))
528 self
.Binaries
[InfBianryCommonItemObj
] = BinariesList
531 BinariesList
.append((InfBianryCommonItemObj
, ItemComment
))
532 self
.Binaries
[InfBianryCommonItemObj
] = BinariesList
534 def SetBinary(self
, UiInf
=None, Ver
=None, CommonBinary
=None, ArchList
=None):
537 for ArchItem
in ArchList
:
541 if (ArchItem
== '' or ArchItem
is None):
543 __SupArchList
.append(ArchItem
)
545 if UiInf
is not None:
551 IsValidFileFlag
= False
552 InfBianryUiItemObj
= None
553 UiContent
= UiItem
[0]
554 UiComment
= UiItem
[1]
555 UiCurrentLine
= UiItem
[2]
556 GlobalData
.gINF_CURRENT_LINE
= deepcopy(UiItem
[2])
558 # Should not less than 2 elements
560 if len(UiContent
) < 2:
561 Logger
.Error("InfParser",
562 ToolError
.FORMAT_INVALID
,
563 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID
% (UiContent
[0], 2),
564 File
=UiCurrentLine
.GetFileName(),
565 Line
=UiCurrentLine
.GetLineNo(),
566 ExtraData
=UiCurrentLine
.GetLineString())
569 if len(UiContent
) > 4:
570 Logger
.Error("InfParser",
571 ToolError
.FORMAT_INVALID
,
572 ST
.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX
% (UiContent
[0], 4),
573 File
=UiCurrentLine
.GetFileName(),
574 Line
=UiCurrentLine
.GetLineNo(),
575 ExtraData
=UiCurrentLine
.GetLineString())
577 if len(UiContent
) >= 2:
579 # Create an Ui Object.
581 InfBianryUiItemObj
= InfBianryUiItem()
582 if UiContent
[0] != 'UI':
583 Logger
.Error("InfParser",
584 ToolError
.FORMAT_INVALID
,
585 ST
.ERR_INF_PARSER_BINARY_VER_TYPE
% ('UI'),
586 File
=UiCurrentLine
.GetFileName(),
587 Line
=UiCurrentLine
.GetLineNo(),
588 ExtraData
=UiCurrentLine
.GetLineString())
589 InfBianryUiItemObj
.SetUiTypeName(UiContent
[0])
590 InfBianryUiItemObj
.SetType(UiContent
[0])
592 # Verify File exist or not
594 FullFileName
= os
.path
.normpath(os
.path
.realpath(os
.path
.join(GlobalData
.gINF_MODULE_DIR
,
596 if not (ValidFile(FullFileName
) or ValidFile(UiContent
[1])):
597 Logger
.Error("InfParser",
598 ToolError
.FORMAT_INVALID
,
599 ST
.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST
% (UiContent
[1]),
600 File
=UiCurrentLine
.GetFileName(),
601 Line
=UiCurrentLine
.GetLineNo(),
602 ExtraData
=UiCurrentLine
.GetLineString())
604 # Validate file exist/format.
606 if IsValidPath(UiContent
[1], GlobalData
.gINF_MODULE_DIR
):
607 IsValidFileFlag
= True
609 Logger
.Error("InfParser",
610 ToolError
.FORMAT_INVALID
,
611 ST
.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID
% (UiContent
[1]),
612 File
=UiCurrentLine
.GetFileName(),
613 Line
=UiCurrentLine
.GetLineNo(),
614 ExtraData
=UiCurrentLine
.GetLineString())
617 UiContent
[0] = ConvPathFromAbsToRel(UiContent
[0], GlobalData
.gINF_MODULE_DIR
)
618 InfBianryUiItemObj
.SetFileName(UiContent
[1])
619 if len(UiContent
) >= 3:
621 # Add Target information
623 InfBianryUiItemObj
.SetTarget(UiContent
[2])
624 if len(UiContent
) == 4:
625 if UiContent
[3].strip() == '':
626 Logger
.Error("InfParser",
627 ToolError
.FORMAT_INVALID
,
628 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING
,
629 File
=UiCurrentLine
.GetFileName(),
630 Line
=UiCurrentLine
.GetLineNo(),
631 ExtraData
=UiCurrentLine
.GetLineString())
633 # Validate Feature Flag Express
635 FeatureFlagRtv
= IsValidFeatureFlagExp(UiContent
[3].strip())
636 if not FeatureFlagRtv
[0]:
637 Logger
.Error("InfParser",
638 ToolError
.FORMAT_INVALID
,
639 ST
.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID
% (FeatureFlagRtv
[1]),
640 File
=UiCurrentLine
.GetFileName(),
641 Line
=UiCurrentLine
.GetLineNo(),
642 ExtraData
=UiCurrentLine
.GetLineString())
643 InfBianryUiItemObj
.SetFeatureFlagExp(UiContent
[3])
645 InfBianryUiItemObj
.SetSupArchList(__SupArchList
)
648 # Determine binary file name duplicate. Follow below rule:
650 # A binary filename must not be duplicated within
651 # a [Binaries] section. A binary filename may appear in
652 # multiple architectural [Binaries] sections. A binary
653 # filename listed in an architectural [Binaries] section
654 # must not be listed in the common architectural
655 # [Binaries] section.
657 # NOTE: This check will not report error now.
659 # for Item in self.Binaries:
660 # if Item.GetFileName() == InfBianryUiItemObj.GetFileName():
661 # ItemSupArchList = Item.GetSupArchList()
662 # for ItemArch in ItemSupArchList:
663 # for UiItemObjArch in __SupArchList:
664 # if ItemArch == UiItemObjArch:
666 # # ST.ERR_INF_PARSER_ITEM_DUPLICATE
669 # if ItemArch.upper() == 'COMMON' or UiItemObjArch.upper() == 'COMMON':
671 # # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
675 if InfBianryUiItemObj
is not None:
676 if self
.Binaries
.has_key((InfBianryUiItemObj
)):
677 BinariesList
= self
.Binaries
[InfBianryUiItemObj
]
678 BinariesList
.append((InfBianryUiItemObj
, UiComment
))
679 self
.Binaries
[InfBianryUiItemObj
] = BinariesList
682 BinariesList
.append((InfBianryUiItemObj
, UiComment
))
683 self
.Binaries
[InfBianryUiItemObj
] = BinariesList
684 if Ver
is not None and len(Ver
) > 0:
685 self
.CheckVer(Ver
, __SupArchList
)
686 if CommonBinary
and len(CommonBinary
) > 0:
687 self
.ParseCommonBinary(CommonBinary
, __SupArchList
)