From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: steven.shi@intel.com) Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Tue, 13 Aug 2019 01:51:08 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2019 01:51:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,380,1559545200"; d="scan'208";a="200414605" Received: from jshi19-mobl.ccr.corp.intel.com ([10.254.211.145]) by fmsmga004.fm.intel.com with ESMTP; 13 Aug 2019 01:51:06 -0700 From: "Steven Shi" To: devel@edk2.groups.io Cc: liming.gao@intel.com, bob.c.feng@intel.com, christian.rodriguez@intel.com, michael.johnson@intel.com, "Shi, Steven" Subject: [PATCH v3 4/5] BaseTools: Add GenFds multi-thread support in build cache Date: Tue, 13 Aug 2019 16:50:54 +0800 Message-Id: <20190813085055.23208-5-steven.shi@intel.com> X-Mailer: git-send-email 2.17.1.windows.2 In-Reply-To: <20190813085055.23208-1-steven.shi@intel.com> References: <20190813085055.23208-1-steven.shi@intel.com> From: "Shi, Steven" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1923 Fix the issue that the GenFds multi-thread will build fail if enable the build cache together. Cc: Liming Gao Cc: Bob Feng Signed-off-by: Steven Shi --- BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py index a73a8a53a0..ee8518e19c 100755 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py @@ -1248,11 +1248,13 @@ class ModuleAutoGen(AutoGen): fStringIO.close () fInputfile.close () return OutputName + @cached_property def OutputFile(self): retVal = set() OutputDir = self.OutputDir.replace('\\', '/').strip('/') DebugDir = self.DebugDir.replace('\\', '/').strip('/') + FfsOutputDir = self.FfsOutputDir.replace('\\', '/').rstrip('/') for Item in self.CodaTargetList: File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/') retVal.add(File) @@ -1268,6 +1270,12 @@ class ModuleAutoGen(AutoGen): if File.lower().endswith('.pdb'): retVal.add(File) + for Root, Dirs, Files in os.walk(FfsOutputDir): + for File in Files: + if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \ + or File.lower().endswith('.raw.txt'): + retVal.add(File) + return retVal ## Create AsBuilt INF file the module @@ -1638,13 +1646,16 @@ class ModuleAutoGen(AutoGen): for File in self.OutputFile: File = str(File) if not os.path.isabs(File): - File = os.path.join(self.OutputDir, File) + NewFile = os.path.join(self.OutputDir, File) + if not os.path.exists(NewFile): + NewFile = os.path.join(self.FfsOutputDir, File) + File = NewFile if os.path.exists(File): - sub_dir = os.path.relpath(File, self.OutputDir) - destination_file = os.path.join(FileDir, sub_dir) - destination_dir = os.path.dirname(destination_file) - CreateDirectory(destination_dir) - CopyFileOnChange(File, destination_dir) + if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \ + or File.lower().endswith('.raw.txt'): + self.CacheCopyFile(FfsDir, self.FfsOutputDir, File) + else: + self.CacheCopyFile(FileDir, self.OutputDir, File) def SaveHashChainFileToCache(self, gDict): if not GlobalData.gBinCacheDest: -- 2.17.1