From: Bob Feng Date: Wed, 23 Sep 2020 11:21:04 +0000 (+0800) Subject: BaseTools: Clean the ffs folder before generating files in it X-Git-Tag: edk2-stable202011~183 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=a8c77eba374cc90860172b29a191bf47c735000b BaseTools: Clean the ffs folder before generating files in it REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2965 The content in Guid.xref depends on the files under the corresponding ffs folder.(refer to the commit 5e9256cd7f54ffd6f1fd9837df92a911fcd2d7c2) To make Guid.xref update in the incremental build, clean the files under that ffs folder before generating files in it. Signed-off-by: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Reviewed-by: Yuwei Chen --- diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools/Source/Python/GenFds/FfsFileStatement.py index 9fb62b0a91..1c6e59bac7 100644 --- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py @@ -21,6 +21,7 @@ from .GuidSection import GuidSection from .FvImageSection import FvImageSection from .Ffs import FdfFvFileTypeToFileType from .GenFdsGlobalVariable import GenFdsGlobalVariable +import shutil ## generate FFS from FILE # @@ -67,6 +68,8 @@ class FileStatement (FileStatementClassObject): if FvName: Str += FvName OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, Str) + if os.path.exists(OutputDir): + shutil.rmtree(OutputDir) if not os.path.exists(OutputDir): os.makedirs(OutputDir)