Yes, after this patch checked in, the bug you reported should be fixed.

Thanks,

Dennis

-----Original Message-----
From: Andrew Fish [mailto:af...@apple.com] 
Sent: Wednesday, June 17, 2015 0:11
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] [Patch] BaseTools: Fixed Build Option override bugs.


> On Jun 16, 2015, at 1:35 AM, Yingke Liu <yingke.d....@intel.com> wrote:
> 
> if '==' is specified, it overrides all options that specified by '='; if no 
> '==' is specified, all options that match current build criteria are combined.
> 

Does this fix the bug I reported with an ‘=‘ getting lost if two of the same 
form are in a DSC?

Thanks,

Andrew Fish

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yingke Liu <yingke.d....@intel.com>
> ---
> BaseTools/Source/Python/AutoGen/AutoGen.py         | 20 ++++++++----
> .../Source/Python/Workspace/WorkspaceDatabase.py   | 36 ++++++++++++++--------
> 2 files changed, 38 insertions(+), 18 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index 0e7482a..ca7d5ab 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -1963,7 +1963,8 @@ class PlatformAutoGen(AutoGen):
>             # Key[0] -- tool family
>             # Key[1] -- TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
>             #
> -            if Key[0] == self.BuildRuleFamily :
> +            if (Key[0] == self.BuildRuleFamily and
> +                (ModuleStyle == None or len(Key) < 3 or (len(Key) > 2 and 
> Key[2] == ModuleStyle))):
>                 Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
>                 if Target == self.BuildTarget or Target == "*":
>                     if ToolChain == self.ToolChain or ToolChain == "*":
> @@ -1999,7 +2000,7 @@ class PlatformAutoGen(AutoGen):
>                                             if 
> Options.get((self.BuildRuleFamily, NowKey)) != None: 
>                                                 
> Options.pop((self.BuildRuleFamily, NowKey))
> 
> -        
> +        OverrideOpt = set()
>         for Key in Options:
>             if ModuleStyle != None and len (Key) > 2:
>                 # Check Module style is EDK or EDKII.
> @@ -2025,7 +2026,9 @@ class PlatformAutoGen(AutoGen):
>                     if Arch == "*" or Arch == self.Arch:
>                         if Tool not in BuildOptions:
>                             BuildOptions[Tool] = {}
> -                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
> +                        if Options[Key].startswith('='):
> +                            OverrideOpt.add((Tool, Attr))
> +                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool] 
> or (Tool, Attr) in OverrideOpt:
>                             BuildOptions[Tool][Attr] = Options[Key]
>                         else:
>                             # append options for the same tool @@ 
> -2033,7 +2036,8 @@ class PlatformAutoGen(AutoGen):
>         # Build Option Family has been checked, which need't to be checked 
> again for family.
>         if FamilyMatch or FamilyIsNull:
>             return BuildOptions
> -        
> +
> +        OverrideOpt = set()
>         for Key in Options:
>             if ModuleStyle != None and len (Key) > 2:
>                 # Check Module style is EDK or EDKII.
> @@ -2057,7 +2061,9 @@ class PlatformAutoGen(AutoGen):
>                     if Arch == "*" or Arch == self.Arch:
>                         if Tool not in BuildOptions:
>                             BuildOptions[Tool] = {}
> -                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
> +                        if Options[Key].startswith('='):
> +                            OverrideOpt.add((Tool, Attr))
> +                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool] 
> or (Tool, Attr) in OverrideOpt:
>                             BuildOptions[Tool][Attr] = Options[Key]
>                         else:
>                             # append options for the same tool @@ 
> -2097,6 +2103,7 @@ class PlatformAutoGen(AutoGen):
>                        PlatformModuleOptions.keys() + 
> ModuleTypeOptions.keys() +
>                        self.ToolDefinition.keys())
>         BuildOptions = {}
> +        OverrideTool = set()
>         for Tool in AllTools:
>             if Tool not in BuildOptions:
>                 BuildOptions[Tool] = {} @@ -2115,8 +2122,9 @@ class 
> PlatformAutoGen(AutoGen):
>                         BuildOptions[Tool][Attr] = ""
>                     # check if override is indicated
>                     if Value.startswith('='):
> +                        OverrideTool.add((Tool, Attr))
>                         BuildOptions[Tool][Attr] = Value[1:]
> -                    else:
> +                    elif (Tool, Attr) not in OverrideTool:
>                         BuildOptions[Tool][Attr] += " " + Value
>         if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != 
> None:
>             #
> diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 
> b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> index 1371bb0..6c1d518 100644
> --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> @@ -753,19 +753,24 @@ class DscBuildData(PlatformBuildClassObject):
>     ## Retrieve [BuildOptions]
>     def _GetBuildOptions(self):
>         if self._BuildOptions == None:
> +            OverrideTool = set()
>             self._BuildOptions = sdict()
>             #
> -            # Retrieve build option for EDKII style module
> +            # Retrieve build option for EDKII and EDK style module
>             #
> -            RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, 
> self._Arch, EDKII_NAME]
> -            for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, 
> Dummy4 in RecordList:
> -                self._BuildOptions[ToolChainFamily, ToolChain, EDKII_NAME] = 
> Option
> -            #
> -            # Retrieve build option for EDK style module
> -            #
> -            RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, 
> self._Arch, EDK_NAME]     
> -            for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, 
> Dummy4 in RecordList:
> -                self._BuildOptions[ToolChainFamily, ToolChain, EDK_NAME] = 
> Option
> +            for CodeBase in (EDKII_NAME, EDK_NAME):
> +                RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, 
> self._Arch, CodeBase]
> +                for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, 
> Dummy3, Dummy4 in RecordList:
> +                    CurKey = (ToolChainFamily, ToolChain, CodeBase)
> +                    if Option.startswith('='):
> +                        OverrideTool.add(CurKey)
> +                    #
> +                    # Only flags can be appended
> +                    #
> +                    if CurKey not in self._BuildOptions or not 
> ToolChain.endswith('_FLAGS') or CurKey in OverrideTool:
> +                        self._BuildOptions[CurKey] = Option
> +                    else:
> +                        self._BuildOptions[CurKey] += ' ' + Option
>         return self._BuildOptions
> 
>     def GetBuildOptionsByModuleType(self, Edk, ModuleType):
> @@ -773,12 +778,19 @@ class DscBuildData(PlatformBuildClassObject):
>             self._ModuleTypeOptions = sdict()
>         if (Edk, ModuleType) not in self._ModuleTypeOptions:
>             options = sdict()
> +            OverrideTool = set()
>             self._ModuleTypeOptions[Edk, ModuleType] = options
>             DriverType = '%s.%s' % (Edk, ModuleType)
>             RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, 
> self._Arch, DriverType]
>             for ToolChainFamily, ToolChain, Option, Arch, Type, Dummy3, 
> Dummy4 in RecordList:
>                 if Arch == self._Arch and Type == DriverType:
> -                    options[ToolChainFamily, ToolChain, Edk] = Option
> +                    Key = (ToolChainFamily, ToolChain, Edk)
> +                    if Option.startswith('='):
> +                        OverrideTool.add(Key)
> +                    if Key not in options or not 
> ToolChain.endswith('_FLAGS') or Key in OverrideTool:
> +                        options[Key] = Option
> +                    else:
> +                        options[Key] += ' ' + Option
>         return self._ModuleTypeOptions[Edk, ModuleType]
> 
>     ## Retrieve non-dynamic PCD settings @@ -2007,7 +2019,7 @@ class 
> InfBuildData(ModuleBuildClassObject):
>             if self._Header_ == None:
>                 self._GetHeaderInfo()
>             if self._Guid == None:
> -                self._Guid = '00000000-0000-0000-000000000000'
> +                self._Guid = '00000000-0000-0000-0000-000000000000'
>         return self._Guid
> 
>     ## Retrieve module version
> --
> 1.9.5.msysgit.0
> 
> 
> ----------------------------------------------------------------------
> -------- _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to