[tor-commits] [tor-messenger-build/esr52] Update support for deterministic builds (#10942)

sukhbir at torproject.org sukhbir at torproject.org
Sat Sep 2 01:42:08 UTC 2017


commit c10f07ab7c9f9ba884364019cef9a74863d16427
Author: Sukhbir Singh <sukhbir at torproject.org>
Date:   Fri Aug 25 12:15:08 2017 -0400

    Update support for deterministic builds (#10942)
---
 projects/instantbird/build              | 12 ++++++++++++
 projects/instantbird/config             |  1 +
 projects/instantbird/get-moz-build-date | 16 ++++++++++++++++
 rbm.conf                                |  1 +
 4 files changed, 30 insertions(+)

diff --git a/projects/instantbird/build b/projects/instantbird/build
index b64c8d7..a963d19 100644
--- a/projects/instantbird/build
+++ b/projects/instantbird/build
@@ -53,6 +53,18 @@ mv mozilla-* /var/tmp/build/[% project %]-[% c('version') %]/mozilla
 
 cd /var/tmp/build/[% project %]-[% c('version') %]
 
+eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] $(cat im/config/version.txt))
+if [ -z $MOZ_BUILD_DATE ]
+then
+    echo "MOZ_BUILD_DATE is not set"
+    exit 1
+fi
+
+[% IF c("var/windows") %]
+  # Make sure widl is not inserting random timestamps, see #21837.
+  export WIDL_TIME_OVERRIDE="0"
+[% END %]
+
 for patch in $(ls -1 $rootdir/*.patch | sort)
 do
   git apply -p1 < $patch
diff --git a/projects/instantbird/config b/projects/instantbird/config
index b9e5e42..3fa05ec 100644
--- a/projects/instantbird/config
+++ b/projects/instantbird/config
@@ -71,6 +71,7 @@ input_files:
   - filename: 0020-Update-allowed-duplicated-files-for-Windows-and-Linu.patch
   - filename: 0021-Bug-13855-Use-known-onions-for-XMPP-servers.patch
   - filename: 0022-Bug-16606-Automatic-XMPP-accounts.patch
+  - filename: get-moz-build-date
   - filename: mozconfig-common
   - filename: 'mozconfig-[% c("var/osname") %]'
     name: mozconfig
diff --git a/projects/instantbird/get-moz-build-date b/projects/instantbird/get-moz-build-date
new file mode 100644
index 0000000..fb7298a
--- /dev/null
+++ b/projects/instantbird/get-moz-build-date
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+# Generate a MOZ_BUILD_DATE based on firefox version number
+
+use strict;
+
+die "wrong number of arguments" unless @ARGV == 2;
+my ($year, $version) = @ARGV;
+$version =~ s/\D+$//;
+my @v = split(/[\.ab]/, $version);
+push @v, '0' if @v < 4;
+push @v, '0' if @v < 4;
+my $day_of_month = int(($v[0] - 45) / 5);
+my $date = 101010101 + $year * 10000000000 + $day_of_month * 1000000
+           + $v[1] * 10000 + $v[2] * 100 + $v[3];
+$date += 100000000 unless $version =~ m/[ab]/;
+print "export MOZ_BUILD_DATE=$date\n";
diff --git a/rbm.conf b/rbm.conf
index b7b73e3..19a0c4d 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -36,6 +36,7 @@ var:
     [% c("input_files_by_name/" _ file) %]
     [% END -%]
 
+  faketime: "faketime -f \"[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]\""
   touch: "[% USE date %]touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %]"
 
   sign_build: '[% ENV.RBM_SIGN_BUILD %]'





More information about the tor-commits mailing list