]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/Tools/GenCfgOpt.py
IntelFsp2Pkg: Raise exception for invalid BSF option
[mirror_edk2.git] / IntelFsp2Pkg / Tools / GenCfgOpt.py
index 7658b7fc5cb0782d65a302140df290ef34764586..6dc1b10b34697c7b7fb490135c6cf9c767b0c628 100644 (file)
@@ -1,6 +1,6 @@
 ## @ GenCfgOpt.py\r
 #\r
-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials are licensed and made available under\r
 # the terms and conditions of the BSD License that accompanies this distribution.\r
 # The full text of the license may be found at\r
@@ -1239,6 +1239,7 @@ EndList
         return 0\r
 \r
     def WriteBsfStruct  (self, BsfFd, Item):\r
+        LogExpr = CLogicalExpression()\r
         if Item['type'] == "None":\r
             Space = "gPlatformFspPkgTokenSpaceGuid"\r
         else:\r
@@ -1260,6 +1261,9 @@ EndList
                 for Option in OptList:\r
                     Option = Option.strip()\r
                     (OpVal, OpStr) = Option.split(':')\r
+                    test = LogExpr.getNumber (OpVal)\r
+                    if test is None:\r
+                        raise Exception("Selection Index '%s' is not a number" % OpVal)\r
                     TmpList.append((OpVal, OpStr))\r
         return  TmpList\r
 \r
@@ -1428,11 +1432,12 @@ def Main():
             else:\r
                 OutFile = sys.argv[4]\r
                 Start = 5\r
-            GenCfgOpt.ParseBuildMode(sys.argv[3])\r
-            if GenCfgOpt.ParseMacros(sys.argv[Start:]) != 0:\r
-                print "ERROR: Macro parsing failed !"\r
-                return 3\r
+            if argc > Start:\r
+                if GenCfgOpt.ParseMacros(sys.argv[Start:]) != 0:\r
+                    print "ERROR: Macro parsing failed !"\r
+                    return 3\r
 \r
+        GenCfgOpt.ParseBuildMode(sys.argv[3])\r
         FvDir = sys.argv[3]\r
         if not os.path.exists(FvDir):\r
             os.makedirs(FvDir)\r