BaseTools: Fix private includes for FILE_GUID override

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@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Michael D Kinney 2019-03-21 17:27:20 -07:00 committed by Feng, Bob C
parent cc99ea9422
commit 66b845ae06
2 changed files with 3 additions and 1 deletions

View File

@ -3416,7 +3416,7 @@ class ModuleAutoGen(AutoGen):
RetVal.append(PackageDir) RetVal.append(PackageDir)
IncludesList = Package.Includes IncludesList = Package.Includes
if Package._PrivateIncludes: 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))) IncludesList = list(set(Package.Includes).difference(set(Package._PrivateIncludes)))
for Inc in IncludesList: for Inc in IncludesList:
if Inc not in RetVal: if Inc not in RetVal:

View File

@ -281,6 +281,7 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
# #
RtPath.Path = TempFullPath RtPath.Path = TempFullPath
RtPath.BaseName = BaseName RtPath.BaseName = BaseName
RtPath.OriginalPath = Path
# #
# If file exists, compare contents # If file exists, compare contents
# #
@ -1405,6 +1406,7 @@ class PathClass(object):
self.TagName = TagName self.TagName = TagName
self.ToolCode = ToolCode self.ToolCode = ToolCode
self.ToolChainFamily = ToolChainFamily self.ToolChainFamily = ToolChainFamily
self.OriginalPath = self
## Convert the object of this class to a string ## Convert the object of this class to a string
# #