summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/reproducible.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/reproducible.py')
-rw-r--r--meta/lib/oe/reproducible.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py
index 0fb02ccdb0..1ed79b18ca 100644
--- a/meta/lib/oe/reproducible.py
+++ b/meta/lib/oe/reproducible.py
@@ -41,7 +41,7 @@ def find_git_folder(d, sourcedir):
41 for root, dirs, files in os.walk(workdir, topdown=True): 41 for root, dirs, files in os.walk(workdir, topdown=True):
42 dirs[:] = [d for d in dirs if d not in exclude] 42 dirs[:] = [d for d in dirs if d not in exclude]
43 if '.git' in dirs: 43 if '.git' in dirs:
44 return root 44 return os.path.join(root, ".git")
45 45
46 bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir) 46 bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir)
47 return None 47 return None
@@ -62,7 +62,8 @@ def get_source_date_epoch_from_git(d, sourcedir):
62 return None 62 return None
63 63
64 bb.debug(1, "git repository: %s" % gitpath) 64 bb.debug(1, "git repository: %s" % gitpath)
65 p = subprocess.run(['git', '--git-dir', gitpath, 'log', '-1', '--pretty=%ct'], check=True, stdout=subprocess.PIPE) 65 p = subprocess.run(['git', '-c', 'log.showSignature=false', '--git-dir', gitpath, 'log', '-1', '--pretty=%ct'],
66 check=True, stdout=subprocess.PIPE)
66 return int(p.stdout.decode('utf-8')) 67 return int(p.stdout.decode('utf-8'))
67 68
68def get_source_date_epoch_from_youngest_file(d, sourcedir): 69def get_source_date_epoch_from_youngest_file(d, sourcedir):
@@ -90,8 +91,12 @@ def get_source_date_epoch_from_youngest_file(d, sourcedir):
90 bb.debug(1, "Newest file found: %s" % newest_file) 91 bb.debug(1, "Newest file found: %s" % newest_file)
91 return source_date_epoch 92 return source_date_epoch
92 93
93def fixed_source_date_epoch(): 94def fixed_source_date_epoch(d):
94 bb.debug(1, "No tarball or git repo found to determine SOURCE_DATE_EPOCH") 95 bb.debug(1, "No tarball or git repo found to determine SOURCE_DATE_EPOCH")
96 source_date_epoch = d.getVar('SOURCE_DATE_EPOCH_FALLBACK')
97 if source_date_epoch:
98 bb.debug(1, "Using SOURCE_DATE_EPOCH_FALLBACK")
99 return int(source_date_epoch)
95 return 0 100 return 0
96 101
97def get_source_date_epoch(d, sourcedir): 102def get_source_date_epoch(d, sourcedir):
@@ -99,6 +104,6 @@ def get_source_date_epoch(d, sourcedir):
99 get_source_date_epoch_from_git(d, sourcedir) or 104 get_source_date_epoch_from_git(d, sourcedir) or
100 get_source_date_epoch_from_known_files(d, sourcedir) or 105 get_source_date_epoch_from_known_files(d, sourcedir) or
101 get_source_date_epoch_from_youngest_file(d, sourcedir) or 106 get_source_date_epoch_from_youngest_file(d, sourcedir) or
102 fixed_source_date_epoch() # Last resort 107 fixed_source_date_epoch(d) # Last resort
103 ) 108 )
104 109