[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser-build][main] Bug 40089: Change how we set MOZ_BUILD_DATE



Title: GitLab

boklm pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

  • 69317005
    by Nicolas Vigier at 2023-07-14T09:49:46+02:00
    Bug 40089: Change how we set MOZ_BUILD_DATE
    
    For normal alpha/release builds, we use the date from the commit, on
    which we add the numbers from the version string as seconds (in order to
    keep increasing the build date when we release a new version without
    adding new commits).
    
    For nightly-testbuild, we use the date from the commit.
    
    For nightly we try to parse the day from the version number, or use the
    current day at 00:00:01.
    

9 changed files:

Changes:

  • projects/android-components/build
    ... ... @@ -9,10 +9,6 @@ builddir=/var/tmp/build/[% project %]
    9 9
     mkdir $distdir/[% project %]
    
    10 10
     mkdir /var/tmp/build
    
    11 11
     
    
    12
    -cat > get-moz-build-date << "EOF"
    
    13
    -[% INCLUDE "get-moz-build-date" %]
    
    14
    -EOF
    
    15
    -
    
    16 12
     [% IF !c("var/fetch_gradle_dependencies") %]
    
    17 13
       tar -C $distdir -xf [% c('input_files_by_name/geckoview') %]
    
    18 14
       gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
    
    ... ... @@ -60,12 +56,7 @@ sed -i 's/tag = getGitHash()/tag = \"[% c('abbrev') %]\"/' publish.gradle
    60 56
       export LANG=C.UTF-8
    
    61 57
       patch -p1 < $rootdir/mavenLocal.patch
    
    62 58
     
    
    63
    -  eval $(perl $rootdir/get-moz-build-date [% pc("fenix", "var/copyright_year") %] [% pc("fenix", "var/torbrowser_version") %])
    
    64
    -  if [ -z $MOZ_BUILD_DATE ]
    
    65
    -  then
    
    66
    -    echo "MOZ_BUILD_DATE is not set"
    
    67
    -    exit 1
    
    68
    -  fi
    
    59
    +  [% c("var/set_MOZ_BUILD_DATE") %]
    
    69 60
     
    
    70 61
       # Increase the maximum memory usage, for when compiling with --disable-install-strip
    
    71 62
       gradle_args="--offline --no-daemon -Dmaven.repo.local=$gradle_repo -Dorg.gradle.jvmargs=-Xmx8g"
    

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

  • projects/fenix/build
    ... ... @@ -9,10 +9,6 @@ builddir=/var/tmp/build/[% project %]
    9 9
     mkdir -p $distdir/[% project %]
    
    10 10
     mkdir -p /var/tmp/build
    
    11 11
     
    
    12
    -cat > get-moz-build-date << "EOF"
    
    13
    -[% INCLUDE "get-moz-build-date" %]
    
    14
    -EOF
    
    15
    -
    
    16 12
     [% IF !c("var/fetch_gradle_dependencies") %]
    
    17 13
       tar -C $distdir -xf [% c('input_files_by_name/geckoview') %]
    
    18 14
       gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
    
    ... ... @@ -71,12 +67,7 @@ v=[% c("variant") %]
    71 67
       export LANG=C.UTF-8
    
    72 68
       patch -p1 < $rootdir/mavenLocal.patch
    
    73 69
     
    
    74
    -  eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
    
    75
    -  if [ -z $MOZ_BUILD_DATE ]
    
    76
    -  then
    
    77
    -    echo "MOZ_BUILD_DATE is not set"
    
    78
    -    exit 1
    
    79
    -  fi
    
    70
    +  [% c("var/set_MOZ_BUILD_DATE") %]
    
    80 71
     
    
    81 72
       # Bug 40485: Inject deterministic build date into Glean.
    
    82 73
       echo "ext.gleanBuildDate = \"0\"" >> app/build.gradle
    

  • projects/firefox/build
    ... ... @@ -70,12 +70,7 @@ MOZCONFIG_EOF
    70 70
       export ASAN_OPTIONS="detect_leaks=0"
    
    71 71
     [% END -%]
    
    72 72
     
    
    73
    -eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
    
    74
    -if [ -z $MOZ_BUILD_DATE ]
    
    75
    -then
    
    76
    -    echo "MOZ_BUILD_DATE is not set"
    
    77
    -    exit 1
    
    78
    -fi
    
    73
    +[% c("var/set_MOZ_BUILD_DATE") %]
    
    79 74
     
    
    80 75
     [% IF c("var/windows") %]
    
    81 76
       # Make sure widl is not inserting random timestamps, see #21837.
    

  • projects/firefox/config
    ... ... @@ -153,7 +153,6 @@ input_files:
    153 153
       - project: container-image
    
    154 154
       - name: '[% c("var/compiler") %]'
    
    155 155
         project: '[% c("var/compiler") %]'
    
    156
    -  - filename: get-moz-build-date
    
    157 156
       - project: binutils
    
    158 157
         name: binutils
    
    159 158
         enable: '[% c("var/linux") %]'
    

  • projects/firefox/get-moz-build-date deleted
    1
    -#!/usr/bin/perl -w
    
    2
    -# Generate a MOZ_BUILD_DATE based on Tor Browser version number
    
    3
    -
    
    4
    -use strict;
    
    5
    -
    
    6
    -die "wrong number of arguments" unless @ARGV == 2;
    
    7
    -my ($year, $version) = @ARGV;
    
    8
    -my $date;
    
    9
    -if ($version =~ m/^tbb-nightly\.([^\.]+)\.([^\.]+)\.([^\.]+)$/) {
    
    10
    -  $date = sprintf("%d%02d%02d010101", $1, $2, $3);
    
    11
    -} elsif ($version eq 'testbuild') {
    
    12
    -  # There is no need for an increasing build date in test builds. Just hardcode
    
    13
    -  # it.
    
    14
    -  $date = 20010101010101;
    
    15
    -} else {
    
    16
    -  my @v = split(/[\.ab]/, $version);
    
    17
    -  push @v, '0' if @v < 4;
    
    18
    -  push @v, '0' if @v < 4;
    
    19
    -  # When MOZ_BUILD_DATE was based on the firefox version, with
    
    20
    -  # Tor Browser 8.0.6 and firefox 60.5.1 it was 20190204060201
    
    21
    -  # We can remove 5 from the month, while keeping it increasing.
    
    22
    -  my $month = $v[0] - 5;
    
    23
    -  $date = 1010101 + $year * 10000000000 + $month * 100000000
    
    24
    -             + $v[1] * 1000000 + $v[2] * 10000 + $v[3];
    
    25
    -  $date += 1000000 unless $version =~ m/[ab]/;
    
    26
    -}
    
    27
    -print "export MOZ_BUILD_DATE=$date\n";

  • projects/geckoview/build
    ... ... @@ -8,13 +8,6 @@ distdir=/var/tmp/dist
    8 8
     mkdir -p /var/tmp/build
    
    9 9
     mkdir -p $distdir/[% project %]
    
    10 10
     
    
    11
    -# We need to have the get-moz-build-date script available in the container
    
    12
    -# but we can't include it via input_files as it is a script shared between
    
    13
    -# projects.
    
    14
    -cat > get-moz-build-date << "EOF"
    
    15
    -[% INCLUDE "get-moz-build-date" %]
    
    16
    -EOF
    
    17
    -
    
    18 11
     tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %]
    
    19 12
     tar -C /var/tmp/dist -xf [% c('input_files_by_name/cbindgen') %]
    
    20 13
     tar -C /var/tmp/dist -xf [% c('input_files_by_name/nasm') %]
    
    ... ... @@ -49,12 +42,7 @@ export MOZ_SOURCE_REPO="[% c('var/gitlab_project') %]"
    49 42
     export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %]
    
    50 43
     MOZCONFIG_EOF
    
    51 44
     
    
    52
    -eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
    
    53
    -if [ -z $MOZ_BUILD_DATE ]
    
    54
    -then
    
    55
    -    echo "MOZ_BUILD_DATE is not set"
    
    56
    -    exit 1
    
    57
    -fi
    
    45
    +[% c("var/set_MOZ_BUILD_DATE") %]
    
    58 46
     
    
    59 47
     export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64
    
    60 48
     gradle_repo=/var/tmp/dist/gradle-dependencies
    

  • projects/geckoview/config
    ... ... @@ -48,10 +48,6 @@ steps:
    48 48
           mkdir -p /var/tmp/build
    
    49 49
           mkdir -p $distdir/[% project %]
    
    50 50
     
    
    51
    -      cat > get-moz-build-date << "EOF"
    
    52
    -      [% INCLUDE "get-moz-build-date" %]
    
    53
    -      EOF
    
    54
    -
    
    55 51
           tar -C $distdir -xf [% c('input_files_by_name/node') %]
    
    56 52
           export PATH="/var/tmp/dist/node/bin:$PATH"
    
    57 53
     
    
    ... ... @@ -73,12 +69,7 @@ steps:
    73 69
           ln -s mozconfig-android-all .mozconfig
    
    74 70
           echo 'mk_add_options MOZ_PARALLEL_BUILD=[% c("num_procs") %]' >> .mozconfig
    
    75 71
     
    
    76
    -      eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
    
    77
    -      if [ -z $MOZ_BUILD_DATE ]
    
    78
    -      then
    
    79
    -          echo "MOZ_BUILD_DATE is not set"
    
    80
    -          exit 1
    
    81
    -      fi
    
    72
    +      [% c("var/set_MOZ_BUILD_DATE") %]
    
    82 73
     
    
    83 74
           export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64
    
    84 75
           gradle_repo=/var/tmp/dist/gradle-dependencies
    

  • rbm.conf
    ... ... @@ -218,6 +218,7 @@ var:
    218 218
         [% END -%]
    
    219 219
     
    
    220 220
       DOCSDIR_project: '[% project %]'
    
    221
    +  set_MOZ_BUILD_DATE: 'export MOZ_BUILD_DATE=[% c("var_p/MOZ_BUILD_DATE") %]'
    
    221 222
     
    
    222 223
     targets:
    
    223 224
       notarget: linux-x86_64
    
    ... ... @@ -717,5 +718,31 @@ gpg_allow_expired_keys: 1
    717 718
             }
    
    718 719
             return [@res];
    
    719 720
           },
    
    721
    +      MOZ_BUILD_DATE => sub {
    
    722
    +        use POSIX qw(strftime);
    
    723
    +        my ($project, $options) = @_;
    
    724
    +        my $nightly = project_config($project, 'var/nightly', $options);
    
    725
    +        my $testbuild = project_config($project, 'var/testbuild', $options);
    
    726
    +
    
    727
    +        if ($nightly && !$testbuild) {
    
    728
    +          my $torbrowser_version = project_config($project, 'var/torbrowser_version', $options);
    
    729
    +          return sprintf("%d%02d%02d000001", $1, $2, $3)
    
    730
    +            if $torbrowser_version =~ m/^tbb-nightly\.([^\.]+)\.([^\.]+)\.([^\.]+)$/;
    
    731
    +          return strftime("%Y%m%d000001", gmtime);
    
    732
    +        }
    
    733
    +
    
    734
    +        my $timestamp = project_config($project, 'timestamp', $options);
    
    735
    +        if (!$nightly) {
    
    736
    +          my $torbrowser_version = project_config($project, 'var/torbrowser_version', $options);
    
    737
    +          my @n = reverse split /[\.\D]/, $torbrowser_version;
    
    738
    +          my $i = 1;
    
    739
    +          unshift @n, 0 if @n < 3;
    
    740
    +          for my $n (@n) {
    
    741
    +            $timestamp += $n * $i;
    
    742
    +            $i = $i * 10;
    
    743
    +          }
    
    744
    +        }
    
    745
    +        return strftime "%Y%m%d%H%M%S", gmtime($timestamp);
    
    746
    +      },
    
    720 747
         },
    
    721 748
       )

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits