]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fixed BuildOptions bug.
authorYingke Liu <yingke.d.liu@intel.com>
Thu, 2 Jul 2015 03:42:34 +0000 (03:42 +0000)
committeryingke <yingke@Edk2>
Thu, 2 Jul 2015 03:42:34 +0000 (03:42 +0000)
The BuildOptions in an INF should also follow override rule: If '==' is used, all previous options are overridden.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17796 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/Workspace/WorkspaceDatabase.py

index 7fb1a8889aa659e88effb5f80dbe6470157dfc5b..259abc519b00258600b28db1a38f8eb4a2478ab6 100644 (file)
@@ -2000,7 +2000,6 @@ class PlatformAutoGen(AutoGen):
                                             if Options.get((self.BuildRuleFamily, NowKey)) != None: \r
                                                 Options.pop((self.BuildRuleFamily, NowKey))\r
                                                            \r
                                             if Options.get((self.BuildRuleFamily, NowKey)) != None: \r
                                                 Options.pop((self.BuildRuleFamily, NowKey))\r
                                                            \r
-        OverrideOpt = set()\r
         for Key in Options:\r
             if ModuleStyle != None and len (Key) > 2:\r
                 # Check Module style is EDK or EDKII.\r
         for Key in Options:\r
             if ModuleStyle != None and len (Key) > 2:\r
                 # Check Module style is EDK or EDKII.\r
@@ -2026,9 +2025,7 @@ class PlatformAutoGen(AutoGen):
                     if Arch == "*" or Arch == self.Arch:\r
                         if Tool not in BuildOptions:\r
                             BuildOptions[Tool] = {}\r
                     if Arch == "*" or Arch == self.Arch:\r
                         if Tool not in BuildOptions:\r
                             BuildOptions[Tool] = {}\r
-                        if Options[Key].startswith('='):\r
-                            OverrideOpt.add((Tool, Attr))\r
-                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or (Tool, Attr) in OverrideOpt:\r
+                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):\r
                             BuildOptions[Tool][Attr] = Options[Key]\r
                         else:\r
                             # append options for the same tool\r
                             BuildOptions[Tool][Attr] = Options[Key]\r
                         else:\r
                             # append options for the same tool\r
@@ -2037,7 +2034,6 @@ class PlatformAutoGen(AutoGen):
         if FamilyMatch or FamilyIsNull:\r
             return BuildOptions\r
 \r
         if FamilyMatch or FamilyIsNull:\r
             return BuildOptions\r
 \r
-        OverrideOpt = set()\r
         for Key in Options:\r
             if ModuleStyle != None and len (Key) > 2:\r
                 # Check Module style is EDK or EDKII.\r
         for Key in Options:\r
             if ModuleStyle != None and len (Key) > 2:\r
                 # Check Module style is EDK or EDKII.\r
@@ -2061,9 +2057,7 @@ class PlatformAutoGen(AutoGen):
                     if Arch == "*" or Arch == self.Arch:\r
                         if Tool not in BuildOptions:\r
                             BuildOptions[Tool] = {}\r
                     if Arch == "*" or Arch == self.Arch:\r
                         if Tool not in BuildOptions:\r
                             BuildOptions[Tool] = {}\r
-                        if Options[Key].startswith('='):\r
-                            OverrideOpt.add((Tool, Attr))\r
-                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or (Tool, Attr) in OverrideOpt:\r
+                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):\r
                             BuildOptions[Tool][Attr] = Options[Key]\r
                         else:\r
                             # append options for the same tool\r
                             BuildOptions[Tool][Attr] = Options[Key]\r
                         else:\r
                             # append options for the same tool\r
@@ -2103,7 +2097,6 @@ class PlatformAutoGen(AutoGen):
                        PlatformModuleOptions.keys() + ModuleTypeOptions.keys() +\r
                        self.ToolDefinition.keys())\r
         BuildOptions = {}\r
                        PlatformModuleOptions.keys() + ModuleTypeOptions.keys() +\r
                        self.ToolDefinition.keys())\r
         BuildOptions = {}\r
-        OverrideTool = set()\r
         for Tool in AllTools:\r
             if Tool not in BuildOptions:\r
                 BuildOptions[Tool] = {}\r
         for Tool in AllTools:\r
             if Tool not in BuildOptions:\r
                 BuildOptions[Tool] = {}\r
@@ -2122,9 +2115,8 @@ class PlatformAutoGen(AutoGen):
                         BuildOptions[Tool][Attr] = ""\r
                     # check if override is indicated\r
                     if Value.startswith('='):\r
                         BuildOptions[Tool][Attr] = ""\r
                     # check if override is indicated\r
                     if Value.startswith('='):\r
-                        OverrideTool.add((Tool, Attr))\r
                         BuildOptions[Tool][Attr] = Value[1:]\r
                         BuildOptions[Tool][Attr] = Value[1:]\r
