public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Fix a bug for --pcd used in ConditionalStatement calculate
@ 2018-03-09  7:19 Yonghong Zhu
  2018-03-09  8:22 ` Gao, Liming
  0 siblings, 1 reply; 4+ messages in thread
From: Yonghong Zhu @ 2018-03-09  7:19 UTC (permalink / raw)
  To: edk2-devel

Move the GlobalData.BuildOptionPcd before FdfParser() function and add
type check for Pcd item.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/GenFds/FdfParser.py         | 2 ++
 BaseTools/Source/Python/GenFds/GenFds.py            | 2 +-
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 76d7e6a..dda7ed4 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -925,10 +925,12 @@ class FdfParser:
 
         MacroDict.update(GlobalData.gGlobalDefines)
         MacroDict.update(GlobalData.gCommandLineDefines)
         if GlobalData.BuildOptionPcd:
             for Item in GlobalData.BuildOptionPcd:
+                if type(Item) is tuple:
+                    continue
                 PcdName, TmpValue = Item.split("=")
                 TmpValue = BuildOptionValue(TmpValue, {})
                 MacroDict[PcdName.strip()] = TmpValue
         # Highest priority
 
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 4c56cbb..03126e3 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -140,10 +140,11 @@ def main():
             if not os.path.exists(ActivePlatform)  :
                 EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
         else:
             EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform")
 
+        GlobalData.BuildOptionPcd     = Options.OptionPcd if Options.OptionPcd else {}
         GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform))
 
         if (Options.ConfDirectory):
             # Get alternate Conf location, if it is absolute, then just use the absolute directory name
             ConfDirectoryPath = os.path.normpath(Options.ConfDirectory)
@@ -324,11 +325,10 @@ def main():
                                         EdkLogger.error("GenFds", FORMAT_INVALID, "The FV %s's region is specified in multiple FD with different value." %FvObj.UiFvName)
                                 else:
                                     FvObj.FvRegionInFD = RegionObj.Size
                                     RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, FvObj)
 
-        GlobalData.BuildOptionPcd     = Options.OptionPcd if Options.OptionPcd else {}
         """Call GenFds"""
         GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)
 
         """Generate GUID cross reference file"""
         GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList, FdfParserObj)
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 69bdf21..2eb4c75 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1243,10 +1243,12 @@ class DscParser(MetaFileParser):
         # PCD cannot be referenced in macro definition
         if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]:
             Macros.update(self._Symbols)
         if GlobalData.BuildOptionPcd:
             for Item in GlobalData.BuildOptionPcd:
+                if type(Item) is tuple:
+                    continue
                 PcdName, TmpValue = Item.split("=")
                 TmpValue = BuildOptionValue(TmpValue, self._GuidDict)
                 Macros[PcdName.strip()] = TmpValue
         return Macros
 
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [Patch] BaseTools: Fix a bug for --pcd used in ConditionalStatement calculate
@ 2018-03-07  8:34 Yonghong Zhu
  2018-03-08  1:52 ` Gao, Liming
  0 siblings, 1 reply; 4+ messages in thread
From: Yonghong Zhu @ 2018-03-07  8:34 UTC (permalink / raw)
  To: edk2-devel

Move the GlobalData.BuildOptionPcd before FdfParser() function

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/GenFds/GenFds.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 4c56cbb..e3cc77f 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -268,10 +268,12 @@ def main():
 
             if not os.path.exists(OutputDir):
                 EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=OutputDir)
             GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir
 
+        GlobalData.BuildOptionPcd     = Options.OptionPcd if Options.OptionPcd else {}
+
         """ Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """
         FdfParserObj = FdfParser.FdfParser(FdfFilename)
         FdfParserObj.ParseFile()
 
         if FdfParserObj.CycleReferenceCheck():
@@ -324,11 +326,10 @@ def main():
                                         EdkLogger.error("GenFds", FORMAT_INVALID, "The FV %s's region is specified in multiple FD with different value." %FvObj.UiFvName)
                                 else:
                                     FvObj.FvRegionInFD = RegionObj.Size
                                     RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, FvObj)
 
-        GlobalData.BuildOptionPcd     = Options.OptionPcd if Options.OptionPcd else {}
         """Call GenFds"""
         GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)
 
         """Generate GUID cross reference file"""
         GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList, FdfParserObj)
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-09  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-09  7:19 [Patch] BaseTools: Fix a bug for --pcd used in ConditionalStatement calculate Yonghong Zhu
2018-03-09  8:22 ` Gao, Liming
  -- strict thread matches above, loose matches on Subject: below --
2018-03-07  8:34 Yonghong Zhu
2018-03-08  1:52 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox