public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] BaseTools/UPT: Fix an issue in subst command
@ 2017-03-10  0:25 hesschen
  2017-03-14  6:58 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: hesschen @ 2017-03-10  0:25 UTC (permalink / raw)
  To: edk2-devel

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: hesschen <hesheng.chen@intel.com>
---
 .../UPT/Parser/InfGuidPpiProtocolSectionParser.py    |  7 ++++---
 BaseTools/Source/Python/UPT/UPT.py                   | 20 +++++++++++---------
 2 files changed, 15 insertions(+), 12 deletions(-)

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] BaseTools/UPT: Fix an issue in subst command
  2017-03-10  0:25 [patch] BaseTools/UPT: Fix an issue in subst command hesschen
@ 2017-03-14  6:58 ` Zhu, Yonghong
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2017-03-14  6:58 UTC (permalink / raw)
  To: Chen, Hesheng, edk2-devel@lists.01.org


Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Chen, Hesheng 
Sent: Friday, March 10, 2017 8:25 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [patch] BaseTools/UPT: Fix an issue in subst command

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: hesschen <hesheng.chen@intel.com>
---
 .../UPT/Parser/InfGuidPpiProtocolSectionParser.py    |  7 ++++---
 BaseTools/Source/Python/UPT/UPT.py                   | 20 +++++++++++---------
 2 files changed, 15 insertions(+), 12 deletions(-)

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-14  6:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-10  0:25 [patch] BaseTools/UPT: Fix an issue in subst command hesschen
2017-03-14  6:58 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox