]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Update GenFds to handle file type Ffs Rule
authorLiming Gao <liming.gao@intel.com>
Mon, 8 Jun 2015 09:44:01 +0000 (09:44 +0000)
committerlgao4 <lgao4@Edk2>
Mon, 8 Jun 2015 09:44:01 +0000 (09:44 +0000)
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 <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17579 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/GenFds/Section.py

index c67177bb17a6ca436fbe7a18301e554699312138..32314d6b7fb3edc66cc1065981ff7be833da5a14 100644 (file)
@@ -141,10 +141,27 @@ class Section (SectionClassObject):
                 else:\r
                     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))\r
 \r
-        if Suffix != None:\r
-            SuffixMap = FfsInf.GetFinalTargetSuffixMap()\r
-            if Suffix in SuffixMap:\r
-                FileList.extend(SuffixMap[Suffix])\r
+        if Suffix != None and os.path.exists(FfsInf.EfiOutputPath):\r
+            #\r
+            # Get Makefile path and time stamp\r
+            #\r
+            MakefileDir = FfsInf.EfiOutputPath[:-len('OUTPUT')]\r
+            Makefile = os.path.join(MakefileDir, 'Makefile')\r
+            if not os.path.exists(Makefile):\r
+                Makefile = os.path.join(MakefileDir, 'GNUmakefile')\r
+            if not os.path.exists(Makefile):\r
+                SuffixMap = FfsInf.GetFinalTargetSuffixMap()\r
+                if Suffix in SuffixMap:\r
+                    FileList.extend(SuffixMap[Suffix])\r
+            else:\r
+                # Update to search files with suffix in all sub-dirs.\r
+                Tuple = os.walk(FfsInf.EfiOutputPath)\r
+                for Dirpath, Dirnames, Filenames in Tuple:\r
+                    for F in Filenames:\r
+                        if os.path.splitext(F)[1] in (Suffix):\r
+                            FullName = os.path.join(Dirpath, F)\r
+                            if os.path.getmtime(FullName) > os.path.getmtime(Makefile):\r
+                                FileList.append(FullName)\r
 \r
         #Process the file lists is alphabetical for a same section type\r
         if len (FileList) > 1:\r