1. Fix trackers 200741, 200898, 200917, 200925, 200945, 200947, 200949
authorhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 29 Feb 2008 05:56:20 +0000 (05:56 +0000)
committerhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 29 Feb 2008 05:56:20 +0000 (05:56 +0000)
2. Ignore the situation for section like [--any words] which is used in R8

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1037 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/AutoGen/UniClassObject.py
Source/Python/Common/DecClassObject.py
Source/Python/Common/DscClassObject.py
Source/Python/Common/EdkIIWorkspaceBuild.py
Source/Python/Common/InfClassObject.py
Source/Python/Common/String.py

index e2bf76a..70deda4 100644 (file)
@@ -17,6 +17,7 @@
 import os, codecs, re\r
 import Common.EdkLogger as EdkLogger\r
 from Common.BuildToolError import *\r
+from Common.String import GetLineNo\r
 \r
 ##\r
 # Static definitions\r
@@ -134,11 +135,13 @@ class UniFileClassObject(object):
     #\r
     # Get Language definition\r
     #\r
-    def GetLangDef(self, Line):\r
+    def GetLangDef(self, File, Line):\r
         Lang = Line.split()\r
         if len(Lang) != 3:\r
+            FileIn = codecs.open(File, mode='rb', encoding='utf-16').read()\r
+            LineNo = GetLineNo(FileIn, Line, False)\r
             EdkLogger.error("Unicode File Parser", PARSER_ERROR, "Wrong language definition",\r
-                            ExtraData="""%s\n\t*Correct format is '#langdef eng "English"'""" % Line)\r
+                            ExtraData="""%s\n\t*Correct format is like '#langdef eng "English"'""" % Line, File = File, Line = LineNo)\r
         else:\r
             LangName = ConvertISO639ToRFC3066(Lang[1])\r
             LangPrintName = Lang[2][1:-1]\r
@@ -258,7 +261,7 @@ class UniFileClassObject(object):
             # Get Language def information\r
             #\r
             if Line.find(u'#langdef ') >= 0:\r
-                self.GetLangDef(Line)\r
+                self.GetLangDef(File, Line)\r
                 continue\r
 \r
             Name = ''\r
index 27e0d67..b0e71ad 100644 (file)
@@ -193,10 +193,15 @@ class Dec(DecObject):
                 ArchList = []\r
                 ThirdList = []\r
                 \r
+                CurrentSection = ''\r
                 LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)\r
                 for Item in LineList:\r
                     ItemList = GetSplitValueList(Item, TAB_SPLIT)\r
-                    CurrentSection = ItemList[0]\r
+                    if CurrentSection == '':\r
+                        CurrentSection = ItemList[0]\r
+                    else:\r
+                        if CurrentSection != ItemList[0]:\r
+                            EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo)\r
                     if CurrentSection.upper() not in self.KeyList:\r
                         RaiseParserError(Line, CurrentSection, Filename, '', LineNo)\r
                     ItemList.append('')\r
index 7c825ab..71c2c34 100755 (executable)
@@ -1035,10 +1035,15 @@ class Dsc(DscObject):
                 ArchList = []\r
                 ThirdList = []\r
                 \r
+                CurrentSection = ''\r
                 LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)\r
                 for Item in LineList:\r
                     ItemList = GetSplitValueList(Item, TAB_SPLIT)\r
-                    CurrentSection = ItemList[0]\r
+                    if CurrentSection == '':\r
+                        CurrentSection = ItemList[0]\r
+                    else:\r
+                        if CurrentSection != ItemList[0]:\r
+                            EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo)\r
                     if CurrentSection.upper() not in self.KeyList:\r
                         RaiseParserError(Line, CurrentSection, Filename, '', LineNo)\r
                     ItemList.append('')\r
index 0e9c105..898e34f 100755 (executable)
@@ -546,6 +546,8 @@ class WorkspaceBuild(object):
                 #\r
                 Pb.DescFilePath = Dsc\r
                 Pb.PlatformName = Platform.Header[Arch].Name\r
+                if Pb.PlatformName == '':\r
+                    EdkLogger.error("AutoGen", PARSER_ERROR, "The BaseName of platform %s is not defined for arch %s" % (Dsc, Arch))\r
                 Pb.Guid = Platform.Header[Arch].Guid\r
                 Pb.Version = Platform.Header[Arch].Version\r
                 Pb.DscSpecification = Platform.Header[Arch].DscSpecification\r
@@ -650,6 +652,9 @@ class WorkspaceBuild(object):
                 #\r
                 Pb.DescFilePath = Dec\r
                 Pb.PackageName = Package.Header[Arch].Name\r
