[tbb-commits] [tor-browser-build/master] Bug 28685: Set Build ID based on Tor Browser version

gk at torproject.org gk at torproject.org
Thu Feb 28 11:57:10 UTC 2019


commit d11f03f7c10c2cf5a942a353d0961249ceee9644
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Wed Feb 20 20:15:19 2019 +0100

    Bug 28685: Set Build ID based on Tor Browser version
---
 projects/firefox/build              |  2 +-
 projects/firefox/get-moz-build-date | 26 +++++++++++++++++---------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/projects/firefox/build b/projects/firefox/build
index 1544c11..aa0a34f 100644
--- a/projects/firefox/build
+++ b/projects/firefox/build
@@ -113,7 +113,7 @@ mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig
   tar -C /var/tmp/dist/locales -xf $rootdir/[% c('input_files_by_name/firefox-locale-bundle') %]
 [% END %]
 
-eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] $(cat browser/config/version.txt))
+eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %]
 if [ -z $MOZ_BUILD_DATE ]
 then
     echo "MOZ_BUILD_DATE is not set"
diff --git a/projects/firefox/get-moz-build-date b/projects/firefox/get-moz-build-date
index fb7298a..4e55c92 100755
--- a/projects/firefox/get-moz-build-date
+++ b/projects/firefox/get-moz-build-date
@@ -1,16 +1,24 @@
 #!/usr/bin/perl -w
-# Generate a MOZ_BUILD_DATE based on firefox version number
+# Generate a MOZ_BUILD_DATE based on Tor Browser 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]/;
+my $date;
+if ($version eq 'tbb-nightly') {
+  my (undef, undef, undef, $day, $mon, $y) = localtime;
+  $date = sprintf("%d%02d%02d010101", $y + 1900, $mon + 1, $day);
+} else {
+  my @v = split(/[\.ab]/, $version);
+  push @v, '0' if @v < 4;
+  push @v, '0' if @v < 4;
+  # When MOZ_BUILD_DATE was based on the firefox version, with
+  # Tor Browser 8.0.6 and firefox 60.5.1 it was 20190204060201
+  # We can remove 5 from the month, while keeping it increasing.
+  my $month = $v[0] - 5;
+  $date = 1010101 + $year * 10000000000 + $month * 100000000
+             + $v[1] * 1000000 + $v[2] * 10000 + $v[3];
+  $date += 1000000 unless $version =~ m/[ab]/;
+}
 print "export MOZ_BUILD_DATE=$date\n";



More information about the tbb-commits mailing list