[edk2] [PATCH V2] BaseTools:GenMakeFile Complete the task using CC Tool multithreading
CC_FLAGS "/Mp" enables multithreading with CC Tool. In order to adapt to this change, I made some changes to other tools Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Conf/build_rule.template | 2 +- BaseTools/Conf/tools_def.template | 48 - BaseTools/Source/Python/AutoGen/GenMake.py | 83 +++--- 3 files changed, 101 insertions(+), 32 deletions(-) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index e56b1d9c59..4fc042f457 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -129,7 +129,7 @@ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj -"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src} +"$(CC)" /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src} # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index abda2164a6..f65df7dbd9 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -1810,9 +1810,9 @@ NOOPT_VS2012xASL_X64_DLINK_FLAGS= /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:RE *_VS2012x86_IA32_ASM_PATH = DEF(VS2012x86_BIN)\ml.exe *_VS2012x86_IA32_MAKE_FLAGS = /nologo - DEBUG_VS2012x86_IA32_CC_FLAGS= /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 -RELEASE_VS2012x86_IA32_CC_FLAGS= /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF -NOOPT_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od + DEBUG_VS2012x86_IA32_CC_FLAGS= /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /MP1 +RELEASE_VS2012x86_IA32_CC_FLAGS= /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /MP1 +NOOPT_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od /MP1 DEBUG_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi RELEASE_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd @@ -1842,9 +1842,9 @@ NOOPT_VS2012x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF *_VS2012x86_X64_DLINK_PATH= DEF(VS2012x86_BINX64)\link.exe *_VS2012x86_X64_ASLDLINK_PATH = DEF(VS2012x86_BINX64)\link.exe - DEBUG_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 -RELEASE_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF -NOOPT_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od + DEBUG_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /MP1 +RELEASE_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /MP1 +NOOPT_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od /MP1 DEBUG_VS2012x86_X64_ASM_FLAGS= /nologo /c /WX /W3 /Cx /Zd /Zi RELEASE_VS2012x86_X64_ASM_FLAGS= /nologo /c /WX /W3 /Cx /Zd @@ -2276,9 +2276,9 @@ NOOPT_VS2013xASL_X64_DLINK_FLAGS= /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:RE *_VS2013x86_IA32_ASM_PATH = DEF(VS2013x86_BIN)\ml.exe *_VS2013x86_IA32_MAKE_FLAGS = /nologo - DEBUG_VS2013x86_IA32_CC_FLAGS= /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw -RELEASE_VS2013x86_IA32_CC_FLAGS= /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw -NOOPT_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od + DEBUG_VS2013x86_IA32_CC_FLAGS= /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw /MP1 +RELEASE_VS2013x86_IA32_CC_FLAGS= /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /MP1 +NOOPT_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od /MP1 DEBUG_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi RELEASE_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd @@ -2308,9 +2308,9 @@ NOOPT_VS2013x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF *_VS2013x86_X64_DLINK_PATH= DEF(VS2013x86_BINX64)\link.exe *_VS2013x86_X64_ASLDLINK_PATH = DEF(VS2013x86_BINX64)\link.exe - DEBUG_VS2013x86_X64_CC_FL
[edk2] [PATCH] BaseTools:Coding problems caused by special characters
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1670 During BaseTools compiling under Chinese or Japanese language Windows, python exception occurring. UnicodeDecodeError: 'ascii' codec can't decode byte 0xbd in position 3528: ordinal not in range(128) Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/C/Makefiles/NmakeSubdirs.py | 2 +- BaseTools/Source/Python/Capsule/GenerateCapsule.py| 8 BaseTools/Source/Python/Common/Misc.py| 2 +- BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py| 2 +- .../Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/BaseTools/Source/C/Makefiles/NmakeSubdirs.py b/BaseTools/Source/C/Makefiles/NmakeSubdirs.py index 29bb5dfa72..abcbea89a4 100644 --- a/BaseTools/Source/C/Makefiles/NmakeSubdirs.py +++ b/BaseTools/Source/C/Makefiles/NmakeSubdirs.py @@ -44,7 +44,7 @@ def RunCommand(WorkDir=None, *Args, **kwargs): stdout, stderr = p.communicate() message = "" if stdout is not None: -message = stdout.decode() #for compatibility in python 2 and 3 +message = stdout.decode(encoding='utf-8', errors='ignore') #for compatibility in python 2 and 3 if p.returncode != 0: raise RuntimeError("Error while execute command \'{0}\' in direcotry {1}\n{2}".format(" ".join(Args), WorkDir, message)) diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/BaseTools/Source/Python/Capsule/GenerateCapsule.py index 7b08918857..5ce5daef68 100644 --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py @@ -94,7 +94,7 @@ def SignPayloadSignTool (Payload, ToolPath, PfxFile): if Process.returncode != 0: shutil.rmtree (TempDirectoryName) -print (Result[1].decode()) +print (Result[1].decode(encoding='utf-8', errors='ignore')) raise ValueError ('GenerateCapsule: error: signtool failed.') # @@ -132,12 +132,12 @@ def SignPayloadOpenSsl (Payload, ToolPath, SignerPrivateCertFile, OtherPublicCer try: Process = subprocess.Popen (Command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True) Result = Process.communicate(input = Payload) -Signature = Result[0] +Signature = Result[0].decode(encoding='utf-8', errors='ignore') except: raise ValueError ('GenerateCapsule: error: can not run openssl.') if Process.returncode != 0: -print (Result[1].decode()) +print (Result[1].decode(encoding='utf-8', errors='ignore')) raise ValueError ('GenerateCapsule: error: openssl failed.') return Signature @@ -186,7 +186,7 @@ def VerifyPayloadOpenSsl (Payload, CertData, ToolPath, SignerPrivateCertFile, Ot if Process.returncode != 0: shutil.rmtree (TempDirectoryName) -print (Result[1].decode()) +print (Result[1].decode(encoding='utf-8', errors='ignore')) raise ValueError ('GenerateCapsule: error: openssl failed.') shutil.rmtree (TempDirectoryName) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index c7daf5417c..47f8e45222 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1032,7 +1032,7 @@ def ParseFieldValue (Value): p.stderr.close() if err: raise BadExpression("DevicePath: %s" % str(err)) -out = out.decode() +out = out.decode(encoding='utf-8', errors='ignore') Size = len(out.split()) out = ','.join(out.split()) return '{' + out + '}', Size diff --git a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py index 003f052a90..706bf28e14 100644 --- a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py +++ b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py @@ -122,7 +122,7 @@ if __name__ == '__main__': if Process.returncode != 0: print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH') sys.exit(Process.returncode) - print(Version[0].decode()) + print(Version[0].decode(encoding='utf-8', errors='ignore')) # # Read input file into a buffer and save input filename diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py index c0b661d03c..3cc14e3bb9 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py @@ -84,7 +84,7 @@ if __name__ == '__main__': if Process.returncode != 0: print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH') sys.exit(Pro
[edk2] [PATCH V3] BaseTools:Trim will trig exception when input asl UTF8 format file
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1641 The command trim --asl-file -o test.i UTF8.asl will trig the exception. There's a problem with the encoding of the file,it only appears in python3. I changed the way I opened it to support reading this file Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Trim/Trim.py | 44 +--- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py index 228779b5a9..05feab6abe 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -18,7 +18,7 @@ import Common.LongFilePathOs as os import sys import re from io import BytesIO - +import codecs from optparse import OptionParser from optparse import make_option from Common.BuildToolError import * @@ -77,14 +77,11 @@ gIncludedAslFile = [] def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): CreateDirectory(os.path.dirname(Target)) try: -f = open (Source, 'r') +with open(Source, "r") as File: +Lines = File.readlines() except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) -# read whole file -Lines = f.readlines() -f.close() - PreprocessedFile = "" InjectedFile = "" LineIndexOfOriginalFile = None @@ -181,11 +178,10 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): # save to file try: -f = open (Target, 'w') +with open(Target, 'w') as File: +File.writelines(NewLines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(NewLines) -f.close() ## Trim preprocessed VFR file # @@ -199,12 +195,11 @@ def TrimPreprocessedVfr(Source, Target): CreateDirectory(os.path.dirname(Target)) try: -f = open (Source, 'r') +with open(Source, "r") as File: +Lines = File.readlines() except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) # read whole file -Lines = f.readlines() -f.close() FoundTypedef = False Brace = 0 @@ -248,11 +243,10 @@ def TrimPreprocessedVfr(Source, Target): # save all lines trimmed try: -f = open (Target, 'w') +with open(Target, 'w') as File: +File.writelines(Lines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(Lines) -f.close() ## Read the content ASL file, including ASL included, recursively # @@ -278,7 +272,12 @@ def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None): for IncludePath in SearchPathList: IncludeFile = os.path.join(IncludePath, Source) if os.path.isfile(IncludeFile): -F = open(IncludeFile, "r") +try: +with open(IncludeFile, "r") as File: +F = File.readlines() +except: +with codecs.open(IncludeFile, "r", encoding='utf-8') as File: +F = File.readlines() break else: EdkLogger.error("Trim", "Failed to find include file %s" % Source) @@ -313,7 +312,6 @@ def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None): NewFileContent.append("\n") gIncludedAslFile.pop() -F.close() return NewFileContent @@ -345,7 +343,9 @@ def TrimAslFile(Source, Target, IncludePathFile): if IncludePathFile: try: LineNum = 0 -for Line in open(IncludePathFile, 'r'): +with open(IncludePathFile, 'r') as File: +FileLines = File.readlines() +for Line in FileLines: LineNum += 1 if Line.startswith("/I") or Line.startswith ("-I"): IncludePathList.append(Line[2:].strip()) @@ -363,13 +363,11 @@ def TrimAslFile(Source, Target, IncludePathFile): # save all lines trimmed try: -f = open (Target, 'w') +with open(Target, 'w') as File: +File.writelines(Lines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(Lines) -f.close() - def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): VfrNameList = [] if os.path.isdir(DebugDir): @@ -389,7 +387,7 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): return try: -fInputfile = open(OutputFile, "wb+", 0) +fInputfile = open(OutputFile, "wb+") except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, "File open failed for %s" %OutputFile, None) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listin
[edk2] [PATCH V2] BaseTools:Trim will trig exception when input asl UTF8 format file
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1641 The command trim --asl-file -o test.i UTF8.asl will trig the exception. Trim tool should report error message for unsupported UTF8 file instead of the exception. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Trim/Trim.py | 44 +--- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py index 228779b5a9..05feab6abe 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -18,7 +18,7 @@ import Common.LongFilePathOs as os import sys import re from io import BytesIO - +import codecs from optparse import OptionParser from optparse import make_option from Common.BuildToolError import * @@ -77,14 +77,11 @@ gIncludedAslFile = [] def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): CreateDirectory(os.path.dirname(Target)) try: -f = open (Source, 'r') +with open(Source, "r") as File: +Lines = File.readlines() except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) -# read whole file -Lines = f.readlines() -f.close() - PreprocessedFile = "" InjectedFile = "" LineIndexOfOriginalFile = None @@ -181,11 +178,10 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): # save to file try: -f = open (Target, 'w') +with open(Target, 'w') as File: +File.writelines(NewLines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(NewLines) -f.close() ## Trim preprocessed VFR file # @@ -199,12 +195,11 @@ def TrimPreprocessedVfr(Source, Target): CreateDirectory(os.path.dirname(Target)) try: -f = open (Source, 'r') +with open(Source, "r") as File: +Lines = File.readlines() except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) # read whole file -Lines = f.readlines() -f.close() FoundTypedef = False Brace = 0 @@ -248,11 +243,10 @@ def TrimPreprocessedVfr(Source, Target): # save all lines trimmed try: -f = open (Target, 'w') +with open(Target, 'w') as File: +File.writelines(Lines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(Lines) -f.close() ## Read the content ASL file, including ASL included, recursively # @@ -278,7 +272,12 @@ def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None): for IncludePath in SearchPathList: IncludeFile = os.path.join(IncludePath, Source) if os.path.isfile(IncludeFile): -F = open(IncludeFile, "r") +try: +with open(IncludeFile, "r") as File: +F = File.readlines() +except: +with codecs.open(IncludeFile, "r", encoding='utf-8') as File: +F = File.readlines() break else: EdkLogger.error("Trim", "Failed to find include file %s" % Source) @@ -313,7 +312,6 @@ def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None): NewFileContent.append("\n") gIncludedAslFile.pop() -F.close() return NewFileContent @@ -345,7 +343,9 @@ def TrimAslFile(Source, Target, IncludePathFile): if IncludePathFile: try: LineNum = 0 -for Line in open(IncludePathFile, 'r'): +with open(IncludePathFile, 'r') as File: +FileLines = File.readlines() +for Line in FileLines: LineNum += 1 if Line.startswith("/I") or Line.startswith ("-I"): IncludePathList.append(Line[2:].strip()) @@ -363,13 +363,11 @@ def TrimAslFile(Source, Target, IncludePathFile): # save all lines trimmed try: -f = open (Target, 'w') +with open(Target, 'w') as File: +File.writelines(Lines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(Lines) -f.close() - def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): VfrNameList = [] if os.path.isdir(DebugDir): @@ -389,7 +387,7 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): return try: -fInputfile = open(OutputFile, "wb+", 0) +fInputfile = open(OutputFile, "wb+") except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, "File open failed for %s" %OutputFile, None) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Trim will trig exception when input asl UTF8 format file
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1641 The command trim --asl-file -o test.i UTF8.asl will trig the exception. Trim tool should report error message for unsupported UTF8 file instead of the exception. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Trim/Trim.py | 40 +++- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py index 825ed3e5d5..13d537f5aa 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -18,7 +18,7 @@ import Common.LongFilePathOs as os import sys import re from io import BytesIO - +import codecs from optparse import OptionParser from optparse import make_option from Common.BuildToolError import * @@ -141,14 +141,11 @@ gIncludedAslFile = [] def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): CreateDirectory(os.path.dirname(Target)) try: -f = open (Source, 'r') +with codecs.open(Source, "r", encoding="utf-8") as File: +Lines = File.readlines() except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) -# read whole file -Lines = f.readlines() -f.close() - PreprocessedFile = "" InjectedFile = "" LineIndexOfOriginalFile = None @@ -245,11 +242,10 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): # save to file try: -f = open (Target, 'w') +with codecs.open(Target, 'w', encoding="utf-8") as File: +File.writelines(Lines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(NewLines) -f.close() ## Trim preprocessed VFR file # @@ -263,12 +259,11 @@ def TrimPreprocessedVfr(Source, Target): CreateDirectory(os.path.dirname(Target)) try: -f = open (Source, 'r') +with codecs.open(Source, "r", encoding="utf-8") as File: +Lines = File.readlines() except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) # read whole file -Lines = f.readlines() -f.close() FoundTypedef = False Brace = 0 @@ -312,11 +307,10 @@ def TrimPreprocessedVfr(Source, Target): # save all lines trimmed try: -f = open (Target, 'w') +with codecs.open(Target, 'w', encoding="utf-8") as File: +File.writelines(Lines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(Lines) -f.close() ## Read the content ASL file, including ASL included, recursively # @@ -342,7 +336,8 @@ def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None): for IncludePath in SearchPathList: IncludeFile = os.path.join(IncludePath, Source) if os.path.isfile(IncludeFile): -F = open(IncludeFile, "r") +with codecs.open(IncludeFile, "r", encoding="utf-8") as File: +F = File.readlines() break else: EdkLogger.error("Trim", "Failed to find include file %s" % Source) @@ -377,7 +372,6 @@ def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None): NewFileContent.append("\n") gIncludedAslFile.pop() -F.close() return NewFileContent @@ -409,7 +403,9 @@ def TrimAslFile(Source, Target, IncludePathFile): if IncludePathFile: try: LineNum = 0 -for Line in open(IncludePathFile, 'r'): +with codecs.open(IncludePathFile, 'r', encoding="utf-8") as File: +FileLines = File.readlines() +for Line in FileLines: LineNum += 1 if Line.startswith("/I") or Line.startswith ("-I"): IncludePathList.append(Line[2:].strip()) @@ -427,13 +423,11 @@ def TrimAslFile(Source, Target, IncludePathFile): # save all lines trimmed try: -f = open (Target, 'w') +with codecs.open(Target, 'w', encoding="utf-8") as File: +File.writelines(Lines) except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) -f.writelines(Lines) -f.close() - def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): VfrNameList = [] if os.path.isdir(DebugDir): @@ -453,7 +447,7 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): return try: -fInputfile = open(OutputFile, "wb+", 0) +fInputfile = open(OutputFile, "wb+") except: EdkLogger.error("Trim", FILE_OPEN_FAILURE, "File open failed for %s" %OutputFile, None) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] FW: [PATCH] BaseTools:Guid.xref will change after increment build
Hi: The items to be added to the PcdList are "(PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy5)" "Dummy5" can distinguish PCDS with the same name, So the results are consistent except for the order change. Any question, please let me know. Thanks. Best Regards Fan Zhiju -Original Message- From: Feng, Bob C Sent: Tuesday, March 5, 2019 5:48 PM To: Fan, ZhijuX ; edk2-devel@lists.01.org Cc: Gao, Liming Subject: RE: [edk2][PATCH] BaseTools:Guid.xref will change after increment build Hi Zhiju, Since you changed a set() to a list, I think you need to check if the item is already in the list before appending it. Thanks, Bob -Original Message----- From: Fan, ZhijuX Sent: Tuesday, March 5, 2019 4:48 PM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Feng, Bob C Subject: [edk2][PATCH] BaseTools:Guid.xref will change after increment build the order of the data may change if set() is used Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Workspace/DscBuildData.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 5e7d7dcd63..342b9472a2 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1654,7 +1654,7 @@ class DscBuildData(PlatformBuildClassObject): AvailableSkuIdSet = copy.copy(self.SkuIds) PcdDict = tdict(True, 4) -PcdSet = set() +PcdList = [] # Find out all possible PCD candidates for self._Arch RecordList = self._RawData[Type, self._Arch] PcdValueDict = OrderedDict() @@ -1666,10 +1666,10 @@ class DscBuildData(PlatformBuildClassObject): File=self.MetaFile, Line=Dummy5) if SkuName in (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT, TAB_COMMON): if "." not in TokenSpaceGuid and "[" not in PcdCName: -PcdSet.add((PcdCName, TokenSpaceGuid, SkuName, Dummy5)) +PcdList.append((PcdCName, TokenSpaceGuid, SkuName, + Dummy5)) PcdDict[Arch, PcdCName, TokenSpaceGuid, SkuName] = Setting -for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdSet: +for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList: Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid, SkuName] if Setting is None: continue @@ -2874,7 +2874,7 @@ class DscBuildData(PlatformBuildClassObject): # PCD settings for certain ARCH and SKU # PcdDict = tdict(True, 5) -PcdSet = set() +PcdList = [] RecordList = self._RawData[Type, self._Arch] # Find out all possible PCD candidates for self._Arch AvailableSkuIdSet = copy.copy(self.SkuIds) @@ -2896,12 +2896,12 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('build', PARAMETER_INVALID, 'DefaultStores %s is not defined in [DefaultStores] section' % DefaultStore, File=self.MetaFile, Line=Dummy5) if "." not in TokenSpaceGuid and "[" not in PcdCName: -PcdSet.add((PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy5)) +PcdList.append((PcdCName, TokenSpaceGuid, SkuName, + DefaultStore, Dummy5)) PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] = Setting # Remove redundant PCD candidates, per the ARCH and SKU -for PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4 in PcdSet: +for PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4 in PcdList: Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] if Setting is None: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Guid.xref will change after increment build
the order of the data may change if set() is used Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Workspace/DscBuildData.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 5e7d7dcd63..342b9472a2 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1654,7 +1654,7 @@ class DscBuildData(PlatformBuildClassObject): AvailableSkuIdSet = copy.copy(self.SkuIds) PcdDict = tdict(True, 4) -PcdSet = set() +PcdList = [] # Find out all possible PCD candidates for self._Arch RecordList = self._RawData[Type, self._Arch] PcdValueDict = OrderedDict() @@ -1666,10 +1666,10 @@ class DscBuildData(PlatformBuildClassObject): File=self.MetaFile, Line=Dummy5) if SkuName in (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT, TAB_COMMON): if "." not in TokenSpaceGuid and "[" not in PcdCName: -PcdSet.add((PcdCName, TokenSpaceGuid, SkuName, Dummy5)) +PcdList.append((PcdCName, TokenSpaceGuid, SkuName, Dummy5)) PcdDict[Arch, PcdCName, TokenSpaceGuid, SkuName] = Setting -for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdSet: +for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList: Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid, SkuName] if Setting is None: continue @@ -2874,7 +2874,7 @@ class DscBuildData(PlatformBuildClassObject): # PCD settings for certain ARCH and SKU # PcdDict = tdict(True, 5) -PcdSet = set() +PcdList = [] RecordList = self._RawData[Type, self._Arch] # Find out all possible PCD candidates for self._Arch AvailableSkuIdSet = copy.copy(self.SkuIds) @@ -2896,12 +2896,12 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('build', PARAMETER_INVALID, 'DefaultStores %s is not defined in [DefaultStores] section' % DefaultStore, File=self.MetaFile, Line=Dummy5) if "." not in TokenSpaceGuid and "[" not in PcdCName: -PcdSet.add((PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy5)) +PcdList.append((PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy5)) PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] = Setting # Remove redundant PCD candidates, per the ARCH and SKU -for PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4 in PcdSet: +for PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4 in PcdList: Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] if Setting is None: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V2] BaseTools:Run packagedoc_cli.py to generate doc failed
The reason for this problem is that the file was opened incorrectly. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- .../plugins/EdkPlugins/edk2/model/doxygengen.py| 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py index e31df262bc..73349e2f48 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py @@ -376,9 +376,10 @@ class PackageDocumentAction(DoxygenAction): return try: -f = open(path, 'r') -lines = f.readlines() -f.close() +with open(path, 'r') as f: +lines = f.readlines() +except UnicodeDecodeError: +return except IOError: ErrorMsg('Fail to open file %s' % path) return -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Run packagedoc_cli.py to generate doc failed
The reason for this problem is that the file was opened incorrectly. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- .../plugins/EdkPlugins/edk2/model/doxygengen.py| 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py index e31df262bc..f5a62f6c6f 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py @@ -376,9 +376,13 @@ class PackageDocumentAction(DoxygenAction): return try: -f = open(path, 'r') -lines = f.readlines() -f.close() +with open(path, 'r') as f: +lines = f.readlines() +except UnicodeDecodeError: +with open(path, 'rb') as f: +lines = f.readlines() +for Index, Line in enumerate(lines[:]): +lines[Index] = str(Line)[2:-1] except IOError: ErrorMsg('Fail to open file %s' % path) return -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Some StructurePcd DecValue is redundant.
Defined 2 PCDs(Test4 & Test401) and 2 SKUs(DEFAULT & _), then set "SKUID_Defines" to ALL, for FixedAtBuild gEfiStructuredPcdPkgTokenSpaceGuid. Test401 in this case, its value should get from "Default" SKU, not from "_" SKU, but we does not set value in SKU "_" in dsc, so Test401 should only display the value get from dec. PCD value get from Dec file, so no *P and no DEC default value should be display in report. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/build/BuildReport.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 65b2979c42..2879545f60 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1107,7 +1107,10 @@ class PcdReport(object): DscOverride = False else: if not Pcd.SkuInfoList: -OverrideValues = Pcd.SkuOverrideValues +if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.gPcdSkuOverrides: +OverrideValues = GlobalData.gPcdSkuOverrides[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)] +else: +OverrideValues = Pcd.SkuOverrideValues if OverrideValues: for Data in OverrideValues.values(): Struct = list(Data.values()) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:The BOM character is processed when python reads a file
When python3 reads an XML file it will parse the file in error if the file has a BOM Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py index 4294016ae3..00cbc4e55e 100644 --- a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py +++ b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py @@ -17,6 +17,7 @@ # from __future__ import print_function import xml.dom.minidom +import codecs from Common.LongFilePathSupport import OpenLongFilePath as open ## Create a element of XML @@ -211,7 +212,7 @@ def XmlNodeName(Dom): # def XmlParseFile(FileName): try: -XmlFile = open(FileName) +XmlFile = codecs.open(FileName,encoding='utf_8_sig') Dom = xml.dom.minidom.parse(XmlFile) XmlFile.close() return Dom -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V2] BaseTools:PackageDocumentTools import lib error occurs.
Steps: 1. Download edk2 tree 2. Build BaseTools 3. Go to edk2\BaseTools\Scripts\PackageDocumentTools to run packagedoc_cli.py An error occurs if relative imports are used when running a file alone Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py | 4 ++-- .../plugins/EdkPlugins/basemodel/doxygen.py| 2 +- .../plugins/EdkPlugins/basemodel/ini.py| 4 ++-- .../plugins/EdkPlugins/edk2/model/baseobject.py| 14 +++--- .../plugins/EdkPlugins/edk2/model/dec.py | 4 ++-- .../plugins/EdkPlugins/edk2/model/doxygengen.py| 8 .../plugins/EdkPlugins/edk2/model/doxygengen_spec.py | 8 .../plugins/EdkPlugins/edk2/model/dsc.py | 4 ++-- .../plugins/EdkPlugins/edk2/model/inf.py | 4 ++-- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py index e404a07cd7..5c65842a72 100644 --- a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py +++ b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py @@ -16,8 +16,8 @@ from __future__ import print_function import os, sys, logging, traceback, subprocess from optparse import OptionParser -from .plugins.EdkPlugins.edk2.model import baseobject -from .plugins.EdkPlugins.edk2.model import doxygengen +from plugins.EdkPlugins.edk2.model import baseobject +from plugins.EdkPlugins.edk2.model import doxygengen gArchMarcoDict = {'ALL' : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER', 'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS', diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py index ae47ff1344..a510808842 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py @@ -92,7 +92,7 @@ class Page(BaseDoxygeItem): self.mText.insert(endIndex, '') endIndex += 1 if self.mIsSort: -self.mSubPages.sort(cmp=lambda x, y: cmp(x.mName.lower(), y.mName.lower())) +self.mSubPages.sort(key=lambda x: x.mName.lower()) for page in self.mSubPages: self.mText.insert(endIndex, '\subpage %s \"%s\" ' % (page.mTag, page.mName)) endIndex += 1 diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py index 6e6f3f4b97..bac2f5e2e6 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py @@ -25,7 +25,7 @@ class BaseINIFile(object): @return: instance of this class """ -if len(args) == 0: return object.__new__(cls, *args, **kwargs) +if len(args) == 0: return object.__new__(cls) filename = args[0] parent = None if len(args) > 1: @@ -33,7 +33,7 @@ class BaseINIFile(object): key = os.path.normpath(filename) if key not in cls._objs.keys(): -cls._objs[key] = object.__new__(cls, *args, **kwargs) +cls._objs[key] = object.__new__(cls) if parent is not None: cls._objs[key].AddParent(parent) diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py index 0159bd5269..7b47fd76b9 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py @@ -10,12 +10,12 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -from ...basemodel import ini -from ...edk2.model import dsc -from ...edk2.model import inf -from ...edk2.model import dec +from plugins.EdkPlugins.basemodel import ini +from plugins.EdkPlugins.edk2.model import dsc +from plugins.EdkPlugins.edk2.model import inf +from plugins.EdkPlugins.edk2.model import dec import os -from ...basemodel.message import * +from plugins.EdkPlugins.basemodel.message import * class SurfaceObject(object): _objs = {} @@ -25,7 +25,7 @@ class SurfaceObject(object): @return: instance of this class """ -obj = object.__new__(cls, *args, **kwargs) +obj = object.__new__(cls) if "None" not in cls._objs:
[edk2] [PATCH] BaseTools:PackageDocumentTools import lib error occurs.
Steps: 1. Download edk2 tree 2. Build BaseTools 3. Go to edk2\BaseTools\Scripts\PackageDocumentTools to run packagedoc_cli.py An error occurs if relative imports are used when running a file alone Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py | 4 ++-- .../plugins/EdkPlugins/edk2/model/baseobject.py| 10 +- .../PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py | 4 ++-- .../plugins/EdkPlugins/edk2/model/doxygengen.py| 8 .../plugins/EdkPlugins/edk2/model/doxygengen_spec.py | 8 .../PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py | 4 ++-- .../PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py index e404a07cd7..5c65842a72 100644 --- a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py +++ b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py @@ -16,8 +16,8 @@ from __future__ import print_function import os, sys, logging, traceback, subprocess from optparse import OptionParser -from .plugins.EdkPlugins.edk2.model import baseobject -from .plugins.EdkPlugins.edk2.model import doxygengen +from plugins.EdkPlugins.edk2.model import baseobject +from plugins.EdkPlugins.edk2.model import doxygengen gArchMarcoDict = {'ALL' : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER', 'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS', diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py index 0159bd5269..de15efd3f8 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py @@ -10,12 +10,12 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -from ...basemodel import ini -from ...edk2.model import dsc -from ...edk2.model import inf -from ...edk2.model import dec +from plugins.EdkPlugins.basemodel import ini +from plugins.EdkPlugins.edk2.model import dsc +from plugins.EdkPlugins.edk2.model import inf +from plugins.EdkPlugins.edk2.model import dec import os -from ...basemodel.message import * +from plugins.EdkPlugins.basemodel.message import * class SurfaceObject(object): _objs = {} diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py index 3d210f72ac..568076547b 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py @@ -11,9 +11,9 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -from ...basemodel import ini +from plugins.EdkPlugins.basemodel import ini import re, os -from ...basemodel.message import * +from plugins.EdkPlugins.basemodel.message import * class DECFile(ini.BaseINIFile): diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py index 9c299fbfc5..e31df262bc 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py @@ -16,7 +16,7 @@ """This file produce action class to generate doxygen document for edk2 codebase. The action classes are shared by GUI and command line tools. """ -from ...basemodel import doxygen +from plugins.EdkPlugins.basemodel import doxygen import os try: import wx @@ -24,9 +24,9 @@ try: except: gInGui = False import re -from ...edk2.model import inf -from ...edk2.model import dec -from ...basemodel.message import * +from plugins.EdkPlugins.edk2.model import inf +from plugins.EdkPlugins.edk2.model import dec +from plugins.EdkPlugins.basemodel.message import * _ignore_dir = ['.svn', '_svn', 'cvs'] _inf_key_description_mapping_table = { diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py index 3a862a92ea..279b7fb8d4 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py @@ -13,7 +13,7 @@ # THE PRO
[edk2] [PATCH] BaseTools:Some build generated files content are not ordered on linux
If the WORKSPACE environment variable has been set,The variables that control stable sorting will not be set. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- edksetup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edksetup.sh b/edksetup.sh index a8897d10f8..39f62a29bd 100755 --- a/edksetup.sh +++ b/edksetup.sh @@ -49,6 +49,7 @@ function SetWorkspace() # # If WORKSPACE is already set, then we can return right now # + export PYTHONHASHSEED=1 if [ -n "$WORKSPACE" ] then return 0 @@ -77,7 +78,6 @@ function SetWorkspace() # Set $WORKSPACE # export WORKSPACE=`pwd` - export PYTHONHASHSEED=1 return 0 } -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Build fail if define [DEPEX] in library inf
When define [DEPEX] in lib inf to build, it will fail and report" gUefiOvmfPkgTokenSpaceGuid.test1 used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module." But we define this PCD to FixedAtBuild type and VOID* datum type indeed. DEC: [PcdsFixedAtBuild] gUefiOvmfPkgTokenSpaceGuid.test1 | {GUID("4096267b-da0a-42eb-b5eb-fef31d207cb4")}|VOID*|0x3c DSC: add pcd under lib inf as below: NULL|TestPkg/TestLib/TestLib.inf gUefiOvmfPkgTokenSpaceGuid.test1 | {GUID(gUefiOvmfPkgTokenSpaceGuid)} Lib inf:(TestPkg/TestLib/TestLib.inf) [Depex] gUefiOvmfPkgTokenSpaceGuid.test1 [FixedPcd] gUefiOvmfPkgTokenSpaceGuid.test1 Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/AutoGen.py | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 2452ecbcba..81361559b3 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2892,10 +2892,16 @@ class ModuleAutoGen(AutoGen): if '.' not in item: NewList.append(item) else: -if item not in self.FixedVoidTypePcds: +FixedVoidTypePcds = {} +if item in self.FixedVoidTypePcds: +FixedVoidTypePcds = self.FixedVoidTypePcds +elif M in self.PlatformInfo.LibraryAutoGenList: +Index = self.PlatformInfo.LibraryAutoGenList.index(M) +FixedVoidTypePcds = self.PlatformInfo.LibraryAutoGenList[Index].FixedVoidTypePcds +if item not in FixedVoidTypePcds: EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item)) else: -Value = self.FixedVoidTypePcds[item] +Value = FixedVoidTypePcds[item] if len(Value.split(',')) != 16: EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item)) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Build fail if define [DEPEX] in library inf
When define [DEPEX] in lib inf to build, it will fail and report" gUefiOvmfPkgTokenSpaceGuid.test1 used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module." But we define this PCD to FixedAtBuild type and VOID* datum type indeed. DEC: [PcdsFixedAtBuild] gUefiOvmfPkgTokenSpaceGuid.test1 | {GUID("4096267b-da0a-42eb-b5eb-fef31d207cb4")}|VOID*|0x3c DSC: add pcd under lib inf as below: NULL|TestPkg/TestLib/TestLib.inf gUefiOvmfPkgTokenSpaceGuid.test1 | {GUID(gUefiOvmfPkgTokenSpaceGuid)} Lib inf:(TestPkg/TestLib/TestLib.inf) [Depex] gUefiOvmfPkgTokenSpaceGuid.test1 [FixedPcd] gUefiOvmfPkgTokenSpaceGuid.test1 Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/AutoGen.py | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 2452ecbcba..e64be656e8 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2892,10 +2892,16 @@ class ModuleAutoGen(AutoGen): if '.' not in item: NewList.append(item) else: -if item not in self.FixedVoidTypePcds: +FixedVoidTypePcds = {} +if M in self.PlatformInfo.LibraryAutoGenList: +Index = self.PlatformInfo.LibraryAutoGenList.index(M) +FixedVoidTypePcds = self.PlatformInfo.LibraryAutoGenList[Index].FixedVoidTypePcds +if item in self.FixedVoidTypePcds: +FixedVoidTypePcds = self.FixedVoidTypePcds +if item not in FixedVoidTypePcds: EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item)) else: -Value = self.FixedVoidTypePcds[item] +Value = FixedVoidTypePcds[item] if len(Value.split(',')) != 16: EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item)) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Fixed build failure when specifying multiple BUILDTARGET
With Python3, the dict.value() method returns an iterator. If a dictionary is updated while an iterator on its keys is used, a RuntimeError is generated. Converting the iterator to a list() forces a copy of the mutable keys in an immutable list which can be safely iterated. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 2452ecbcba..7969e46d87 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -580,7 +580,7 @@ class WorkspaceAutoGen(AutoGen): if NewPcd2 not in GlobalData.MixedPcd[item]: GlobalData.MixedPcd[item].append(NewPcd2) -for BuildData in PGen.BuildDatabase._CACHE_.values(): +for BuildData in list(PGen.BuildDatabase._CACHE_.values()): if BuildData.Arch != Arch: continue for key in BuildData.Pcds: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V3] BaseTools:BaseTools supports to the driver combination.
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1520 To save the image size without the compression, more than one drivers can be combined into single one. When more than one drivers are combined, their depex will be AND together. Below is the example to combine BootManagerPolicyDxe into DriverHealthManagerDxe. Besides this patch, BaseTools also needs to check the module type and make sure all module type are same. Otherwise, BaseTools will report the error. DRIVER INF has the parameter ENTRY_POINT LIBRARY INF has the parameter LIBRARY_CLASS Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenC.py| 32 ++ .../Source/Python/Workspace/WorkspaceCommon.py | 8 ++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 9700bf8527..e6fc5cda3c 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1455,10 +1455,25 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH): def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]: return +ModuleEntryPointList = [] +for Lib in Info.DependentLibraryList: +if len(Lib.ModuleEntryPointList) > 0: +if Lib.ModuleType == Info.ModuleType: +ModuleEntryPointList = ModuleEntryPointList + Lib.ModuleEntryPointList +else: +EdkLogger.error( +"build", +PREBUILD_ERROR, +"Driver's ModuleType must be consistent [%s]"%(str(Lib)), +File=str(Info.PlatformInfo), +ExtraData="consumed by [%s]" % str(Info.MetaFile) +) +ModuleEntryPointList = ModuleEntryPointList + Info.Module.ModuleEntryPointList + # # Module Entry Points # -NumEntryPoints = len(Info.Module.ModuleEntryPointList) +NumEntryPoints = len(ModuleEntryPointList) if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification: PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION'] else: @@ -1468,7 +1483,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): else: UefiSpecVersion = '0x' Dict = { -'Function' : Info.Module.ModuleEntryPointList, +'Function' : ModuleEntryPointList, 'PiSpecVersion' : PiSpecVersion + 'U', 'UefiSpecVersion': UefiSpecVersion + 'U' } @@ -1481,7 +1496,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): AUTOGEN_ERROR, '%s must have exactly one entry point' % Info.ModuleType, File=str(Info), - ExtraData= ", ".join(Info.Module.ModuleEntryPointList) + ExtraData= ", ".join(ModuleEntryPointList) ) if Info.ModuleType == SUP_MODULE_PEI_CORE: AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) @@ -1535,11 +1550,18 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]: return + +ModuleUnloadImageList = [] +for Lib in Info.DependentLibraryList: +if len(Lib.ModuleUnloadImageList) > 0: +ModuleUnloadImageList = ModuleUnloadImageList + Lib.ModuleUnloadImageList +ModuleUnloadImageList = ModuleUnloadImageList + Info.Module.ModuleUnloadImageList + # # Unload Image Handlers # -NumUnloadImage = len(Info.Module.ModuleUnloadImageList) -Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.ModuleUnloadImageList} +NumUnloadImage = len(ModuleUnloadImageList) +Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':ModuleUnloadImageList} if NumUnloadImage < 2: AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict)) else: diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py index b79280bc2e..22abda8743 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -20,6 +20,8 @@ from Workspace.BuildClassObject import StructurePcd from Common.BuildToolError import RESOURCE_NOT_AVAILABLE from Common.BuildToolError import OPTION_MISSING from Common.BuildToolError import BUILD_ERROR +from Common.BuildToolError import PREBUILD_ERROR +import Common.EdkLogger as EdkLogError class OrderedListDict(OrderedDict): def __init__(self, *args, **kwargs): @@ -138,6 +140,12 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha return []
[edk2] [PATCH] BaseTools:PCD value error in structure pcd sku case.
Defined 2 PCDs(Test4 & Test401) and 2 SKUs(DEFAULT & _), then set "SKUID_Defines" to ALL, for FixedAtBuild gEfiStructuredPcdPkgTokenSpaceGuid. Test401 in this case, its value should get from "Default" SKU, not from "_" SKU, but we does not set value in SKU "_" in dsc, so Test401 should only display the value get from dec. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/GlobalData.py | 2 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 3 +++ BaseTools/Source/Python/build/BuildReport.py | 5 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py index 5eaee06694..f117998b0b 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -103,7 +103,7 @@ MixedPcd = {} # Structure Pcd dict gStructurePcd = {} - +gPcdSkuOverrides={} # Pcd name for the Pcd which used in the Conditional directives gConditionalPcds = [] diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 1fd1639ab6..5daefe835e 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1537,6 +1537,9 @@ class DscBuildData(PlatformBuildClassObject): stru_pcd.SkuOverrideValues[skuid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStores} if DefaultStores else {}) #{TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues}) if not NoDefault: stru_pcd.ValueChain.add((skuid, '')) +if 'DEFAULT' in stru_pcd.SkuOverrideValues and not GlobalData.gPcdSkuOverrides.get((stru_pcd.TokenCName, stru_pcd.TokenSpaceGuidCName)): +GlobalData.gPcdSkuOverrides.update( +{(stru_pcd.TokenCName, stru_pcd.TokenSpaceGuidCName): {'DEFAULT':stru_pcd.SkuOverrideValues['DEFAULT']}}) if stru_pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: for skuid in SkuIds: nextskuid = skuid diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 0b98d62cb6..358fdd82d6 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1295,7 +1295,10 @@ class PcdReport(object): FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) if IsStructure: FiledOverrideFlag = False -OverrideValues = Pcd.SkuOverrideValues +if (Pcd.TokenCName,Pcd.TokenSpaceGuidCName) in GlobalData.gPcdSkuOverrides: +OverrideValues = GlobalData.gPcdSkuOverrides[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)] +else: +OverrideValues = Pcd.SkuOverrideValues if OverrideValues: for Data in OverrideValues.values(): Struct = list(Data.values()) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Fix a ECC issue
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1522 A property error occurred because the property of the function was not defined. a property is now redefined. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 2 +- BaseTools/Source/Python/Ecc/Configuration.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py index 21fed59cad..f844b4a0b3 100644 --- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py @@ -27,7 +27,7 @@ if sys.version_info.major == 3: from Ecc.CParser4.CParser import CParser else: import antlr3 as antlr -antlr.InputString = antlr.StringStream +antlr.InputStream = antlr.StringStream from Ecc.CParser3.CLexer import CLexer from Ecc.CParser3.CParser import CParser diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py index c19a3990c7..f2b2b86487 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -192,6 +192,8 @@ class Configuration(object): self.GeneralCheckLineEnding = 1 # Check if there is no trailing white space in one line. self.GeneralCheckTrailingWhiteSpaceLine = 1 + +self.CFunctionLayoutCheckNoDeprecated = 1 ## Space Checking self.SpaceCheckAll = 1 -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V2] BaseTools:BaseTools supports to the driver combination.
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1520 To save the image size without the compression, more than one drivers can be combined into single one. When more than one drivers are combined, their depex will be AND together. Below is the example to combine BootManagerPolicyDxe into DriverHealthManagerDxe. Besides this patch, BaseTools also needs to check the module type and make sure all module type are same. Otherwise, BaseTools will report the error. DRIVER INF has the parameter ENTRY_POINT LIBRARY INF has the parameter LIBRARY_CLASS Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenC.py | 32 +++- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 9700bf8527..e6fc5cda3c 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1455,10 +1455,25 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH): def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]: return +ModuleEntryPointList = [] +for Lib in Info.DependentLibraryList: +if len(Lib.ModuleEntryPointList) > 0: +if Lib.ModuleType == Info.ModuleType: +ModuleEntryPointList = ModuleEntryPointList + Lib.ModuleEntryPointList +else: +EdkLogger.error( +"build", +PREBUILD_ERROR, +"Driver's ModuleType must be consistent [%s]"%(str(Lib)), +File=str(Info.PlatformInfo), +ExtraData="consumed by [%s]" % str(Info.MetaFile) +) +ModuleEntryPointList = ModuleEntryPointList + Info.Module.ModuleEntryPointList + # # Module Entry Points # -NumEntryPoints = len(Info.Module.ModuleEntryPointList) +NumEntryPoints = len(ModuleEntryPointList) if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification: PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION'] else: @@ -1468,7 +1483,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): else: UefiSpecVersion = '0x' Dict = { -'Function' : Info.Module.ModuleEntryPointList, +'Function' : ModuleEntryPointList, 'PiSpecVersion' : PiSpecVersion + 'U', 'UefiSpecVersion': UefiSpecVersion + 'U' } @@ -1481,7 +1496,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): AUTOGEN_ERROR, '%s must have exactly one entry point' % Info.ModuleType, File=str(Info), - ExtraData= ", ".join(Info.Module.ModuleEntryPointList) + ExtraData= ", ".join(ModuleEntryPointList) ) if Info.ModuleType == SUP_MODULE_PEI_CORE: AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) @@ -1535,11 +1550,18 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]: return + +ModuleUnloadImageList = [] +for Lib in Info.DependentLibraryList: +if len(Lib.ModuleUnloadImageList) > 0: +ModuleUnloadImageList = ModuleUnloadImageList + Lib.ModuleUnloadImageList +ModuleUnloadImageList = ModuleUnloadImageList + Info.Module.ModuleUnloadImageList + # # Unload Image Handlers # -NumUnloadImage = len(Info.Module.ModuleUnloadImageList) -Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.ModuleUnloadImageList} +NumUnloadImage = len(ModuleUnloadImageList) +Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':ModuleUnloadImageList} if NumUnloadImage < 2: AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict)) else: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:BaseTools supports to the driver combination.
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1520 To save the image size without the compression, more than one drivers can be combined into single one. When more than one drivers are combined, their depex will be AND together. Below is the example to combine BootManagerPolicyDxe into DriverHealthManagerDxe. Besides this patch, BaseTools also needs to check the module type and make sure all module type are same. Otherwise, BaseTools will report the error. DRIVER INF has the parameter ENTRY_POINT LIBRARY INF has the parameter LIBRARY_CLASS Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenC.py | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 9700bf8527..93e8d78375 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1455,10 +1455,24 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH): def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]: return +ModuleEntryPointList = [] +for Lib in Info.DependentLibraryList: +if len(Lib.ModuleEntryPointList) > 0: +if Lib.ModuleType == Info.ModuleType: +ModuleEntryPointList = ModuleEntryPointList + Lib.ModuleEntryPointList +else: +EdkLogger.error( +"build", +CODE_ERROR, +"%s \nDriver's ModuleType must be consistent" % Lib, +File=str(Info) +) +ModuleEntryPointList = ModuleEntryPointList + Info.Module.ModuleEntryPointList + # # Module Entry Points # -NumEntryPoints = len(Info.Module.ModuleEntryPointList) +NumEntryPoints = len(ModuleEntryPointList) if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification: PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION'] else: @@ -1468,7 +1482,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): else: UefiSpecVersion = '0x' Dict = { -'Function' : Info.Module.ModuleEntryPointList, +'Function' : ModuleEntryPointList, 'PiSpecVersion' : PiSpecVersion + 'U', 'UefiSpecVersion': UefiSpecVersion + 'U' } @@ -1481,7 +1495,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): AUTOGEN_ERROR, '%s must have exactly one entry point' % Info.ModuleType, File=str(Info), - ExtraData= ", ".join(Info.Module.ModuleEntryPointList) + ExtraData= ", ".join(ModuleEntryPointList) ) if Info.ModuleType == SUP_MODULE_PEI_CORE: AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) @@ -1535,11 +1549,18 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]: return + +ModuleUnloadImageList = [] +for Lib in Info.DependentLibraryList: +if len(Lib.ModuleUnloadImageList) > 0: +ModuleUnloadImageList = ModuleUnloadImageList + Lib.ModuleUnloadImageList +ModuleUnloadImageList = ModuleUnloadImageList + Info.Module.ModuleUnloadImageList + # # Unload Image Handlers # -NumUnloadImage = len(Info.Module.ModuleUnloadImageList) -Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.ModuleUnloadImageList} +NumUnloadImage = len(ModuleUnloadImageList) +Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':ModuleUnloadImageList} if NumUnloadImage < 2: AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict)) else: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] FW: [PATCH] BaseTools:Function application error
The sdict() was originally defined as common/Misc.py and UPT/library/Misc.py. However, the sdict() defined previously in common/Misc.py has been removed. It is not as good as the OrderedDict() when running in Python3. Any question, please let me know. Thanks. Best Regards Fan Zhiju -Original Message- From: Carsey, Jaben Sent: Thursday, February 14, 2019 11:31 PM To: Fan, ZhijuX ; edk2-devel@lists.01.org Cc: Gao, Liming Subject: RE: [PATCH] BaseTools:Function application error I am really confused by this patch and how it ever worked. I see that you remove the import for sdict. But I see that sdict is used in other places in that file. I also cant find a class definition for sdict anywhere (certainly not in Common/Misc). So maybe refactor and remove all the other uses of sdict from the file? -Jaben > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Fan, ZhijuX > Sent: Thursday, February 14, 2019 1:12 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [PATCH] BaseTools:Function application error > > Error due to incorrect function parameters and attributes > FileWrite() The first argument it needs is a list, not a file This > patch abandons this function and saves the file independently > > Cc: Bob Feng > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Zhiju.Fan > --- > BaseTools/Source/Python/Eot/EotMain.py| 5 +++-- > BaseTools/Source/Python/Workspace/BuildClassObject.py | 1 + > BaseTools/Source/Python/build/BuildReport.py | 9 ++--- > 3 files changed, 10 insertions(+), 5 deletions(-) > > diff --git a/BaseTools/Source/Python/Eot/EotMain.py > b/BaseTools/Source/Python/Eot/EotMain.py > index fd4bee6f90..8c2bfc45e4 100644 > --- a/BaseTools/Source/Python/Eot/EotMain.py > +++ b/BaseTools/Source/Python/Eot/EotMain.py > @@ -21,7 +21,7 @@ import Eot.EotGlobalData as EotGlobalData from > optparse import OptionParser from Common.StringUtils import NormPath > from Common import BuildToolError -from Common.Misc import > GuidStructureStringToGuidString, sdict > +from Common.Misc import GuidStructureStringToGuidString > from Eot.Parser import * > from Eot.InfParserLite import EdkInfParser from Common.StringUtils > import GetSplitValueList @@ -32,6 +32,7 @@ from Eot.Report import > Report from Common.BuildVersion import gBUILD_VERSION from > Eot.Parser import ConvertGuid from Common.LongFilePathSupport import > OpenLongFilePath as open > +import collections > import struct > import uuid > import copy > @@ -57,7 +58,7 @@ class Image(array): > self._LEN_ = None > self._OFF_ = None > > -self._SubImages = sdict() # {offset: Image()} > +self._SubImages = collections.OrderedDict() # {offset: > + Image()} > > array.__init__(self) > > diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py > b/BaseTools/Source/Python/Workspace/BuildClassObject.py > index cff77a71ae..6f8a09e87c 100644 > --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py > +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py > @@ -261,6 +261,7 @@ class StructurePcd(PcdClassObject): > self.PackageDecs = Packages > self.DefaultStoreName = [default_store] > self.DefaultValues = OrderedDict() > +self.DefaultFromDSC = None > self.PcdMode = None > self.SkuOverrideValues = OrderedDict() > self.StructName = None > diff --git a/BaseTools/Source/Python/build/BuildReport.py > b/BaseTools/Source/Python/build/BuildReport.py > index 0b98d62cb6..70584570a5 100644 > --- a/BaseTools/Source/Python/build/BuildReport.py > +++ b/BaseTools/Source/Python/build/BuildReport.py > @@ -1651,14 +1651,17 @@ class PredictionReport(object): > SourceList = os.path.join(self._EotDir, "SourceFile.txt") > GuidList = os.path.join(self._EotDir, "GuidList.txt") > DispatchList = os.path.join(self._EotDir, "Dispatch.txt") > - > +TempList = [] > TempFile = open(SourceList, "w+") > for Item in self._SourceList: > -FileWrite(TempFile, Item) > +TempList.append(Item + TAB_LINE_BREAK) > +TempFile.writelines(TempList) > TempFile.close() > +TempList = [] > TempFile = open(GuidList, "w+") > for Key in self._GuidMap: > -FileWrite(TempFile, "%s %s" % (Key, self._GuidMap[Key])) > +TempList.append("%s %s %s" % (Key, self._GuidMap[Key], > TAB_LINE_BREAK)) > +TempFile.writelines(TempList) >
[edk2] [PATCH] BaseTools:Function application error
Error due to incorrect function parameters and attributes FileWrite() The first argument it needs is a list, not a file This patch abandons this function and saves the file independently Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Eot/EotMain.py| 5 +++-- BaseTools/Source/Python/Workspace/BuildClassObject.py | 1 + BaseTools/Source/Python/build/BuildReport.py | 9 ++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/Eot/EotMain.py b/BaseTools/Source/Python/Eot/EotMain.py index fd4bee6f90..8c2bfc45e4 100644 --- a/BaseTools/Source/Python/Eot/EotMain.py +++ b/BaseTools/Source/Python/Eot/EotMain.py @@ -21,7 +21,7 @@ import Eot.EotGlobalData as EotGlobalData from optparse import OptionParser from Common.StringUtils import NormPath from Common import BuildToolError -from Common.Misc import GuidStructureStringToGuidString, sdict +from Common.Misc import GuidStructureStringToGuidString from Eot.Parser import * from Eot.InfParserLite import EdkInfParser from Common.StringUtils import GetSplitValueList @@ -32,6 +32,7 @@ from Eot.Report import Report from Common.BuildVersion import gBUILD_VERSION from Eot.Parser import ConvertGuid from Common.LongFilePathSupport import OpenLongFilePath as open +import collections import struct import uuid import copy @@ -57,7 +58,7 @@ class Image(array): self._LEN_ = None self._OFF_ = None -self._SubImages = sdict() # {offset: Image()} +self._SubImages = collections.OrderedDict() # {offset: Image()} array.__init__(self) diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index cff77a71ae..6f8a09e87c 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -261,6 +261,7 @@ class StructurePcd(PcdClassObject): self.PackageDecs = Packages self.DefaultStoreName = [default_store] self.DefaultValues = OrderedDict() +self.DefaultFromDSC = None self.PcdMode = None self.SkuOverrideValues = OrderedDict() self.StructName = None diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 0b98d62cb6..70584570a5 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1651,14 +1651,17 @@ class PredictionReport(object): SourceList = os.path.join(self._EotDir, "SourceFile.txt") GuidList = os.path.join(self._EotDir, "GuidList.txt") DispatchList = os.path.join(self._EotDir, "Dispatch.txt") - +TempList = [] TempFile = open(SourceList, "w+") for Item in self._SourceList: -FileWrite(TempFile, Item) +TempList.append(Item + TAB_LINE_BREAK) +TempFile.writelines(TempList) TempFile.close() +TempList = [] TempFile = open(GuidList, "w+") for Key in self._GuidMap: -FileWrite(TempFile, "%s %s" % (Key, self._GuidMap[Key])) +TempList.append("%s %s %s" % (Key, self._GuidMap[Key], TAB_LINE_BREAK)) +TempFile.writelines(TempList) TempFile.close() try: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V2] BaseTools: PCD value incorrect in structure pcd sku case.
Defined 2 PCDs(Test4 & Test401) and 2 SKUs(DEFAULT & _), then set "SKUID_Defines" to ALL, for FixedAtBuild gEfiStructuredPcdPkgTokenSpaceGuid. Test401 in this case, its value should get from "Default" SKU, not from "_" SKU, but we does not set value in SKU "_" in dsc, so Test401 should only display the value get from dec. Missing the map() function causes SKU specific items to not be deleted Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index a96502b4bf..afcf99e66b 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1613,7 +1613,7 @@ class DscBuildData(PlatformBuildClassObject): elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList: del pcd.SkuInfoList[TAB_COMMON] -list((self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if Pcds[pcdkey].Type in DynamicPcdType])) +list(map(self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if Pcds[pcdkey].Type in DynamicPcdType])) return Pcds @cached_property def PlatformUsedPcds(self): -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: PCD value incorrect in structure pcd sku case.
Defined 2 PCDs(Test4 & Test401) and 2 SKUs(DEFAULT & _), then set "SKUID_Defines" to ALL, for FixedAtBuild gEfiStructuredPcdPkgTokenSpaceGuid. Test401 in this case, its value should get from "Default" SKU, not from "_" SKU, but we does not set value in SKU "_" in dsc, so Test401 should only display the value get from dec. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/GlobalData.py | 2 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 1 + BaseTools/Source/Python/build/BuildReport.py | 5 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py index 5eaee06694..f117998b0b 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -103,7 +103,7 @@ MixedPcd = {} # Structure Pcd dict gStructurePcd = {} - +gPcdSkuOverrides={} # Pcd name for the Pcd which used in the Conditional directives gConditionalPcds = [] diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 233e530d5c..0ea1b1bb39 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1525,6 +1525,7 @@ class DscBuildData(PlatformBuildClassObject): for stru_pcd in S_pcd_set.values(): for skuid in SkuIds: if skuid in stru_pcd.SkuOverrideValues: +GlobalData.gPcdSkuOverrides.update({(stru_pcd.TokenCName, stru_pcd.TokenSpaceGuidCName): stru_pcd.SkuOverrideValues}) continue nextskuid = self.SkuIdMgr.GetNextSkuId(skuid) NoDefault = False diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index e979611c26..9752a9c0d2 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1295,7 +1295,10 @@ class PcdReport(object): FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) if IsStructure: FiledOverrideFlag = False -OverrideValues = Pcd.SkuOverrideValues +if (Pcd.TokenCName,Pcd.TokenSpaceGuidCName) in GlobalData.gPcdSkuOverrides: +OverrideValues = GlobalData.gPcdSkuOverrides[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)] +else: +OverrideValues = Pcd.SkuOverrideValues if OverrideValues: for Data in OverrideValues.values(): Struct = list(Data.values()) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:StructurePCD value display incorrect in "Not used" section.
StructurePCD value display incorrect in "Not used" section, that the value defined in structure does not show. StructurePCD will not display in "Not Used" section if main structure not define in dsc and pcd not in inf Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++-- BaseTools/Source/Python/build/BuildReport.py | 7 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 0dad04212e..661852b1d5 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1511,9 +1511,9 @@ class DscBuildData(PlatformBuildClassObject): else: str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList} S_pcd_set[Pcd] = str_pcd_obj_str -self.FilterStrcturePcd(S_pcd_set) if S_pcd_set: -GlobalData.gStructurePcd[self.Arch] = S_pcd_set +GlobalData.gStructurePcd[self.Arch] = S_pcd_set.copy() +self.FilterStrcturePcd(S_pcd_set) for stru_pcd in S_pcd_set.values(): for skuid in SkuIds: if skuid in stru_pcd.SkuOverrideValues: diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index ae37a6ce0e..4094c9c488 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -780,6 +780,13 @@ class PcdReport(object): # Collect the PCD defined in DSC/FDF file, but not used in module # UnusedPcdFullList = [] +StructPcdDict = GlobalData.gStructurePcd[self.Arch] +for Name, Guid in StructPcdDict: +if (Name, Guid) not in Pa.Platform.Pcds: +Pcd = StructPcdDict[(Name, Guid)] +PcdList = self.AllPcds.setdefault(Guid, {}).setdefault(Pcd.Type, []) +if Pcd not in PcdList and Pcd not in UnusedPcdFullList: +UnusedPcdFullList.append(Pcd) for item in Pa.Platform.Pcds: Pcd = Pa.Platform.Pcds[item] if not Pcd.Type: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Define Macro in Inf file, the pcdvalue Can't convert
Define Macro in Inf file, the pcdvalue Can't convert in dec: gUefiOvmfPkgGuid.test1|"ddd"|VOID*|0x3c in inf: DEFINE ABC=PATH gUefiOvmfPkgTokenSpaceGuid.test1|$(ABC) Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Workspace/MetaFileParser.py | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 6df0d3cdf8..f31dbc2649 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -757,9 +757,13 @@ class InfParser(MetaFileParser): if self._ValueList[2] != '': InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) if InfPcdValueList[0] in ['True', 'true', 'TRUE']: -self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1); +self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1) elif InfPcdValueList[0] in ['False', 'false', 'FALSE']: -self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1); +self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1) +elif isinstance(InfPcdValueList[0], str) and InfPcdValueList[0].find('$(') >= 0: +Value = ReplaceExprMacro(InfPcdValueList[0],self._Macros) +if Value != '0': +self._ValueList[2] = Value if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict: self.PcdsDict[self._ValueList[0], self._ValueList[1]] = self._SectionType elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] != self._SectionType: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V2] BaseTools: Fix Pcd Array changes build report issue.
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1472 The Pcd Array feature changes the Pcd Default value data structure which is used by build report. This patch is going to update build report to adapt that change. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/build/BuildReport.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 654a69e05c..30bd2952ef 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1195,8 +1195,11 @@ class PcdReport(object): HasDscOverride = False if struct: for _, Values in struct.items(): -if Values[1] and Values[1].endswith('.dsc'): -HasDscOverride = True +for Key, value in Values.items(): +if value[1] and value[1].endswith('.dsc'): +HasDscOverride = True +break +if HasDscOverride == True: break return HasDscOverride -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Fix Pcd Array changes build report issue.
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1472 The Pcd Array feature changes the Pcd Default value data structure which is used by build report. This patch is going to update build report to adapt that change. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/build/BuildReport.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index a385794cdf..8d3b030151 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1210,8 +1210,11 @@ class PcdReport(object): HasDscOverride = False if struct: for _, Values in list(struct.items()): -if Values[1] and Values[1].endswith('.dsc'): -HasDscOverride = True +for Key, value in Values.items(): +if value[1] and value[1].endswith('.dsc'): +HasDscOverride = True +break +if HasDscOverride == True: break return HasDscOverride -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Evaluation of undefined macros in dsc files
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=989 doc:If macro that is not defined is used in locations that are not expressions (where the tools would just do macro expansion as in C flags in a [BuildOptions] section), nothing will be emitted. This is in fact not what happens.Instead, the text $(MACRO1) is emitted verbatim into the Makefile and left the for make to process. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenMake.py | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 4da10e3950..fe07564bb3 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -34,7 +34,7 @@ gIncludePattern = re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r ## Regular expression for matching macro used in header file inclusion gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE) - +gMacroRePattern = re.compile('.*?(\$\(\w*?\)).*?') gIsFileMap = {} ## pattern for include style in Edk.x code @@ -517,7 +517,21 @@ cleanlib: continue # Remove duplicated include path, if any if Attr == "FLAGS": -Value = RemoveDupOption(Value, IncPrefix, MyAgo.IncludePathList) +Value = ValueCopy = RemoveDupOption(Value, IncPrefix, MyAgo.IncludePathList) +while (ValueCopy.find('$(') != -1): +for macro in self._AutoGenObject.Macros: +MacroName = '$(' + macro + ')' +if (ValueCopy.find(MacroName) != -1): +ValueCopy = ValueCopy.replace(MacroName, self._AutoGenObject.Macros[macro]) +break +else: +if gMacroRePattern.search(ValueCopy, re.UNICODE): +FlageReList = gMacroRePattern.findall(ValueCopy, re.UNICODE) +for FlageRe in FlageReList: +Value = Value.replace(FlageRe, '').strip() +break +else: +break if Tool == "OPTROM" and PCI_COMPRESS_Flag: ValueList = Value.split() if ValueList: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:The BuildOptionPcd value is wrong
In GenFds.py, Due to the second assignment, the value is wrong Its value should a list, not a string.and this line is not required Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/GenFds/GenFds.py | 1 - 1 file changed, 1 deletion(-) diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index 77383d3378..2baee570ed 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -192,7 +192,6 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None): else: EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform") -GlobalData.BuildOptionPcd = FdsCommandDict.get("OptionPcd") if FdsCommandDict.get("OptionPcd") else {} GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform)) if FdsCommandDict.get("conf_directory"): -- 2.18.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:build break if the Path contains SingleFile.Ext
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1325 if SingleFile.Path = "/foo/bar.Sap/yada/source.S" and SingleFile.Ext = ".S". Then key would end up "/foo/bar" instead of "/foo/bar.Sap/yada/source" as intended. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 1aa4a5ca5f..4bffb95ce6 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -3012,7 +3012,7 @@ class ModuleAutoGen(AutoGen): self.BuildOption for SingleFile in FileList: if self.BuildRuleOrder and SingleFile.Ext in self.BuildRuleOrder and SingleFile.Ext in self.BuildRules: -key = SingleFile.Path.split(SingleFile.Ext)[0] +key = SingleFile.Path.rsplit(SingleFile.Ext,1)[0] if key in Order_Dict: Order_Dict[key].append(SingleFile.Ext) else: -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V2] BaseTools:Build fail when PCD use in the [DEPEX] section of INF files
Update _FixedPcdVoidTypeDict to FixedVoidTypePcds '_FixedPcdVoidTypeDict' no longer exists because edk2 version (b23414f6). 'ModuleAutoGen' object has no attribute '_FixedPcdVoidTypeDict'. Build fail when PCD use in the [DEPEX] section of INF files Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/AutoGen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index cfe2d29099..5149bdd6ec 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2779,10 +2779,10 @@ class ModuleAutoGen(AutoGen): if '.' not in item: NewList.append(item) else: -if item not in self._FixedPcdVoidTypeDict: +if item not in self.FixedVoidTypePcds: EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item)) else: -Value = self._FixedPcdVoidTypeDict[item] +Value = self.FixedVoidTypePcds[item] if len(Value.split(',')) != 16: EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item)) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Build fail when PCD use in the [DEPEX] section of INF files
https://vthsd.intel.com/hsd/tiano/tracker/default.aspx?tracker_id=223983 1. Define one fixedatbuild PCD in dec: [PcdsFixedAtBuild] gUefiOvmfPkgTokenSpaceGuid.test1| {0x01, 0x02}|VOID*|0x3c 2. Define this PCD point to a depex GUID in dsc: MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf { NULL|OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.inf gUefiOvmfPkgTokenSpaceGuid.test1| gEfiSmbiosProtocolGuid } 3. Define this PCD under [Depex] and [pcd] section in above lib file: [Pcd] gUefiOvmfPkgTokenSpaceGuid.test1 [Depex] gUefiOvmfPkgTokenSpaceGuid.test1 Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/AutoGen.py | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index cfe2d29099..b3dda1adeb 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2779,11 +2779,21 @@ class ModuleAutoGen(AutoGen): if '.' not in item: NewList.append(item) else: -if item not in self._FixedPcdVoidTypeDict: +if item not in self.FixedVoidTypePcds.keys(): EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item)) else: -Value = self._FixedPcdVoidTypeDict[item] -if len(Value.split(',')) != 16: +Value = self.FixedVoidTypePcds[item] +if Value.startswith('"') and Value.endswith('"'): +GuidValue = Value[1:-1] +GuidList = self.GuidList +GuidList.update(self.PpiList) +GuidList.update(self.ProtocolList) +try: +Value = GuidList[GuidValue] +except: +EdkLogger.error("build", FORMAT_INVALID, +"{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item)) +elif len(Value.split(',')) != 16: EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item)) NewList.append(Value) -- 2.14.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel