BaseTools: Correct PCD generation logic to make sure DB is use
authorLiming Gao <liming.gao@intel.com>
Mon, 18 Dec 2017 04:42:41 +0000 (12:42 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 25 Dec 2017 03:05:52 +0000 (11:05 +0800)
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/Workspace/DscBuildData.py

index d8a7d09..7594b45 100644 (file)
@@ -1014,6 +1014,17 @@ class DscBuildData(PlatformBuildClassObject):
         for stru_pcd in S_pcd_set.values():\r
             if stru_pcd.Type not in DynamicPcdType:\r
                 continue\r
+            for skuid in SkuIds:\r
+                if skuid in stru_pcd.SkuOverrideValues:\r
+                    continue\r
+                nextskuid = self.SkuIdMgr.GetNextSkuId(skuid)\r
+                NoDefault = False\r
+                while nextskuid not in stru_pcd.SkuOverrideValues:\r
+                    if nextskuid == "DEFAULT":\r
+                        NoDefault = True\r
+                        break\r
+                    nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)\r
+                stru_pcd.SkuOverrideValues[skuid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStores} if DefaultStores else {'STANDARD':stru_pcd.DefaultValues})\r
             if stru_pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:\r
                 for skuid in SkuIds:\r
                     nextskuid = skuid\r
@@ -1024,7 +1035,6 @@ class DscBuildData(PlatformBuildClassObject):
                                 NoDefault = True\r
                                 break\r
                             nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)\r
-                        stru_pcd.SkuOverrideValues[skuid] = {}\r
                     if NoDefault:\r
                         continue\r
                     PcdDefaultStoreSet = set([defaultstorename  for defaultstorename in stru_pcd.SkuOverrideValues[nextskuid]])\r
@@ -1033,23 +1043,13 @@ class DscBuildData(PlatformBuildClassObject):
                     for defaultstoreid in DefaultStores:\r
                         if defaultstoreid not in stru_pcd.SkuOverrideValues[skuid]:\r
                             stru_pcd.SkuOverrideValues[skuid][defaultstoreid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorename])\r
-            for skuid in SkuIds:\r
-                if skuid in stru_pcd.SkuOverrideValues:\r
-                    continue\r
-                nextskuid = self.SkuIdMgr.GetNextSkuId(skuid)\r
-                NoDefault = False\r
-                while nextskuid not in stru_pcd.SkuOverrideValues:\r
-                    if nextskuid == "DEFAULT":\r
-                        NoDefault = True\r
-                        break\r
-                    nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)\r
-                stru_pcd.SkuOverrideValues[skuid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStores})\r
 \r
         Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)\r
         if Str_Pcd_Values:\r
             for (skuname,StoreName,PcdGuid,PcdName,PcdValue) in Str_Pcd_Values:\r
                 str_pcd_obj = S_pcd_set.get((PcdName, PcdGuid))\r
                 if str_pcd_obj is None:\r
+                    print PcdName, PcdGuid\r
                     raise\r
                 if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],\r
                                         self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:\r