summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/AutoGen.py
diff options
context:
space:
mode:
authorRodriguez, Christian <christian.rodriguez@intel.com>2019-04-05 00:04:22 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-04-10 13:32:13 +0800
commitf2b5e04acad2bac7f11d97871cc68e8a0d312289 (patch)
tree9f911d8cc8fbebcfc999a30b77fb365a11c8f78a /BaseTools/Source/Python/AutoGen/AutoGen.py
parent1b8caf0d87eacc66aba70e8698c7bd1518bb7be1 (diff)
downloadedk2-f2b5e04acad2bac7f11d97871cc68e8a0d312289.tar.gz
edk2-f2b5e04acad2bac7f11d97871cc68e8a0d312289.tar.bz2
edk2-f2b5e04acad2bac7f11d97871cc68e8a0d312289.zip
BaseTools: Fix corner-cases of --hash feature
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1680 Respect artifact location within directory structure. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christian Rodriguez <christian.rodriguez@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/AutoGen.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 57992d5886..8648fc40ed 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -3900,9 +3900,11 @@ class ModuleAutoGen(AutoGen):
FileDir = path.join(GlobalData.gBinCacheDest, self.Arch, self.SourceDir, self.MetaFile.BaseName)
CreateDirectory (FileDir)
HashFile = path.join(self.BuildDir, self.Name + '.hash')
- ModuleFile = path.join(self.OutputDir, self.Name + '.inf')
if os.path.exists(HashFile):
shutil.copy2(HashFile, FileDir)
+ if self.IsLibrary:
+ return
+ ModuleFile = path.join(self.OutputDir, self.Name + '.inf')
if os.path.exists(ModuleFile):
shutil.copy2(ModuleFile, FileDir)
if not self.OutputFile:
@@ -3914,7 +3916,11 @@ class ModuleAutoGen(AutoGen):
if not os.path.isabs(File):
File = os.path.join(self.OutputDir, File)
if os.path.exists(File):
- shutil.copy2(File, FileDir)
+ 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)
+ shutil.copy2(File, destination_dir)
def AttemptModuleCacheCopy(self):
# If library or Module is binary do not skip by hash
@@ -3938,7 +3944,11 @@ class ModuleAutoGen(AutoGen):
shutil.copy2(HashFile, self.BuildDir)
else:
File = path.join(root, f)
- shutil.copy2(File, self.OutputDir)
+ sub_dir = os.path.relpath(File, FileDir)
+ destination_file = os.path.join(self.OutputDir, sub_dir)
+ destination_dir = os.path.dirname(destination_file)
+ CreateDirectory(destination_dir)
+ shutil.copy2(File, destination_dir)
if self.Name == "PcdPeim" or self.Name == "PcdDxe":
CreatePcdDatabaseCode(self, TemplateString(), TemplateString())
return True