[edk2-devel] [Patch] BaseTools: Fix private includes for FILE_GUID override

Liming Gao liming.gao at intel.com
Tue May 21 02:43:47 UTC 2019


Reviewed-by: Liming Gao <liming.gao at intel.com>

> -----Original Message-----
> From: Feng, Bob C
> Sent: Thursday, May 16, 2019 7:17 PM
> To: devel at edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney at intel.com>; Feng, Bob C <bob.c.feng at intel.com>; Gao, Liming <liming.gao at intel.com>
> Subject: [Patch] BaseTools: Fix private includes for FILE_GUID override
> 
> From: Michael D Kinney <michael.d.kinney at intel.com>
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1648
> 
> When a module in a DSC file uses a FILE_GUID override in the
> module scoped <Defines> section, a copy of the modified INF file
> is placed in the Conf/.cache directory.  The check for private
> includes uses the INF path to determine if the module is allowed
> to use the private includes.  Since the INF path in this case is
> not in any package, this check always fails, and no private
> include paths are possible.
> 
> The fix is to keep both the OriginalPath and the new Path in
> the PathClass object, and always use the OriginalPath to see if
> the module INF is in the package with private includes.
> 
> Signed-off-by: Michael D Kinney <michael.d.kinney at intel.com>
> Cc: Bob Feng <bob.c.feng at intel.com>
> Cc: Liming Gao <liming.gao at intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +-
>  BaseTools/Source/Python/Common/Misc.py     | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index 31721a6f9f..c174b5a0bb 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -3414,11 +3414,11 @@ class ModuleAutoGen(AutoGen):
>              PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
>              if PackageDir not in RetVal:
>                  RetVal.append(PackageDir)
>              IncludesList = Package.Includes
>              if Package._PrivateIncludes:
> -                if not self.MetaFile.Path.startswith(PackageDir):
> +                if not self.MetaFile.OriginalPath.Path.startswith(PackageDir):
>                      IncludesList = list(set(Package.Includes).difference(set(Package._PrivateIncludes)))
>              for Inc in IncludesList:
>                  if Inc not in RetVal:
>                      RetVal.append(str(Inc))
>          return RetVal
> diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
> index 0e0cb45ebe..d082c58bef 100644
> --- a/BaseTools/Source/Python/Common/Misc.py
> +++ b/BaseTools/Source/Python/Common/Misc.py
> @@ -279,10 +279,11 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
>      # The BaseName is the FILE_GUID which is also the output directory name.
>      #
>      #
>      RtPath.Path = TempFullPath
>      RtPath.BaseName = BaseName
> +    RtPath.OriginalPath = Path
>      #
>      # If file exists, compare contents
>      #
>      if os.path.exists(TempFullPath):
>          with open(str(Path), 'rb') as f1, open(TempFullPath, 'rb') as f2:
> @@ -1403,10 +1404,11 @@ class PathClass(object):
>          self.IsBinary = IsBinary
>          self.Target = Target
>          self.TagName = TagName
>          self.ToolCode = ToolCode
>          self.ToolChainFamily = ToolChainFamily
> +        self.OriginalPath = self
> 
>      ## Convert the object of this class to a string
>      #
>      #  Convert member Path of the class to a string
>      #
> --
> 2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41103): https://edk2.groups.io/g/devel/message/41103
Mute This Topic: https://groups.io/mt/31639518/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list