]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Workspace/MetaFileParser.py
BaseTools: support private package definition
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / MetaFileParser.py
index 209f47c9ebda7f3792d867ac7f988de76e5b2f06..82d874f8ddf99264fe5129a56debc14f282bf2af 100644 (file)
@@ -1722,6 +1722,7 @@ class DecParser(MetaFileParser):
         self._SectionName = ''\r
         self._SectionType = []\r
         ArchList = set()\r
+        PrivateList = set()\r
         Line = self._CurrentLine.replace("%s%s" % (TAB_COMMA_SPLIT, TAB_SPACE_SPLIT), TAB_COMMA_SPLIT)\r
         for Item in Line[1:-1].split(TAB_COMMA_SPLIT):\r
             if Item == '':\r
@@ -1757,8 +1758,14 @@ class DecParser(MetaFileParser):
             # S2 may be Platform or ModuleType\r
             if len(ItemList) > 2:\r
                 S2 = ItemList[2].upper()\r
+                # only Includes, GUIDs, PPIs, Protocols section have Private tag\r
+                if self._SectionName in [TAB_INCLUDES.upper(), TAB_GUIDS.upper(), TAB_PROTOCOLS.upper(), TAB_PPIS.upper()]:\r
+                    if S2 != 'PRIVATE':\r
+                        EdkLogger.error("Parser", FORMAT_INVALID, 'Please use keyword "Private" as section tag modifier.',\r
+                                        File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)\r
             else:\r
                 S2 = 'COMMON'\r
+            PrivateList.add(S2)\r
             if [S1, S2, self.DataType[self._SectionName]] not in self._Scope:\r
                 self._Scope.append([S1, S2, self.DataType[self._SectionName]])\r
 \r
@@ -1767,6 +1774,11 @@ class DecParser(MetaFileParser):
             EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",\r
                             File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)\r
 \r
+        # It is not permissible to mix section tags without the Private attribute with section tags with the Private attribute\r
+        if 'COMMON' in PrivateList and len(PrivateList) > 1:\r
+            EdkLogger.error('Parser', FORMAT_INVALID, "Can't mix section tags without the Private attribute with section tags with the Private attribute",\r
+                            File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)\r
+\r
     ## [guids], [ppis] and [protocols] section parser\r
     @ParseMacro\r
     def _GuidParser(self):\r