-                    elif (Tool, Attr) not in OverrideTool:\r
+                    else:\r
                         BuildOptions[Tool][Attr] += " " + Value\r
         if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:\r
             #\r
                         BuildOptions[Tool][Attr] += " " + Value\r
         if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:\r
             #\r
index 9da6ac7a4164023a5b782ed03341a1fb54790978..fd10c5dfb9a8f4d493da00cd353a788d78841f0a 100644 (file)
@@ -753,7 +753,6 @@ class DscBuildData(PlatformBuildClassObject):
     ## Retrieve [BuildOptions]\r
     def _GetBuildOptions(self):\r
         if self._BuildOptions == None:\r
     ## Retrieve [BuildOptions]\r
     def _GetBuildOptions(self):\r
         if self._BuildOptions == None:\r
-            OverrideTool = set()\r
             self._BuildOptions = sdict()\r
             #\r
             # Retrieve build option for EDKII and EDK style module\r
             self._BuildOptions = sdict()\r
             #\r
             # Retrieve build option for EDKII and EDK style module\r
@@ -762,12 +761,10 @@ class DscBuildData(PlatformBuildClassObject):
                 RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, CodeBase]\r
                 for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4 in RecordList:\r
                     CurKey = (ToolChainFamily, ToolChain, CodeBase)\r
                 RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, CodeBase]\r
                 for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4 in RecordList:\r
                     CurKey = (ToolChainFamily, ToolChain, CodeBase)\r
-                    if Option.startswith('='):\r
-                        OverrideTool.add(CurKey)\r
                     #\r
                     # Only flags can be appended\r
                     #\r
                     #\r
                     # Only flags can be appended\r
                     #\r
-                    if CurKey not in self._BuildOptions or not ToolChain.endswith('_FLAGS') or CurKey in OverrideTool:\r
+                    if CurKey not in self._BuildOptions or not ToolChain.endswith('_FLAGS') or Option.startswith('='):\r
                         self._BuildOptions[CurKey] = Option\r
                     else:\r
                         self._BuildOptions[CurKey] += ' ' + Option\r
                         self._BuildOptions[CurKey] = Option\r
                     else:\r
                         self._BuildOptions[CurKey] += ' ' + Option\r
@@ -778,16 +775,13 @@ class DscBuildData(PlatformBuildClassObject):
             self._ModuleTypeOptions = sdict()\r
         if (Edk, ModuleType) not in self._ModuleTypeOptions:\r
             options = sdict()\r
             self._ModuleTypeOptions = sdict()\r
         if (Edk, ModuleType) not in self._ModuleTypeOptions:\r
             options = sdict()\r
-            OverrideTool = set()\r
             self._ModuleTypeOptions[Edk, ModuleType] = options\r
             DriverType = '%s.%s' % (Edk, ModuleType)\r
             RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, DriverType]\r
             for ToolChainFamily, ToolChain, Option, Arch, Type, Dummy3, Dummy4 in RecordList:\r
             self._ModuleTypeOptions[Edk, ModuleType] = options\r
             DriverType = '%s.%s' % (Edk, ModuleType)\r
             RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, DriverType]\r
             for ToolChainFamily, ToolChain, Option, Arch, Type, Dummy3, Dummy4 in RecordList:\r
-                if Arch == self._Arch and Type == DriverType:\r
+                if Type == DriverType:\r
                     Key = (ToolChainFamily, ToolChain, Edk)\r
                     Key = (ToolChainFamily, ToolChain, Edk)\r
-                    if Option.startswith('='):\r
-                        OverrideTool.add(Key)\r
-                    if Key not in options or not ToolChain.endswith('_FLAGS') or Key in OverrideTool:\r
+                    if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='):\r
                         options[Key] = Option\r
                     else:\r
                         options[Key] += ' ' + Option\r
                         options[Key] = Option\r
                     else:\r
                         options[Key] += ' ' + Option\r
@@ -2399,7 +2393,7 @@ class InfBuildData(ModuleBuildClassObject):
                 ToolChainFamily = Record[0]\r
                 ToolChain = Record[1]\r
                 Option = Record[2]\r
                 ToolChainFamily = Record[0]\r
                 ToolChain = Record[1]\r
                 Option = Record[2]\r
-                if (ToolChainFamily, ToolChain) not in self._BuildOptions:\r
+                if (ToolChainFamily, ToolChain) not in self._BuildOptions or Option.startswith('='):\r
                     self._BuildOptions[ToolChainFamily, ToolChain] = Option\r
                 else:\r
                     # concatenate the option string if they're for the same tool\r
                     self._BuildOptions[ToolChainFamily, ToolChain] = Option\r
                 else:\r
                     # concatenate the option string if they're for the same tool\r