get-moz-build-date 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/perl -w
  2. # Generate a MOZ_BUILD_DATE based on Tor Browser version number
  3. use strict;
  4. die "wrong number of arguments" unless @ARGV == 2;
  5. my ($year, $version) = @ARGV;
  6. my $date;
  7. if ($version =~ m/^tbb-nightly\.([^\.]+)\.([^\.]+)\.([^\.]+)$/) {
  8. $date = sprintf("%d%02d%02d010101", $1, $2, $3);
  9. } elsif ($version eq 'testbuild') {
  10. # There is no need for an increasing build date in test builds. Just hardcode
  11. # it to a value that is compatible with the v1 versionCode scheme on Android,
  12. # see: #34163. We adjust the date to the new cutoff according to
  13. # https://github.com/mozilla-mobile/fenix/pull/14952, following Mozilla.
  14. # This should be unproblematic for test builds anyway.
  15. $date = 20141228000000;
  16. } else {
  17. my @v = split(/[\.ab]/, $version);
  18. push @v, '0' if @v < 4;
  19. push @v, '0' if @v < 4;
  20. # When MOZ_BUILD_DATE was based on the firefox version, with
  21. # Tor Browser 8.0.6 and firefox 60.5.1 it was 20190204060201
  22. # We can remove 5 from the month, while keeping it increasing.
  23. my $month = $v[0] - 5;
  24. $date = 1010101 + $year * 10000000000 + $month * 100000000
  25. + $v[1] * 1000000 + $v[2] * 10000 + $v[3];
  26. $date += 1000000 unless $version =~ m/[ab]/;
  27. }
  28. print "export MOZ_BUILD_DATE=$date\n";