1. Add -m and -s to support only scanning meta-data files or source code files
[people/mcb30/basetools.git] / Source / Python / Common / DecClassObject.py
index d93a3db..b95ff62 100644 (file)
@@ -206,7 +206,7 @@ class Dec(DecObject):
                         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
+                            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, RaiseError = EdkLogger.IsRaiseError)\r
                     if CurrentSection.upper() not in self.KeyList:\r
                         RaiseParserError(Line, CurrentSection, Filename, '', LineNo)\r
                     ItemList.append('')\r
@@ -215,7 +215,7 @@ class Dec(DecObject):
                         RaiseParserError(Line, CurrentSection, Filename, '', LineNo)\r
                     else:\r
                         if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:\r
-                            EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo)\r
+                            EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)\r
                         ArchList.append(ItemList[1].upper())\r
                         ThirdList.append(ItemList[2])\r
 \r
@@ -226,7 +226,7 @@ class Dec(DecObject):
             #\r
             if CurrentSection == TAB_UNKNOWN:\r
                 ErrorMsg = "%s is not in any defined section" % Line\r
-                EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo)\r
+                EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)\r
 \r
             #\r
             # Add a section item\r
@@ -451,6 +451,7 @@ class Dec(DecObject):
     def GenPcds(self, ContainerFile):\r
         EdkLogger.debug(2, "Generate %s ..." % TAB_PCDS)\r
         Pcds = {}\r
+        PcdToken = {}\r
         #\r
         # Get all Guids\r
         #\r
@@ -466,19 +467,36 @@ class Dec(DecObject):
         for Arch in self.SupArchList:\r
             for Record in RecordSet1:\r
                 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:\r
-                    MergeArches(Pcds, GetPcdOfDec(Record[0], TAB_PCDS_FIXED_AT_BUILD, ContainerFile, Record[2]), Arch)\r
+                    (TokenGuidCName, TokenName, Value, DatumType, Token, Type) = GetPcdOfDec(Record[0], TAB_PCDS_FIXED_AT_BUILD, ContainerFile, Record[2])\r
+                    MergeArches(Pcds, (TokenGuidCName, TokenName, Value, DatumType, Token, Type), Arch)\r
+                    PcdToken[Record[3]] = (TokenGuidCName, TokenName)\r
             for Record in RecordSet2:\r
                 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:\r
-                    MergeArches(Pcds, GetPcdOfDec(Record[0], TAB_PCDS_PATCHABLE_IN_MODULE, ContainerFile, Record[2]), Arch)\r
+                    (TokenGuidCName, TokenName, Value, DatumType, Token, Type) = GetPcdOfDec(Record[0], TAB_PCDS_PATCHABLE_IN_MODULE, ContainerFile, Record[2])\r
+                    MergeArches(Pcds, (TokenGuidCName, TokenName, Value, DatumType, Token, Type), Arch)\r
+                    PcdToken[Record[3]] = (TokenGuidCName, TokenName)\r
             for Record in RecordSet3:\r
                 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:\r
-                    MergeArches(Pcds, GetPcdOfDec(Record[0], TAB_PCDS_FEATURE_FLAG, ContainerFile, Record[2]), Arch)\r
+                    (TokenGuidCName, TokenName, Value, DatumType, Token, Type) = GetPcdOfDec(Record[0], TAB_PCDS_FEATURE_FLAG, ContainerFile, Record[2])\r
+                    MergeArches(Pcds, (TokenGuidCName, TokenName, Value, DatumType, Token, Type), Arch)\r
+                    PcdToken[Record[3]] = (TokenGuidCName, TokenName)\r
             for Record in RecordSet4:\r
                 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:\r
-                    MergeArches(Pcds, GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC_EX, ContainerFile, Record[2]), Arch)\r
+                    (TokenGuidCName, TokenName, Value, DatumType, Token, Type) = GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC_EX, ContainerFile, Record[2])\r
+                    MergeArches(Pcds, (TokenGuidCName, TokenName, Value, DatumType, Token, Type), Arch)\r
+                    PcdToken[Record[3]] = (TokenGuidCName, TokenName)\r
             for Record in RecordSet5:\r
                 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:\r
-                    MergeArches(Pcds, GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC, ContainerFile, Record[2]), Arch)                    \r
+                    (TokenGuidCName, TokenName, Value, DatumType, Token, Type) = GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC, ContainerFile, Record[2])\r
+                    MergeArches(Pcds, (TokenGuidCName, TokenName, Value, DatumType, Token, Type), Arch)\r
+                    PcdToken[Record[3]] = (TokenGuidCName, TokenName)\r
+        #\r
+        # Update to database\r
+        #\r
+        if self.IsToDatabase:\r
+            for Key in PcdToken.keys():\r
+                SqlCommand = """update %s set Value2 = '%s' where ID = %s""" % (self.TblDec.Table, ".".join((PcdToken[Key][0], PcdToken[Key][1])), Key)\r
+                self.TblDec.Exec(SqlCommand)\r
 \r
         for Key in Pcds.keys():\r
             Pcd = PcdClass()\r