]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/Misc.py
BaseTools: Fix the bug to display the single SKUID info
[mirror_edk2.git] / BaseTools / Source / Python / Common / Misc.py
index ef52154f47a197739cce467876506cf61904767d..1461d00669c20e54542f954d1bd336fe19a0a495 100644 (file)
@@ -1535,16 +1535,10 @@ def ParseFieldValue (Value):
     if Value.startswith('GUID') and Value.endswith(')'):\r
         Value = Value.split('(', 1)[1][:-1].strip()\r
         if Value[0] == '{' and Value[-1] == '}':\r
-            Value = Value[1:-1].strip()\r
-            Value = Value.split('{', 1)\r
-            Value = ['%02x' % int(Item, 16) for Item in (Value[0] + Value[1][:-1]).split(',')]\r
-            if len(Value[0]) != 8:\r
-                Value[0] = '%08X' % int(Value[0], 16)\r
-            if len(Value[1]) != 4:\r
-                Value[1] = '%04X' % int(Value[1], 16)\r
-            if len(Value[2]) != 4:\r
-                Value[2] = '%04X' % int(Value[2], 16)\r
-            Value = '-'.join(Value[0:3]) + '-' + ''.join(Value[3:5]) + '-' + ''.join(Value[5:11])\r
+            TmpValue = GuidStructureStringToGuidString(Value)\r
+            if len(TmpValue) == 0:\r
+                raise BadExpression("Invalid GUID value string %s" % Value)\r
+            Value = TmpValue\r
         if Value[0] == '"' and Value[-1] == '"':\r
             Value = Value[1:-1]\r
         try:\r
@@ -1572,6 +1566,8 @@ def ParseFieldValue (Value):
     if Value.startswith("L'") and Value.endswith("'"):\r
         # Unicode Character Constant\r
         List = list(Value[2:-1])\r
+        if len(List) == 0:\r
+            raise BadExpression('Length %s is %s' % (Value, len(List)))\r
         List.reverse()\r
         Value = 0\r
         for Char in List:\r
@@ -1580,6 +1576,8 @@ def ParseFieldValue (Value):
     if Value.startswith("'") and Value.endswith("'"):\r
         # Character constant\r
         List = list(Value[1:-1])\r
+        if len(List) == 0:\r
+            raise BadExpression('Length %s is %s' % (Value, len(List)))\r
         List.reverse()\r
         Value = 0\r
         for Char in List:\r
@@ -1599,7 +1597,8 @@ def ParseFieldValue (Value):
                 Value = (Value << 8) | ((ItemValue >> 8 * I) & 0xff)\r
         return Value, RetSize\r
     if Value.startswith('DEVICE_PATH(') and Value.endswith(')'):\r
-        Value = Value.split('"')[1]\r
+        Value = Value.replace("DEVICE_PATH(", '').rstrip(')')\r
+        Value = Value.strip().strip('"')\r
         return ParseDevPathValue(Value)\r
     if Value.lower().startswith('0x'):\r
         Value = int(Value, 16)\r
@@ -2240,6 +2239,10 @@ class SkuClass():
             GlobalData.gSkuids = (self.SkuIdSet)\r
             if 'COMMON' in GlobalData.gSkuids:\r
                 GlobalData.gSkuids.remove('COMMON')\r
+            if self.SkuUsageType == self.SINGLE:\r
+                if len(GlobalData.gSkuids) != 1:\r
+                    if 'DEFAULT' in GlobalData.gSkuids:\r
+                        GlobalData.gSkuids.remove('DEFAULT')\r
             if GlobalData.gSkuids:\r
                 GlobalData.gSkuids.sort()\r
 \r
@@ -2348,11 +2351,11 @@ def PackRegistryFormatGuid(Guid):
                 )\r
 \r
 def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):\r
-    if PcdDatumType == 'VOID*':\r
-        if Value.startswith('L'):\r
+    if PcdDatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64,'BOOLEAN']:\r
+        if Value.startswith('L') or Value.startswith('"'):\r
             if not Value[1]:\r
                 EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')\r
-            Value = Value[0] + '"' + Value[1:] + '"'\r
+            Value = Value\r
         elif Value.startswith('H'):\r
             if not Value[1]:\r
                 EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')\r