[edk2] [Patch] BaseTools: Fix building FatPkg failed issue

BobCF posted 1 patch 6 years, 3 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/Workspace/DscBuildData.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
[edk2] [Patch] BaseTools: Fix building FatPkg failed issue
Posted by BobCF 6 years, 3 months ago
Using property instead of vairable for DecPcds.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
CC: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index b60c0fdf3..dcc70e8ba 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1010,11 +1010,11 @@ class DscBuildData(PlatformBuildClassObject):
             else:
                 EdkLogger.error('build', PARSER_ERROR,
                             "Pcd (%s.%s) defined in DSC is not declared in DEC files. Arch: ['%s']" % (str_pcd[0], str_pcd[1], self._Arch),
                             File=self.MetaFile,Line = StrPcdSet[str_pcd][0][5])
         # Add the Structure PCD that only defined in DEC, don't have override in DSC file
-        for Pcd in self._DecPcds:
+        for Pcd in self.DecPcds:
             if type (self._DecPcds[Pcd]) is StructurePcd:
                 if Pcd not in S_pcd_set:
                     str_pcd_obj_str = StructurePcd()
                     str_pcd_obj_str.copy(self._DecPcds[Pcd])
                     str_pcd_obj = Pcds.get(Pcd, None)
@@ -1987,11 +1987,25 @@ class DscBuildData(PlatformBuildClassObject):
     #
     def AddPcd(self, Name, Guid, Value):
         if (Name, Guid) not in self.Pcds:
             self.Pcds[Name, Guid] = PcdClassObject(Name, Guid, '', '', '', '', '', {}, False, None)
         self.Pcds[Name, Guid].DefaultValue = Value
-
+    @property
+    def DecPcds(self):
+        if self._DecPcds == None:
+            FdfInfList = []
+            if GlobalData.gFdfParser:
+                FdfInfList = GlobalData.gFdfParser.Profile.InfList
+            PkgSet = set()
+            for Inf in FdfInfList:
+                ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch=self._Arch)
+                if ModuleFile in self._Modules:
+                    continue
+                ModuleData = self._Bdb[ModuleFile, self._Arch, self._Target, self._Toolchain]
+                PkgSet.update(ModuleData.Packages)
+            self._DecPcds = GetDeclaredPcd(self, self._Bdb, self._Arch, self._Target, self._Toolchain,PkgSet)
+        return self._DecPcds
     _Macros = property(_GetMacros)
     Arch = property(_GetArch, _SetArch)
     Platform = property(_GetPlatformName)
     PlatformName = property(_GetPlatformName)
     Guid = property(_GetFileGuid)
-- 
2.14.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Fix building FatPkg failed issue
Posted by Gao, Liming 6 years, 3 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Feng, Bob C
>Sent: Tuesday, December 26, 2017 11:34 AM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: Fix building FatPkg failed issue
>
>Using property instead of vairable for DecPcds.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng <bob.c.feng@intel.com>
>CC: Liming Gao <liming.gao@intel.com>
>---
> BaseTools/Source/Python/Workspace/DscBuildData.py | 18
>++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
>b/BaseTools/Source/Python/Workspace/DscBuildData.py
>index b60c0fdf3..dcc70e8ba 100644
>--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
>@@ -1010,11 +1010,11 @@ class DscBuildData(PlatformBuildClassObject):
>             else:
>                 EdkLogger.error('build', PARSER_ERROR,
>                             "Pcd (%s.%s) defined in DSC is not declared in DEC files. Arch:
>['%s']" % (str_pcd[0], str_pcd[1], self._Arch),
>                             File=self.MetaFile,Line = StrPcdSet[str_pcd][0][5])
>         # Add the Structure PCD that only defined in DEC, don't have override in
>DSC file
>-        for Pcd in self._DecPcds:
>+        for Pcd in self.DecPcds:
>             if type (self._DecPcds[Pcd]) is StructurePcd:
>                 if Pcd not in S_pcd_set:
>                     str_pcd_obj_str = StructurePcd()
>                     str_pcd_obj_str.copy(self._DecPcds[Pcd])
>                     str_pcd_obj = Pcds.get(Pcd, None)
>@@ -1987,11 +1987,25 @@ class DscBuildData(PlatformBuildClassObject):
>     #
>     def AddPcd(self, Name, Guid, Value):
>         if (Name, Guid) not in self.Pcds:
>             self.Pcds[Name, Guid] = PcdClassObject(Name, Guid, '', '', '', '', '', {},
>False, None)
>         self.Pcds[Name, Guid].DefaultValue = Value
>-
>+    @property
>+    def DecPcds(self):
>+        if self._DecPcds == None:
>+            FdfInfList = []
>+            if GlobalData.gFdfParser:
>+                FdfInfList = GlobalData.gFdfParser.Profile.InfList
>+            PkgSet = set()
>+            for Inf in FdfInfList:
>+                ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace,
>Arch=self._Arch)
>+                if ModuleFile in self._Modules:
>+                    continue
>+                ModuleData = self._Bdb[ModuleFile, self._Arch, self._Target,
>self._Toolchain]
>+                PkgSet.update(ModuleData.Packages)
>+            self._DecPcds = GetDeclaredPcd(self, self._Bdb, self._Arch,
>self._Target, self._Toolchain,PkgSet)
>+        return self._DecPcds
>     _Macros = property(_GetMacros)
>     Arch = property(_GetArch, _SetArch)
>     Platform = property(_GetPlatformName)
>     PlatformName = property(_GetPlatformName)
>     Guid = property(_GetFileGuid)
>--
>2.14.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel