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: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Hess Chen 2017-03-10 08:25:21 +08:00 committed by Yonghong Zhu
parent a559e0602c
commit c03f5b2c42
2 changed files with 15 additions and 12 deletions

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file contained the parser for [Guids], [Ppis], [Protocols] sections in INF 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 # This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this # under the terms and conditions of the BSD License which accompanies this
@ -217,8 +217,9 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
for Line in SectionString: for Line in SectionString:
LineContent = Line[0] LineContent = Line[0]
if LineContent.strip() == '': # Comment the code to support user extension without any statement just the section header in []
continue # if LineContent.strip() == '':
# continue
UserExtensionContent += LineContent + DT.END_OF_LINE UserExtensionContent += LineContent + DT.END_OF_LINE
continue continue

View File

@ -2,7 +2,7 @@
# #
# This file is the main entry for UPT # 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 # This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this # 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()) Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
return XExcept.args[0] return XExcept.args[0]
# Start *********************************************
# Support WORKSPACE is a long path # Support WORKSPACE is a long path
# Only work well on windows # Only works for windows system
# Linux Solution TBD
if pf.system() == 'Windows': if pf.system() == 'Windows':
os.system('@echo off\nsubst b: /D') Vol = 'B:'
os.system('subst b: "%s"' % GlobalData.gWORKSPACE) for Index in range(90, 65, -1):
GlobalData.gWORKSPACE = 'B:\\' Vol = chr(Index) + ':'
# End *********************************************** if not os.path.isdir(Vol):
os.system('subst %s "%s"' % (Vol, GlobalData.gWORKSPACE))
break
GlobalData.gWORKSPACE = '%s\\' % Vol
WorkspaceDir = GlobalData.gWORKSPACE WorkspaceDir = GlobalData.gWORKSPACE
@ -304,8 +305,9 @@ def Main():
except StandardError: except StandardError:
Logger.Quiet(ST.MSG_RECOVER_FAIL) Logger.Quiet(ST.MSG_RECOVER_FAIL)
GlobalData.gDB.CloseDb() GlobalData.gDB.CloseDb()
if pf.system() == 'Windows': if pf.system() == 'Windows':
os.system('subst b: /D') os.system('subst %s /D' % GlobalData.gWORKSPACE.replace('\\',''))
return ReturnCode return ReturnCode