1. Close file after Flush file
authorlgao4 <lgao4@c2973edb-eda0-4c78-bc6a-9341b269661f>
Thu, 4 Feb 2010 10:03:26 +0000 (10:03 +0000)
committerlgao4 <lgao4@c2973edb-eda0-4c78-bc6a-9341b269661f>
Thu, 4 Feb 2010 10:03:26 +0000 (10:03 +0000)
2. Compare file content, not file time stamp.

git-svn-id: https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/trunk/BaseTools@1841 c2973edb-eda0-4c78-bc6a-9341b269661f

Source/C/GenFv/GenFv.c
Source/C/GenFv/GenFvInternalLib.c
Source/Python/GenFds/Fv.py
Source/Python/GenFds/GuidSection.py

index 454a94f..5b7f72e 100644 (file)
@@ -637,6 +637,7 @@ Returns:
         (unsigned long long)mFvBaseAddress[Index]\r
         );\r
     }\r
+    fflush (FpFile);\r
     fclose (FpFile);\r
   }\r
   \r
index d95bd04..e73b1d7 100644 (file)
@@ -2380,14 +2380,17 @@ Finish:
   }\r
   \r
   if (FvFile != NULL) {\r
+    fflush (FvFile);\r
     fclose (FvFile);\r
   }\r
   \r
   if (FvMapFile != NULL) {\r
+    fflush (FvMapFile);\r
     fclose (FvMapFile);\r
   }\r
 \r
   if (FvReportFile != NULL) {\r
+    fflush (FvReportFile);\r
     fclose (FvReportFile);\r
   }\r
   return Status;\r
index d7471f7..8d2ef1d 100644 (file)
@@ -122,7 +122,9 @@ class FV (FvClassObject):
 \r
         FvInfoFileName = os.path.join(GenFdsGlobalVariable.FfsDir, self.UiFvName + '.inf')\r
         shutil.copy(GenFdsGlobalVariable.FvAddressFileName, FvInfoFileName)\r
-        oldtime = os.path.getmtime(FvInfoFileName)\r
+        OrigFvInfo = None\r
+        if os.path.exists (FvInfoFileName):\r
+            OrigFvInfo = open(FvInfoFileName, 'r').read()\r
         GenFdsGlobalVariable.GenerateFirmwareVolume(\r
                                 FvOutputFile,\r
                                 [self.InfFileName],\r
@@ -130,7 +132,10 @@ class FV (FvClassObject):
                                 FfsList=FfsFileList\r
                                 )\r
 \r
-        if os.path.getmtime(FvInfoFileName) > oldtime:\r
+        NewFvInfo = None\r
+        if os.path.exists (FvInfoFileName):\r
+            NewFvInfo = open(FvInfoFileName, 'r').read()\r
+        if NewFvInfo != None and NewFvInfo != OrigFvInfo:\r
             FvChildAddr = []\r
             AddFileObj = open(FvInfoFileName, 'r')\r
             AddrStrings = AddFileObj.readlines()\r
index f24724e..d967880 100755 (executable)
@@ -198,7 +198,7 @@ class GuidSection(GuidSectionClassObject) :
                 BufferIn  = FileHandleIn.read()\r
                 FileHandleOut.seek(0)\r
                 BufferOut = FileHandleOut.read()\r
-                if BufferIn in BufferOut[TempFileSize - InputFileSize:]:\r
+                if BufferIn == BufferOut[TempFileSize - InputFileSize:]:\r
                     HeaderLength = str(TempFileSize - InputFileSize)\r
             #auto sec guided attribute with process required\r
             if HeaderLength == None:\r