From ee6d39b52494cb47103c75fe4a5ae384de5843f8 Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Thu, 24 May 2018 10:34:56 -0300
Subject: [PATCH] Also reset file modification times of individual zips before
 zipping all

Otherwise the final zip will not be deterministic
---
 build-tor.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/build-tor.py b/build-tor.py
index 9cd7d85..d5b8238 100755
--- a/build-tor.py
+++ b/build-tor.py
@@ -36,6 +36,8 @@ def main():
 
     # zip everything together
     file_list = ['tor_arm_pie.zip', 'tor_arm.zip', 'tor_x86_pie.zip', 'tor_x86.zip', 'geoip.zip']
+    for filename in file_list:
+        reset_time(os.path.join(REPO_DIR, filename))  # make file times deterministic before zipping
     zip_name = 'tor-android-%s.zip' % versions['tor'].split('-')[1]
     check_call(['zip', '-D', '-X', zip_name] + file_list, cwd=REPO_DIR)
 
@@ -156,7 +158,9 @@ def build_arch(name):
     check_call(['make', '-C', 'external', 'clean', 'tor'], cwd=REPO_DIR)
     copy(os.path.join(REPO_DIR, 'external', 'bin', 'tor'), os.path.join(REPO_DIR, 'tor'))
     check_call(['strip', '-D', 'tor'], cwd=REPO_DIR)
-    reset_time(os.path.join(REPO_DIR, 'tor'))
+    tor_path = os.path.join(REPO_DIR, 'tor')
+    reset_time(tor_path)
+    print("Sha256 hash of tor before zipping %s: %s" % (name, get_sha256(tor_path)))
     check_call(['zip', '-X', name, 'tor'], cwd=REPO_DIR)
 
 
-- 
GitLab