[tbb-commits] [tor-browser-build/master] Bug 31538: Make Windows builds reproducible again

boklm at torproject.org boklm at torproject.org
Wed Sep 18 06:05:45 UTC 2019


commit a7a90d35e55bb8f9886fd9d827b01eba2060c74b
Author: Georg Koppen <gk at torproject.org>
Date:   Fri Sep 13 06:51:04 2019 +0000

    Bug 31538: Make Windows builds reproducible again
    
    Updating CMake to the latest stable version as done in the previous
    commit solves the reproducibility issue only partly. We need to patch
    the code that merges libc++abi.a into libc++.a to get the order in the
    merged archive deterministic. The code doing the merging is:
    
    `files = glob.glob(os.path.join(temp_directory_root, '*.o*'))`
    
    Regarding `glob` there is following in the Python docs:
    
    "The glob module finds all the pathnames matching a specified pattern
     according to the rules used by the Unix shell, although results are
     returned in *arbitrary* order." (emphasis mine)
    
    (https://docs.python.org/2/library/glob.html)
---
 projects/mingw-w64-clang/build      |  1 +
 projects/mingw-w64-clang/config     |  1 +
 projects/mingw-w64-clang/sort.patch | 22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/projects/mingw-w64-clang/build b/projects/mingw-w64-clang/build
index 86c3c6e..fa059da 100644
--- a/projects/mingw-w64-clang/build
+++ b/projects/mingw-w64-clang/build
@@ -173,6 +173,7 @@ make -j[% c("buildconf/num_procs") %] VERBOSE=1
 
 # libcxx
 cd $builddir/libcxx
+patch -p1 < $rootdir/sort.patch
 mkdir build && cd build
 cmake -DCMAKE_BUILD_TYPE=Release \
       -DCMAKE_INSTALL_PREFIX=$distdir/[% c("arch") %]-w64-mingw32 \
diff --git a/projects/mingw-w64-clang/config b/projects/mingw-w64-clang/config
index 3d209ea..32d18a8 100644
--- a/projects/mingw-w64-clang/config
+++ b/projects/mingw-w64-clang/config
@@ -36,3 +36,4 @@ input_files:
   - project: llvm-mingw
     name: llvm-mingw
   - filename: mingw-winrt.patch
+  - filename: sort.patch
diff --git a/projects/mingw-w64-clang/sort.patch b/projects/mingw-w64-clang/sort.patch
new file mode 100644
index 0000000..e9143b0
--- /dev/null
+++ b/projects/mingw-w64-clang/sort.patch
@@ -0,0 +1,22 @@
+From 9eeb3b9ea13b25591c9081a5f05a1904d367d523 Mon Sep 17 00:00:00 2001
+From: Georg Koppen <gk at torproject.org>
+Date: Wed, 11 Sep 2019 13:25:54 +0000
+Subject: [PATCH] sorted
+
+
+diff --git a/utils/merge_archives.py b/utils/merge_archives.py
+index 58d92f0e2..597ca2471 100755
+--- a/utils/merge_archives.py
++++ b/utils/merge_archives.py
+@@ -124,7 +124,7 @@ def main():
+         execute_command_verbose([ar_exe, 'x', arc], cwd=temp_directory_root,
+                                 verbose=args.verbose)
+ 
+-    files = glob.glob(os.path.join(temp_directory_root, '*.o*'))
++    files = sorted(glob.glob(os.path.join(temp_directory_root, '*.o*')))
+     if not files:
+         print_and_exit('Failed to glob for %s' % temp_directory_root)
+     cmd = [ar_exe, 'qcs', args.output] + files
+-- 
+2.23.0
+



More information about the tbb-commits mailing list