[tor-commits] [tor-browser-build/master] Bug 25101: Add support for generating nightly incremental mars

gk at torproject.org gk at torproject.org
Tue Nov 26 21:52:07 UTC 2019


commit d4460a92659808f8d29547197e23cb6defcf2f35
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Mon Nov 18 19:19:12 2019 +0100

    Bug 25101: Add support for generating nightly incremental mars
---
 Makefile                                     |  5 +++++
 README.MAKEFILE                              | 14 +++++++++++++-
 projects/release/hash_incrementals           |  6 +++++-
 projects/release/update_responses_config     | 11 ++++++-----
 projects/release/update_responses_config.yml |  5 +++--
 rbm.conf                                     | 19 +++++++++++++++++++
 tools/update-responses/update_responses      |  3 ++-
 7 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 6edb7e3..6d82f93 100644
--- a/Makefile
+++ b/Makefile
@@ -164,6 +164,11 @@ incrementals-alpha: submodule-update
 	tools/update-responses/gen_incrementals alpha
 	$(rbm) build release --step hash_incrementals --target alpha
 
+incrementals-nightly: submodule-update
+	$(rbm) build release --step update_responses_config --target nightly
+	NO_CODESIGNATURE=1 tools/update-responses/gen_incrementals nightly
+	$(rbm) build release --step hash_incrementals --target nightly
+
 update_responses-release: submodule-update
 	$(rbm) build release --step update_responses_config --target release --target signed
 	$(rbm) build release --step create_update_responses_tar --target release --target signed
diff --git a/README.MAKEFILE b/README.MAKEFILE
index e07224e..62b54df 100644
--- a/README.MAKEFILE
+++ b/README.MAKEFILE
@@ -82,7 +82,19 @@ build number defined as var/torbrowser_version and var/torbrowser_build.
 incrementals-{release,alpha}
 ----------------------------
 Create incremental mar files for an unsigned build in the release or
-alpha channel.
+alpha channel. The list of versions we create incrementals from is
+defined as var/torbrowser_incremental_from in rbm.conf.
+
+incrementals-nightly
+--------------------
+Create incremental mar files for the current nightly build. The number
+of previous versions we should generate incremental mars from is defined
+as var/max_torbrowser_incremental_from in rbm.conf.
+
+If you want to create incremental mars for a version that is not the
+current one, you can define the environment variable
+TORBROWSER_NIGHTLY_VERSION to the version you want to generate
+incremental mars for.
 
 dmg2mar-{release,alpha)
 -----------------------
diff --git a/projects/release/hash_incrementals b/projects/release/hash_incrementals
index 9cf1b27..ba95ac7 100644
--- a/projects/release/hash_incrementals
+++ b/projects/release/hash_incrementals
@@ -1,4 +1,8 @@
 #!/bin/bash
 [% c("var/set_default_env") -%]
-cd [% shell_quote(path(dest_dir)) %]/[% c("var/signed_status") %]/[%  c("version") %]-[% c("var/torbrowser_build") %]
+[% IF c("var/nightly") -%]
+  cd [% shell_quote(path(dest_dir)) %]/[%  c("version") %]
+[% ELSE -%]
+  cd [% shell_quote(path(dest_dir)) %]/[% c("var/signed_status") %]/[% c("version") %]-[% c("var/torbrowser_build") %]
+[% END -%]
 sha256sum `ls -1 | grep '\.incremental\.mar$' | sort` > sha256sums-[% c("var/signed_status") %]-build.incrementals.txt
diff --git a/projects/release/update_responses_config b/projects/release/update_responses_config
index 4ff470d..ce1d846 100644
--- a/projects/release/update_responses_config
+++ b/projects/release/update_responses_config
@@ -4,8 +4,9 @@ cat > [% shell_quote(c("basedir")) %]/tools/update-responses/config.yml << 'EOF'
 [% INCLUDE update_responses_config.yml -%]
 EOF
 
