[edk2-devel] [Patch] BaseTools: Clean the ffs folder before generating files in it

Bob Feng posted 1 patch 3 years, 6 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/GenFds/FfsFileStatement.py | 3 +++
1 file changed, 3 insertions(+)
[edk2-devel] [Patch] BaseTools: Clean the ffs folder before generating files in it
Posted by Bob Feng 3 years, 6 months ago
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 <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
 BaseTools/Source/Python/GenFds/FfsFileStatement.py | 3 +++
 1 file changed, 3 insertions(+)

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
@@ -19,10 +19,11 @@ from Common.Misc import GuidStructureByteArrayToGuidString, SaveFileOnChange
 import Common.LongFilePathOs as os
 from .GuidSection import GuidSection
 from .FvImageSection import FvImageSection
 from .Ffs import FdfFvFileTypeToFileType
 from .GenFdsGlobalVariable import GenFdsGlobalVariable
+import shutil
 
 ## generate FFS from FILE
 #
 #
 class FileStatement (FileStatementClassObject):
@@ -65,10 +66,12 @@ class FileStatement (FileStatementClassObject):
 
         Str = self.NameGuid
         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)
 
         if Dict is None:
             Dict = {}
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#65528): https://edk2.groups.io/g/devel/message/65528
Mute This Topic: https://groups.io/mt/77032690/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch] BaseTools: Clean the ffs folder before generating files in it
Posted by Yuwei Chen 3 years, 6 months ago
Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob
> Feng
> Sent: Wednesday, September 23, 2020 7:21 PM
> To: devel@edk2.groups.io
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine
> <yuwei.chen@intel.com>
> Subject: [edk2-devel] [Patch] 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 <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> ---
>  BaseTools/Source/Python/GenFds/FfsFileStatement.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> 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
> @@ -19,10 +19,11 @@ from Common.Misc import
> GuidStructureByteArrayToGuidString, SaveFileOnChange  import
> Common.LongFilePathOs as os  from .GuidSection import GuidSection
> from .FvImageSection import FvImageSection  from .Ffs import
> FdfFvFileTypeToFileType  from .GenFdsGlobalVariable import
> GenFdsGlobalVariable
> +import shutil
> 
>  ## generate FFS from FILE
>  #
>  #
>  class FileStatement (FileStatementClassObject):
> @@ -65,10 +66,12 @@ class FileStatement (FileStatementClassObject):
> 
>          Str = self.NameGuid
>          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)
> 
>          if Dict is None:
>              Dict = {}
> --
> 2.20.1.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#65598): https://edk2.groups.io/g/devel/message/65598
Mute This Topic: https://groups.io/mt/77032690/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-