|
From: <hc...@us...> - 2012-06-01 05:12:47
|
Revision: 2531
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2531&view=rev
Author: hchen30
Date: 2012-06-01 05:12:41 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
Enhance build tool to break when there is an invalid section name in DEC file.
Reviewed-by: Yurui Zeng <yur...@in...>
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2012-06-01 01:44:56 UTC (rev 2530)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2012-06-01 05:12:41 UTC (rev 2531)
@@ -1,7 +1,7 @@
## @file
# This file is used to define common static strings used by INF/DEC/DSC files
#
-# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -459,14 +459,18 @@
TAB_BUILD_RULE_VERSION = "build_rule_version"
# section name for PCDs
-TAB_PCDS_DYNAMIC_DEFAULT = "PcdsDynamicDefault"
-TAB_PCDS_DYNAMIC_VPD = "PcdsDynamicVpd"
-TAB_PCDS_DYNAMIC_HII = "PcdsDynamicHii"
-TAB_PCDS_DYNAMICEX_DEFAULT = "PcdsDynamicExDefault"
-TAB_PCDS_DYNAMICEX_VPD = "PcdsDynamicExVpd"
-TAB_PCDS_DYNAMICEX_HII = "PcdsDynamicExHii"
+PCDS_DYNAMIC_DEFAULT = "PcdsDynamicDefault"
+PCDS_DYNAMIC_VPD = "PcdsDynamicVpd"
+PCDS_DYNAMIC_HII = "PcdsDynamicHii"
+PCDS_DYNAMICEX_DEFAULT = "PcdsDynamicExDefault"
+PCDS_DYNAMICEX_VPD = "PcdsDynamicExVpd"
+PCDS_DYNAMICEX_HII = "PcdsDynamicExHii"
# Section allowed to have items after arch
SECTIONS_HAVE_ITEM_AFTER_ARCH = [TAB_LIBRARY_CLASSES.upper(), TAB_DEPEX.upper(), TAB_USER_EXTENSIONS.upper(),
- TAB_PCDS_DYNAMIC_DEFAULT.upper(), TAB_PCDS_DYNAMIC_VPD.upper(), TAB_PCDS_DYNAMIC_HII.upper(),
- TAB_PCDS_DYNAMICEX_DEFAULT.upper(), TAB_PCDS_DYNAMICEX_VPD.upper(), TAB_PCDS_DYNAMICEX_HII.upper()]
+ PCDS_DYNAMIC_DEFAULT.upper(),
+ PCDS_DYNAMIC_VPD.upper(),
+ PCDS_DYNAMIC_HII.upper(),
+ PCDS_DYNAMICEX_DEFAULT.upper(),
+ PCDS_DYNAMICEX_VPD.upper(),
+ PCDS_DYNAMICEX_HII.upper()]
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-06-01 01:44:56 UTC (rev 2530)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-06-01 05:12:41 UTC (rev 2531)
@@ -1,7 +1,7 @@
## @file
# This file is used to parse meta files
#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -288,15 +288,17 @@
self._SectionType = self.DataType[self._SectionName]
else:
self._SectionType = MODEL_UNKNOWN
- EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile,
- Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
+
+ # Check if the section name is valid
+ if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH and len(ItemList) > 2:
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
+
# S1 is always Arch
if len(ItemList) > 1:
S1 = ItemList[1].upper()
- if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH and len(ItemList) > 2:
- EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
- self.MetaFile, self._LineIndex + 1, self._CurrentLine)
-
else:
S1 = 'COMMON'
ArchList.add(S1)
@@ -1637,7 +1639,9 @@
ArchList = set()
for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT):
if Item == '':
- continue
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR,
+ "section name can NOT be empty or incorrectly use separator comma",
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
ItemList = GetSplitValueList(Item, TAB_SPLIT)
# different types of PCD are permissible in one section
@@ -1646,9 +1650,8 @@
if self.DataType[self._SectionName] not in self._SectionType:
self._SectionType.append(self.DataType[self._SectionName])
else:
- EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile,
- Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
- continue
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
if MODEL_PCD_FEATURE_FLAG in self._SectionType and len(self._SectionType) > 1:
EdkLogger.error(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|