]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/GuidSection.py
BaseTools: Add a keyword FvNameString in FDF
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / GuidSection.py
index 0e5bb3b27072289c43c58e1de59fd0e4047ccaf4..006cf0f2169bb7ce2ea754fcc0a769d081c8bb2d 100644 (file)
@@ -159,6 +159,13 @@ class GuidSection(GuidSectionClassObject) :
                        SecNum     + \\r
                        '.tmp'\r
             TempFile = os.path.normpath(TempFile)\r
+            #\r
+            # Remove temp file if its time stamp is older than dummy file\r
+            # Just in case the external tool fails at this time but succeeded before\r
+            # Error should be reported if the external tool does not generate a new output based on new input\r
+            #\r
+            if os.path.exists(TempFile) and os.path.exists(DummyFile) and os.path.getmtime(TempFile) < os.path.getmtime(DummyFile):\r
+                os.remove(TempFile)\r
 \r
             FirstCall = False\r
             CmdOption = '-e'\r
@@ -183,6 +190,12 @@ class GuidSection(GuidSectionClassObject) :
                 FirstCall = False\r
                 ReturnValue[0] = 0\r
                 GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption)\r
+            #\r
+            # There is external tool which does not follow standard rule which return nonzero if tool fails\r
+            # The output file has to be checked\r
+            #\r
+            if not os.path.exists(TempFile):\r
+                EdkLogger.error("GenFds", COMMAND_FAILURE, 'Fail to call %s, no output file was generated' % ExternalTool)\r
 \r
             FileHandleIn = open(DummyFile,'rb')\r
             FileHandleIn.seek(0,2)\r
@@ -257,6 +270,7 @@ class GuidSection(GuidSectionClassObject) :
 \r
         ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary\r
         ToolPathTmp = None\r
+        ToolOption = None\r
         for ToolDef in ToolDefinition.items():\r
             if self.NameGuid == ToolDef[1]:\r
                 KeyList = ToolDef[0].split('_')\r