+                if Pb.PackageName == '':\r
+                    EdkLogger.error("AutoGen", PARSER_ERROR, "The BaseName of package %s is not defined for arch %s" % (Dec, Arch))\r
+\r
                 Pb.Guid = Package.Header[Arch].Guid\r
                 Pb.Version = Package.Header[Arch].Version\r
 \r
@@ -729,6 +734,8 @@ class WorkspaceBuild(object):
                 #\r
                 Pb.DescFilePath = Inf\r
                 Pb.BaseName = ModuleHeader.Name\r
+                if Pb.BaseName == '':\r
+                    EdkLogger.error("AutoGen", PARSER_ERROR, "The BaseName of module %s is not defined for arch %s" % (Inf, Arch))                \r
                 Pb.Guid = ModuleHeader.Guid\r
                 Pb.Version = ModuleHeader.Version\r
                 Pb.ModuleType = ModuleHeader.ModuleType\r
@@ -1455,20 +1462,7 @@ class WorkspaceBuild(object):
                     break\r
 \r
         if not IsFoundInDec:\r
-            if NewType != '':\r
-                SupportedPcdTypeList = []\r
-                OwnerPackage = ''\r
-                for Dec in self.Build[Arch].PackageDatabase.keys():\r
-                    Pcds = self.Build[Arch].PackageDatabase[Dec].Pcds\r
-                    for PcdType in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:\r
-                        if (Name, Guid, PcdType) in Pcds:\r
-                            SupportedPcdTypeList.append(PcdType)\r
-                            OwnerPackage = Dec\r
-                ErrorMsg = "Only [%s] is supported for Pcd '%s.%s' in package\n\t%s\n\n"\\r
-                           "    But [%s] is specified in platform\n\t%s"\\r
-                           % (", ".join(SupportedPcdTypeList), Guid, Name, OwnerPackage, NewType, OwnerPlatform)\r
-            else:\r
-                ErrorMsg = "Pcd '%s.%s [%s]' defined in module '%s' is not found in any package" % (Guid, Name, NewType, ModuleName)\r
+            ErrorMsg = "Pcd '%s.%s [%s]' defined in module '%s' is not found in any package for Arch '%s'" % (Guid, Name, NewType, ModuleName, Arch)\r
             EdkLogger.error("AutoGen", PARSER_ERROR, ErrorMsg)\r
 \r
         #\r
index 902d00b..c32f277 100755 (executable)
@@ -356,6 +356,8 @@ class Inf(InfObject):
             # And then parse the content of the new section\r
             #\r
             if Line.startswith(TAB_SECTION_START) and Line.endswith(TAB_SECTION_END):\r
+                if Line[1:3] == "--":\r
+                    continue\r
                 Model = Section[CurrentSection.upper()]\r
                 #\r
                 # Insert items data of previous section\r
@@ -368,10 +370,15 @@ class Inf(InfObject):
                 ArchList = []\r
                 ThirdList = []\r
                 \r
+                CurrentSection = ''\r
                 LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)\r
                 for Item in LineList:\r
                     ItemList = GetSplitValueList(Item, TAB_SPLIT)\r
-                    CurrentSection = ItemList[0]\r
+                    if CurrentSection == '':\r
+                        CurrentSection = ItemList[0]\r
+                    else:\r
+                        if CurrentSection != ItemList[0]:\r
+                            EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo)\r
                     if CurrentSection.upper() not in self.KeyList:\r
                         RaiseParserError(Line, CurrentSection, Filename, '', LineNo)\r
                     ItemList.append('')\r
@@ -926,7 +933,8 @@ class Inf(InfObject):
             for Record in RecordSet:\r
                 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:\r
                     Line = Line + Record[0] + ' '\r
-            MergeArches(Depex, Line, Arch)\r
+            if Line != '':\r
+                MergeArches(Depex, Line, Arch)\r
 \r
         for Key in Depex.keys():\r
             Dep = ModuleDepexClass()\r
index 4a95ff7..a04ae01 100644 (file)
@@ -493,15 +493,16 @@ def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName,
 # @retval int  Index of the line\r
 # @retval -1     The line is not found\r
 #\r
-def GetLineNo(FileContent, Line):\r
+def GetLineNo(FileContent, Line, IsIgnoreComment = True):\r
     LineList = FileContent.splitlines()\r
     for Index in range(len(LineList)):\r
         if LineList[Index].find(Line) > -1:\r
             #\r
             # Ignore statement in comment\r
             #\r
-            if LineList[Index].strip()[0] == DataType.TAB_COMMENT_SPLIT:\r
-                continue\r
+            if IsIgnoreComment:\r
+                if LineList[Index].strip()[0] == DataType.TAB_COMMENT_SPLIT:\r
+                    continue\r
             return Index + 1\r
 \r
     return -1\r