X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FAutoGen%2FAutoGen.py;h=57992d5886804a4a89d9ed54f8cbb7087ac9e2f8;hp=568d535754692512e8704f7617d309c3efe2a723;hb=1b8caf0d87eacc66aba70e8698c7bd1518bb7be1;hpb=d868846a4ecc1f3ec28f68e05519960275138771
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 568d535754..57992d5886 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -5,13 +5,7 @@
# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
# Copyright (c) 2019, American Megatrends, Inc. All rights reserved.
#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
#
## Import Modules
@@ -661,7 +655,7 @@ class WorkspaceAutoGen(AutoGen):
#
# Generate Package level hash value
#
- GlobalData.gPackageHash[Arch] = {}
+ GlobalData.gPackageHash = {}
if GlobalData.gUseHashCache:
for Pkg in Pkgs:
self._GenPkgLevelHash(Pkg)
@@ -747,7 +741,7 @@ class WorkspaceAutoGen(AutoGen):
return True
def _GenPkgLevelHash(self, Pkg):
- if Pkg.PackageName in GlobalData.gPackageHash[Pkg.Arch]:
+ if Pkg.PackageName in GlobalData.gPackageHash:
return
PkgDir = os.path.join(self.BuildDir, Pkg.Arch, Pkg.PackageName)
@@ -770,7 +764,7 @@ class WorkspaceAutoGen(AutoGen):
f.close()
m.update(Content)
SaveFileOnChange(HashFile, m.hexdigest(), False)
- GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] = m.hexdigest()
+ GlobalData.gPackageHash[Pkg.PackageName] = m.hexdigest()
def _GetMetaFiles(self, Target, Toolchain, Arch):
AllWorkSpaceMetaFiles = set()
@@ -1141,7 +1135,6 @@ class PlatformAutoGen(AutoGen):
self.BuildTarget = Target
self.Arch = Arch
self.SourceDir = PlatformFile.SubDir
- self.SourceOverrideDir = None
self.FdTargetList = self.Workspace.FdTargetList
self.FvTargetList = self.Workspace.FvTargetList
# get the original module/package/platform objects
@@ -2559,11 +2552,6 @@ class ModuleAutoGen(AutoGen):
self.SourceDir = self.MetaFile.SubDir
self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir)
- self.SourceOverrideDir = None
- # use overridden path defined in DSC file
- if self.MetaFile.Key in GlobalData.gOverrideDir:
- self.SourceOverrideDir = GlobalData.gOverrideDir[self.MetaFile.Key]
-
self.ToolChain = Toolchain
self.BuildTarget = Target
self.Arch = Arch
@@ -2768,12 +2756,7 @@ class ModuleAutoGen(AutoGen):
RetVal = {}
for Type in self.Module.CustomMakefile:
MakeType = gMakeTypeMap[Type] if Type in gMakeTypeMap else 'nmake'
- if self.SourceOverrideDir is not None:
- File = os.path.join(self.SourceOverrideDir, self.Module.CustomMakefile[Type])
- if not os.path.exists(File):
- File = os.path.join(self.SourceDir, self.Module.CustomMakefile[Type])
- else:
- File = os.path.join(self.SourceDir, self.Module.CustomMakefile[Type])
+ File = os.path.join(self.SourceDir, self.Module.CustomMakefile[Type])
RetVal[MakeType] = File
return RetVal
@@ -3934,8 +3917,13 @@ class ModuleAutoGen(AutoGen):
shutil.copy2(File, FileDir)
def AttemptModuleCacheCopy(self):
+ # If library or Module is binary do not skip by hash
if self.IsBinaryModule:
return False
+ # .inc is contains binary information so do not skip by hash as well
+ for f_ext in self.SourceFileList:
+ if '.inc' in str(f_ext):
+ return False
FileDir = path.join(GlobalData.gBinCacheSource, self.Arch, self.SourceDir, self.MetaFile.BaseName)
HashFile = path.join(FileDir, self.Name + '.hash')
if os.path.exists(HashFile):
@@ -4098,14 +4086,16 @@ class ModuleAutoGen(AutoGen):
def GenModuleHash(self):
if self.Arch not in GlobalData.gModuleHash:
GlobalData.gModuleHash[self.Arch] = {}
+ if self.Name in GlobalData.gModuleHash[self.Arch] and GlobalData.gBinCacheSource and self.AttemptModuleCacheCopy():
+ return False
m = hashlib.md5()
# Add Platform level hash
m.update(GlobalData.gPlatformHash.encode('utf-8'))
# Add Package level hash
if self.DependentPackageList:
for Pkg in sorted(self.DependentPackageList, key=lambda x: x.PackageName):
- if Pkg.PackageName in GlobalData.gPackageHash[self.Arch]:
- m.update(GlobalData.gPackageHash[self.Arch][Pkg.PackageName].encode('utf-8'))
+ if Pkg.PackageName in GlobalData.gPackageHash:
+ m.update(GlobalData.gPackageHash[Pkg.PackageName].encode('utf-8'))
# Add Library hash
if self.LibraryAutoGenList:
@@ -4130,14 +4120,22 @@ class ModuleAutoGen(AutoGen):
ModuleHashFile = path.join(self.BuildDir, self.Name + ".hash")
if self.Name not in GlobalData.gModuleHash[self.Arch]:
GlobalData.gModuleHash[self.Arch][self.Name] = m.hexdigest()
- if GlobalData.gBinCacheSource:
- if self.AttemptModuleCacheCopy():
- return False
+ if GlobalData.gBinCacheSource and self.AttemptModuleCacheCopy():
+ return False
return SaveFileOnChange(ModuleHashFile, m.hexdigest(), False)
## Decide whether we can skip the ModuleAutoGen process
def CanSkipbyHash(self):
+ # If library or Module is binary do not skip by hash
+ if self.IsBinaryModule:
+ return False
+ # .inc is contains binary information so do not skip by hash as well
+ for f_ext in self.SourceFileList:
+ if '.inc' in str(f_ext):
+ return False
if GlobalData.gUseHashCache:
+ # If there is a valid hash or function generated a valid hash; function will return False
+ # and the statement below will return True
return not self.GenModuleHash()
return False