public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bob Feng" <bob.c.feng@intel.com>
To: devel@edk2.groups.io
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
	Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: Fix private includes for FILE_GUID override
Date: Thu, 16 May 2019 19:17:27 +0800	[thread overview]
Message-ID: <20190516111728.33584-1-bob.c.feng@intel.com> (raw)

From: Michael D Kinney <michael.d.kinney@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@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@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


             reply	other threads:[~2019-05-16 11:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 11:17 Bob Feng [this message]
2019-05-21  2:43 ` [Patch] BaseTools: Fix private includes for FILE_GUID override Liming Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190516111728.33584-1-bob.c.feng@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox