]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: back up the binary files when hash value is same
authorYonghong Zhu <yonghong.zhu@intel.com>
Tue, 12 Dec 2017 07:18:22 +0000 (15:18 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 13 Dec 2017 08:06:52 +0000 (16:06 +0800)
V2: change to use InfBuildData but not ModuleAutoGen

We meet the case that first build with --hash option, then build it
again with --hash and --binary-destination option, since the hash value
is same, tool will not build the driver again, it cause the binary
files are not backed up.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/build/build.py

index 8ad385aac25381b0b6cd4edbf1ef4b29237dea16..b00390ce7dd48d44717660d7764ac1abc4b657d3 100644 (file)
@@ -3838,7 +3838,13 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Create AsBuilt INF file the module\r
     #\r
-    def CreateAsBuiltInf(self):\r
+    def CreateAsBuiltInf(self, IsOnlyCopy = False):\r
+        self.OutputFile = []\r
+        if IsOnlyCopy:\r
+            if GlobalData.gBinCacheDest:\r
+                self.CopyModuleToCache()\r
+                return\r
+\r
         if self.IsAsBuiltInfCreated:\r
             return\r
             \r
@@ -3971,7 +3977,6 @@ class ModuleAutoGen(AutoGen):
             AsBuiltInfDict['module_pi_specification_version'] += [self.Specification['PI_SPECIFICATION_VERSION']]\r
 \r
         OutputDir = self.OutputDir.replace('\\', '/').strip('/')\r
-        self.OutputFile = []\r
         for Item in self.CodaTargetList:\r
             File = Item.Target.Path.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/')\r
             if File not in self.OutputFile:\r
@@ -4198,8 +4203,12 @@ class ModuleAutoGen(AutoGen):
             shutil.copy2(HashFile, FileDir)\r
         if os.path.exists(ModuleFile):\r
             shutil.copy2(ModuleFile, FileDir)\r
+        if not self.OutputFile:\r
+            Ma = self.Workspace.BuildDatabase[PathClass(ModuleFile), self.Arch, self.BuildTarget, self.ToolChain]\r
+            self.OutputFile = Ma.Binaries\r
         if self.OutputFile:\r
             for File in self.OutputFile:\r
+                File = str(File)\r
                 if not os.path.isabs(File):\r
                     File = os.path.join(self.OutputDir, File)\r
                 if os.path.exists(File):\r
index f94285a964ed2ea4774cfe0a9a95cffeafdbdeb9..457f6c9ef744c4f9c7c8e49d4afac46cda808694 100644 (file)
@@ -825,6 +825,7 @@ class Build():
         self.LoadFixAddress = 0\r
         self.UniFlag        = BuildOptions.Flag\r
         self.BuildModules = []\r
+        self.HashSkipModules = []\r
         self.Db_Flag = False\r
         self.LaunchPrebuildFlag = False\r
         self.PlatformBuildPath = os.path.join(GlobalData.gConfDirectory,'.cache', '.PlatformBuild')\r
@@ -2016,6 +2017,7 @@ class Build():
                         if Ma == None:\r
                             continue\r
                         if Ma.CanSkipbyHash():\r
+                            self.HashSkipModules.append(Ma)\r
                             continue\r
 \r
                         # Not to auto-gen for targets 'clean', 'cleanlib', 'cleanall', 'run', 'fds'\r
@@ -2214,7 +2216,10 @@ class Build():
     def CreateAsBuiltInf(self):\r
         for Module in self.BuildModules:\r
             Module.CreateAsBuiltInf()\r
+        for Module in self.HashSkipModules:\r
+            Module.CreateAsBuiltInf(True)\r
         self.BuildModules = []\r
+        self.HashSkipModules = []\r
     ## Do some clean-up works when error occurred\r
     def Relinquish(self):\r
         OldLogLevel = EdkLogger.GetLevel()\r