Liming Gao
2015-06-04 04:20:10 UTC
Ffs Rule can specify a file type instead of specific file name. GenFds
should search Binary sections of module INF file and output directory
of the module to find all matched file with the specific file type.
Current GenFds only considers the final output target file. This patch
applies the above rule to match output file with the specific file type.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <***@intel.com>
Reviewed-by: Liu, Yingke D <***@intel.com>
---
BaseTools/Source/Python/GenFds/Section.py | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index c67177b..32314d6 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -139,14 +139,31 @@ class Section (SectionClassObject):
else:
GenFdsGlobalVariable.VerboseLogger ("\nFile Type \'%s\' of File %s in %s is not same with file type \'%s\' from Rule in FDF" %(File.Type, File.File, FfsInf.InfFileName, FileType))
else:
GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName))
- if Suffix != None:
- SuffixMap = FfsInf.GetFinalTargetSuffixMap()
- if Suffix in SuffixMap:
- FileList.extend(SuffixMap[Suffix])
+ if Suffix != None and os.path.exists(FfsInf.EfiOutputPath):
+ #
+ # Get Makefile path and time stamp
+ #
+ MakefileDir = FfsInf.EfiOutputPath[:-len('OUTPUT')]
+ Makefile = os.path.join(MakefileDir, 'Makefile')
+ if not os.path.exists(Makefile):
+ Makefile = os.path.join(MakefileDir, 'GNUmakefile')
+ if not os.path.exists(Makefile):
+ SuffixMap = FfsInf.GetFinalTargetSuffixMap()
+ if Suffix in SuffixMap:
+ FileList.extend(SuffixMap[Suffix])
+ else:
+ # Update to search files with suffix in all sub-dirs.
+ Tuple = os.walk(FfsInf.EfiOutputPath)
+ for Dirpath, Dirnames, Filenames in Tuple:
+ for F in Filenames:
+ if os.path.splitext(F)[1] in (Suffix):
+ FullName = os.path.join(Dirpath, F)
+ if os.path.getmtime(FullName) > os.path.getmtime(Makefile):
+ FileList.append(FullName)
#Process the file lists is alphabetical for a same section type
if len (FileList) > 1:
FileList.sort()
should search Binary sections of module INF file and output directory
of the module to find all matched file with the specific file type.
Current GenFds only considers the final output target file. This patch
applies the above rule to match output file with the specific file type.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <***@intel.com>
Reviewed-by: Liu, Yingke D <***@intel.com>
---
BaseTools/Source/Python/GenFds/Section.py | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index c67177b..32314d6 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -139,14 +139,31 @@ class Section (SectionClassObject):
else:
GenFdsGlobalVariable.VerboseLogger ("\nFile Type \'%s\' of File %s in %s is not same with file type \'%s\' from Rule in FDF" %(File.Type, File.File, FfsInf.InfFileName, FileType))
else:
GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName))
- if Suffix != None:
- SuffixMap = FfsInf.GetFinalTargetSuffixMap()
- if Suffix in SuffixMap:
- FileList.extend(SuffixMap[Suffix])
+ if Suffix != None and os.path.exists(FfsInf.EfiOutputPath):
+ #
+ # Get Makefile path and time stamp
+ #
+ MakefileDir = FfsInf.EfiOutputPath[:-len('OUTPUT')]
+ Makefile = os.path.join(MakefileDir, 'Makefile')
+ if not os.path.exists(Makefile):
+ Makefile = os.path.join(MakefileDir, 'GNUmakefile')
+ if not os.path.exists(Makefile):
+ SuffixMap = FfsInf.GetFinalTargetSuffixMap()
+ if Suffix in SuffixMap:
+ FileList.extend(SuffixMap[Suffix])
+ else:
+ # Update to search files with suffix in all sub-dirs.
+ Tuple = os.walk(FfsInf.EfiOutputPath)
+ for Dirpath, Dirnames, Filenames in Tuple:
+ for F in Filenames:
+ if os.path.splitext(F)[1] in (Suffix):
+ FullName = os.path.join(Dirpath, F)
+ if os.path.getmtime(FullName) > os.path.getmtime(Makefile):
+ FileList.append(FullName)
#Process the file lists is alphabetical for a same section type
if len (FileList) > 1:
FileList.sort()
--
1.9.5.msysgit.0
------------------------------------------------------------------------------
1.9.5.msysgit.0
------------------------------------------------------------------------------