[edk2] [Patch] BaseTool: Fixed the StructurePcd incorrect value.

BobCF posted 1 patch 6 years, 9 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/Workspace/BuildClassObject.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
[edk2] [Patch] BaseTool: Fixed the StructurePcd incorrect value.
Posted by BobCF 6 years, 9 months ago
If user not set Structure overall value in Dsc,
Structure Pcd value would be incorrect.

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/BuildClassObject.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index e5f1f01556..947ac1f466 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -65,11 +65,11 @@ class PcdClassObject(object):
         self.validlists = validlists
         self.expressions = expressions
         self.DscDefaultValue = None
         if IsDsc:
             self.DscDefaultValue = Value
-        
+
     ## Convert the class to a string
     #
     #  Convert each member of the class to string
     #  Organize to a signle line format string
     #
@@ -107,11 +107,15 @@ class PcdClassObject(object):
     #
     def __hash__(self):
         return hash((self.TokenCName, self.TokenSpaceGuidCName))
 
 class StructurePcd(PcdClassObject):
-    def __init__(self, StructuredPcdIncludeFile="", Packages=None, Name=None, Guid=None, Type=None, DatumType=None, Value=None, Token=None, MaxDatumSize=None, SkuInfoList={}, IsOverrided=False, GuidValue=None, validateranges=[], validlists=[], expressions=[],default_store = TAB_DEFAULT_STORES_DEFAULT):
+    def __init__(self, StructuredPcdIncludeFile=None, Packages=None, Name=None, Guid=None, Type=None, DatumType=None, Value=None, Token=None, MaxDatumSize=None, SkuInfoList=None, IsOverrided=False, GuidValue=None, validateranges=None, validlists=None, expressions=None,default_store = TAB_DEFAULT_STORES_DEFAULT):
+        if SkuInfoList is None: SkuInfoList={}
+        if validateranges is None: validateranges=[]
+        if validlists is None: validlists=[]
+        if expressions is None : expressions=[]
         super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)
         self.StructuredPcdIncludeFile = StructuredPcdIncludeFile
         self.PackageDecs = Packages
         self.DefaultStoreName = [default_store]
         self.DefaultValues = collections.OrderedDict({})
@@ -435,6 +439,5 @@ class PlatformBuildClassObject(object):
     #
     # @retval string Key for hash table
     #
     def __hash__(self):
         return hash(self.MetaFile)
-
-- 
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] BaseTool: Fixed the StructurePcd incorrect value.
Posted by Gao, Liming 6 years, 9 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Feng, Bob C
>Sent: Thursday, January 25, 2018 3:42 PM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTool: Fixed the StructurePcd incorrect value.
>
>If user not set Structure overall value in Dsc,
>Structure Pcd value would be incorrect.
>
>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/BuildClassObject.py | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py
>b/BaseTools/Source/Python/Workspace/BuildClassObject.py
>index e5f1f01556..947ac1f466 100644
>--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
>+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
>@@ -65,11 +65,11 @@ class PcdClassObject(object):
>         self.validlists = validlists
>         self.expressions = expressions
>         self.DscDefaultValue = None
>         if IsDsc:
>             self.DscDefaultValue = Value
>-
>+
>     ## Convert the class to a string
>     #
>     #  Convert each member of the class to string
>     #  Organize to a signle line format string
>     #
>@@ -107,11 +107,15 @@ class PcdClassObject(object):
>     #
>     def __hash__(self):
>         return hash((self.TokenCName, self.TokenSpaceGuidCName))
>
> class StructurePcd(PcdClassObject):
>-    def __init__(self, StructuredPcdIncludeFile="", Packages=None,
>Name=None, Guid=None, Type=None, DatumType=None, Value=None,
>Token=None, MaxDatumSize=None, SkuInfoList={}, IsOverrided=False,
>GuidValue=None, validateranges=[], validlists=[],
>expressions=[],default_store = TAB_DEFAULT_STORES_DEFAULT):
>+    def __init__(self, StructuredPcdIncludeFile=None, Packages=None,
>Name=None, Guid=None, Type=None, DatumType=None, Value=None,
>Token=None, MaxDatumSize=None, SkuInfoList=None, IsOverrided=False,
>GuidValue=None, validateranges=None, validlists=None,
>expressions=None,default_store = TAB_DEFAULT_STORES_DEFAULT):
>+        if SkuInfoList is None: SkuInfoList={}
>+        if validateranges is None: validateranges=[]
>+        if validlists is None: validlists=[]
>+        if expressions is None : expressions=[]
>         super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value,
>Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges,
>validlists, expressions)
>         self.StructuredPcdIncludeFile = StructuredPcdIncludeFile
>         self.PackageDecs = Packages
>         self.DefaultStoreName = [default_store]
>         self.DefaultValues = collections.OrderedDict({})
>@@ -435,6 +439,5 @@ class PlatformBuildClassObject(object):
>     #
>     # @retval string Key for hash table
>     #
>     def __hash__(self):
>         return hash(self.MetaFile)
>-
>--
>2.14.3.windows.1

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