BaseTools: enhance error handling for option --binary-source
authorYonghong Zhu <yonghong.zhu@intel.com>
Thu, 18 Jan 2018 03:13:06 +0000 (11:13 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 19 Jan 2018 02:52:29 +0000 (10:52 +0800)
Enhance error handling for option --binary-source to report invalid
option value. --binary-destination use same rule.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/build/build.py

index de19756..e4adee2 100644 (file)
@@ -794,12 +794,18 @@ class Build():
             if not os.path.isabs(BinCacheSource):\r
                 BinCacheSource = mws.join(self.WorkspaceDir, BinCacheSource)\r
             GlobalData.gBinCacheSource = BinCacheSource\r
             if not os.path.isabs(BinCacheSource):\r
                 BinCacheSource = mws.join(self.WorkspaceDir, BinCacheSource)\r
             GlobalData.gBinCacheSource = BinCacheSource\r
+        else:\r
+            if GlobalData.gBinCacheSource != None:\r
+                EdkLogger.error("build", OPTION_VALUE_INVALID, ExtraData="Invalid value of option --binary-source.")\r
 \r
         if GlobalData.gBinCacheDest:\r
             BinCacheDest = os.path.normpath(GlobalData.gBinCacheDest)\r
             if not os.path.isabs(BinCacheDest):\r
                 BinCacheDest = mws.join(self.WorkspaceDir, BinCacheDest)\r
             GlobalData.gBinCacheDest = BinCacheDest\r
 \r
         if GlobalData.gBinCacheDest:\r
             BinCacheDest = os.path.normpath(GlobalData.gBinCacheDest)\r
             if not os.path.isabs(BinCacheDest):\r
                 BinCacheDest = mws.join(self.WorkspaceDir, BinCacheDest)\r
             GlobalData.gBinCacheDest = BinCacheDest\r
+        else:\r
+            if GlobalData.gBinCacheDest != None:\r
+                EdkLogger.error("build", OPTION_VALUE_INVALID, ExtraData="Invalid value of option --binary-destination.")\r
 \r
         if self.ConfDirectory:\r
             # Get alternate Conf location, if it is absolute, then just use the absolute directory name\r
 \r
         if self.ConfDirectory:\r
             # Get alternate Conf location, if it is absolute, then just use the absolute directory name\r