]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/UPT: Fix an issue in subst command
authorHess Chen <hesheng.chen@intel.com>
Fri, 10 Mar 2017 00:25:21 +0000 (08:25 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 14 Mar 2017 09:29:24 +0000 (17:29 +0800)
UPT used to use "B:" as the temp directory which may cause conflict,
now it will choose a valid volume. Also UPT now accepts empty sections.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py
BaseTools/Source/Python/UPT/UPT.py

index 10a82cbfd862da28d104f166910a5d2c743aa9ff..12ffedaaec617e6376e2e6a71c9b5817a9eaf855 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file contained the parser for [Guids], [Ppis], [Protocols] sections in INF file \r
 #\r
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials are licensed and made available \r
 # under the terms and conditions of the BSD License which accompanies this \r
@@ -217,8 +217,9 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
         for Line in SectionString:\r
             LineContent = Line[0]\r
 \r
-            if LineContent.strip() == '':\r
-                continue\r
+# Comment the code to support user extension without any statement just the section header in []\r
+#             if LineContent.strip() == '':\r
+#                 continue\r
 \r
             UserExtensionContent += LineContent + DT.END_OF_LINE\r
             continue\r
index 8dd949ae90388d4f7066b473a9f99a1c24732499..873492d4f0da723ee8e7597d3a2c92b63c9eda98 100644 (file)
@@ -2,7 +2,7 @@
 #\r
 # This file is the main entry for UPT \r
 #\r
-# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials are licensed and made available \r
 # under the terms and conditions of the BSD License which accompanies this \r
@@ -179,15 +179,16 @@ def Main():
             Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())\r
         return XExcept.args[0]\r
 \r
-    # Start *********************************************\r
     # Support WORKSPACE is a long path\r
-    # Only work well on windows\r
-    # Linux Solution TBD\r
+    # Only works for windows system\r
     if pf.system() == 'Windows':\r
-        os.system('@echo off\nsubst b: /D')\r
-        os.system('subst b: "%s"' % GlobalData.gWORKSPACE)\r
-        GlobalData.gWORKSPACE = 'B:\\'\r
-    # End ***********************************************\r
+        Vol = 'B:'\r
+        for Index in range(90, 65, -1):\r
+            Vol = chr(Index) + ':'\r
+            if not os.path.isdir(Vol):\r
+                os.system('subst %s "%s"' % (Vol, GlobalData.gWORKSPACE))\r
+                break\r
+        GlobalData.gWORKSPACE = '%s\\' % Vol\r
 \r
     WorkspaceDir = GlobalData.gWORKSPACE\r
 \r
@@ -304,8 +305,9 @@ def Main():
         except StandardError:\r
             Logger.Quiet(ST.MSG_RECOVER_FAIL)\r
         GlobalData.gDB.CloseDb()\r
+\r
         if pf.system() == 'Windows':\r
-            os.system('subst b: /D')\r
+            os.system('subst %s /D' % GlobalData.gWORKSPACE.replace('\\',''))\r
 \r
     return ReturnCode\r
 \r