-# Update / create symlink $torbrowser_version -> $torbrowser_version-buildN
-versiondir=[% shell_quote(path(dest_dir)) _ '/' _ c("var/signed_status") _ '/' _ c("version") %]
-test -L "$versiondir" && rm -f "$versiondir"
-test -d "$versiondir" || ln -s [% shell_quote(c("version")) %]-[% shell_quote(c("var/torbrowser_build")) %] "$versiondir"
-
+[% IF ! c("var/nightly") -%]
+  # Update / create symlink $torbrowser_version -> $torbrowser_version-buildN
+  versiondir=[% shell_quote(path(dest_dir)) _ '/' _ c("var/signed_status") _ '/' _ c("version") %]
+  test -L "$versiondir" && rm -f "$versiondir"
+  test -d "$versiondir" || ln -s [% shell_quote(c("version")) %]-[% shell_quote(c("var/torbrowser_build")) %] "$versiondir"
+[% END -%]
diff --git a/projects/release/update_responses_config.yml b/projects/release/update_responses_config.yml
index f2542d6..85a1d43 100644
--- a/projects/release/update_responses_config.yml
+++ b/projects/release/update_responses_config.yml
@@ -5,7 +5,7 @@ appname_bundle_osx: TorBrowser
 appname_bundle_linux: tor-browser
 appname_bundle_win32: torbrowser-install
 appname_bundle_win64: torbrowser-install-win64
-releases_dir: [% path(c('output_dir')) %]/signed
+releases_dir: [% path(c('output_dir')) %][% IF ! c("var/nightly") %]/signed[% END %]
 download:
     archive_url: https://archive.torproject.org/tor-package-archive/torbrowser
     gpg_keyring: ../../keyring/torbrowser.gpg
@@ -31,7 +31,8 @@ versions:
         platformVersion: [% pc('firefox', 'var/firefox_platform_version') %]
         detailsURL: https://blog.torproject.org/new-release-tor-browser-[% c("var/torbrowser_version") FILTER remove('\.') %]
         incremental_from:
-[% FOREACH v IN c("var/torbrowser_incremental_from") -%]
+[% SET incr_from = c("var/nightly") ? c("var_p/nightly_torbrowser_incremental_from") : c("var/torbrowser_incremental_from");
+   FOREACH v IN incr_from -%]
           - [% v %]
 [% END -%]
         migrate_archs:
diff --git a/rbm.conf b/rbm.conf
index 15d8ef1..cb5e972 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -154,6 +154,7 @@ targets:
         - es-ES
         - fr
         - ru
+      max_torbrowser_incremental_from: 2
 
   torbrowser-testbuild:
     - testbuild
@@ -521,5 +522,23 @@ ENV:
         $version = sprintf("tbb-nightly.%u.%02u.%02u", $year + 1900, $mon + 1, $day);
         return $version;
       },
+      nightly_torbrowser_incremental_from => sub {
+        my ($project, $options) = @_;
+        my $nightly_dir = project_config($project, 'basedir', $options) . '/nightly';
+        my $current_version = project_config($project, 'var/torbrowser_version', $options);
+        use Path::Tiny;
+        return [] unless -d $nightly_dir;
+        my @dirs = sort map { $_->basename } path($nightly_dir)->children(qr/^tbb-nightly\./);
+        my $nb_incr = project_config($project, ['var', 'max_torbrowser_incremental_from'], $options);
+        my @res;
+        while ($nb_incr > 0) {
+          my $dir = pop @dirs;
+          last unless $dir;
+          next if $dir eq $current_version;
+          $nb_incr--;
+          push @res, $dir;
+        }
+        return [@res];
+      },
     },
   )
diff --git a/tools/update-responses/update_responses b/tools/update-responses/update_responses
index 59cd2ef..3dfd05d 100755
--- a/tools/update-responses/update_responses
+++ b/tools/update-responses/update_responses
@@ -220,7 +220,8 @@ sub create_incremental_mar {
     extract_mar(mar_filename($config, $appname, $new_version, $os, $lang),
                 "$tmpdir/B", $mar_c_new);
     # bug 26054: make sure previous macOS version is code signed
-    if (($os eq 'osx64') && ! -f "$tmpdir/A/Contents/_CodeSignature/CodeResources") {
+    if (!$ENV{NO_CODESIGNATURE} && ($os eq 'osx64')
+                && ! -f "$tmpdir/A/Contents/_CodeSignature/CodeResources") {
         exit_error "Missing code signature in $from_version while creating $mar_file";
     }
     if ($ENV{CHECK_CODESIGNATURE_EXISTS}) {



More information about the tor-commits mailing list