[tbb-commits] [tor-browser-build/master] Bug 26059: Use signed directory when generating incremental mars

gk at torproject.org gk at torproject.org
Wed May 23 12:27:51 UTC 2018


commit ae1c8fd96fdb9f3208a84cca6ec9c8d546ada459
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Mon May 21 13:14:13 2018 +0200

    Bug 26059: Use signed directory when generating incremental mars
    
    We update the update_responses script to be able to specify a different
    $releases_dir for each version. When generating incremental mars, this
    allows us to set the default releases_dir to {alpha,release}/signed and
    the current version's releases_dir to {alpha,release}/unsigned.
---
 Makefile                                     |  4 ++--
 projects/release/config                      |  4 ++++
 projects/release/update_responses_config.yml |  5 ++++-
 tools/update-responses/update_responses      | 27 ++++++++++++++++-----------
 4 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 2707d41..4c21a83 100644
--- a/Makefile
+++ b/Makefile
@@ -111,13 +111,13 @@ signtag-alpha: submodule-update
 	$(rbm) build release --step signtag --target alpha
 
 incrementals-release: submodule-update
-	$(rbm) build release --step update_responses_config --target release
+	$(rbm) build release --step update_responses_config --target release --target create_unsigned_incrementals
 	tools/update-responses/download_missing_versions release
 	tools/update-responses/gen_incrementals release
 	$(rbm) build release --step hash_incrementals --target release
 
 incrementals-alpha: submodule-update
-	$(rbm) build release --step update_responses_config --target alpha
+	$(rbm) build release --step update_responses_config --target alpha --target create_unsigned_incrementals
 	tools/update-responses/download_missing_versions alpha
 	tools/update-responses/gen_incrementals alpha
 	$(rbm) build release --step hash_incrementals --target alpha
diff --git a/projects/release/config b/projects/release/config
index e48fb01..2aba446 100644
--- a/projects/release/config
+++ b/projects/release/config
@@ -73,6 +73,10 @@ targets:
     var:
       signed_status: signed
 
+  create_unsigned_incrementals:
+    var:
+      create_unsigned_incrementals: 1
+
 input_files:
 
 # Release
diff --git a/projects/release/update_responses_config.yml b/projects/release/update_responses_config.yml
index 01c6950..1a9b0cf 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')) %]/[% c("var/signed_status") %]
+releases_dir: [% path(c('output_dir')) %]/signed
 download:
     archive_url: https://archive.torproject.org/tor-package-archive/torbrowser
     gpg_keyring: ../../keyring/torbrowser.gpg
@@ -25,6 +25,9 @@ channels:
     [% pc('firefox', 'var/torbrowser_update_channel') %]: [% c("var/torbrowser_version") %]
 versions:
     [% c("var/torbrowser_version") %]:
+[% IF c("var/create_unsigned_incrementals") -%]
+        releases_dir: [% path(c('output_dir')) %]/unsigned
+[% END -%]
         platformVersion: [% pc('firefox', 'var/firefox_platform_version') %]
         detailsURL: https://blog.torproject.org/tor-browser-[% c("var/torbrowser_version") FILTER remove('\.') %]-released
         incremental_from:
diff --git a/tools/update-responses/update_responses b/tools/update-responses/update_responses
index 658f451..bf2415d 100755
--- a/tools/update-responses/update_responses
+++ b/tools/update-responses/update_responses
@@ -92,7 +92,7 @@ sub get_version_files {
     return if $config->{versions}{$version}{files};
     my $appname = $config->{appname_marfile};
     my $files = {};
-    my $vdir = "$releases_dir/$version";
+    my $vdir = version_dir($config, $version);
     my $download_url = "$config->{download}{mars_url}/$version";
     opendir(my $d, $vdir) or exit_error "Error opening directory $vdir";
     foreach my $file (readdir $d) {
@@ -126,7 +126,7 @@ sub get_version_files {
 sub get_version_downloads {
     my ($config, $version) = @_;
     my $downloads = {};
-    my $vdir = "$releases_dir/$version";
+    my $vdir = version_dir($config, $version);
     my $download_url = "$config->{download}{bundles_url}/$version";
     opendir(my $d, $vdir) or exit_error "Error opening directory $vdir";
     foreach my $file (readdir $d) {
@@ -179,15 +179,15 @@ sub extract_mar {
 }
 
 sub mar_filename {
-    my ($appname, $version, $os, $lang) = @_;
-    "$releases_dir/$version/$appname-$os-${version}_$lang.mar";
+    my ($config, $appname, $version, $os, $lang) = @_;
+    version_dir($config, $version) .  "/$appname-$os-${version}_$lang.mar";
 }
 
 sub create_incremental_mar {
     my ($config, $pm, $from_version, $new_version, $os, $lang) = @_;
     my $appname = $config->{appname_marfile};
     my $mar_file = "$appname-$os-${from_version}-${new_version}_$lang.incremental.mar";
-    my $mar_file_path = "$releases_dir/$new_version/$mar_file";
+    my $mar_file_path = version_dir($config, $new_version) . '/' . $mar_file;
     if ($ENV{MAR_SKIP_EXISTING} && -f $mar_file_path) {
         print "Skipping $mar_file\n";
         return;
@@ -207,8 +207,8 @@ sub create_incremental_mar {
     };
     return if $pm->start($finished_file);
     my $tmpdir = get_tmpdir($config);
-    extract_mar(mar_filename($appname, $from_version, $os, $lang), "$tmpdir/A");
-    extract_mar(mar_filename($appname, $new_version, $os, $lang), "$tmpdir/B");
+    extract_mar(mar_filename($config, $appname, $from_version, $os, $lang), "$tmpdir/A");
+    extract_mar(mar_filename($config, $appname, $new_version, $os, $lang), "$tmpdir/B");
     if ($ENV{CHECK_CODESIGNATURE_EXISTS}) {
         unless (-f "$tmpdir/A/Contents/_CodeSignature/CodeResources"
             && -f "$tmpdir/B/Contents/_CodeSignature/CodeResources") {
@@ -250,6 +250,11 @@ sub get_config {
         // $config->{$name};
 }
 
+sub version_dir {
+    my ($config, $version) = @_;
+    return get_config($config, $version, 'any', 'releases_dir') . "/$version";
+}
+
 sub channel_to_version {
     my ($config, @channels) = @_;
     return values %{$config->{channels}} unless @channels;
@@ -270,7 +275,7 @@ sub get_buildinfos {
             next unless $files->{$os}{$lang}{complete};
             my $tmpdir = get_tmpdir($config);
             extract_mar(
-                mar_filename($config->{appname_marfile}, $version, $os, $lang),
+                mar_filename($config, $config->{appname_marfile}, $version, $os, $lang),
                 "$tmpdir");
             my $appfile = "$tmpdir/application.ini" if -f "$tmpdir/application.ini";
             $appfile = "$tmpdir/Contents/Resources/application.ini"
@@ -423,7 +428,7 @@ my $martools_tmpdir;
 sub extract_martools {
     my ($config, $version) = @_;
     my $osname = osname;
-    my $marzip = "$releases_dir/$version/mar-tools-$osname.zip";
+    my $marzip = version_dir($config, $version) . "/mar-tools-$osname.zip";
     $martools_tmpdir = get_tmpdir($config);
     my $old_cwd = getcwd;
     chdir $martools_tmpdir;
@@ -523,7 +528,7 @@ sub check_update_responses_channel {
 sub download_version {
     my ($config, $version) = @_;
     my $tmpdir = get_tmpdir($config);
-    my $destdir = "$releases_dir/$version";
+    my $destdir = version_dir($config, $version);
     my $urldir = "$config->{download}{archive_url}/$version";
     print "Downloading version $version\n";
     foreach my $file (qw(sha256sums-signed-build.txt sha256sums-signed-build.txt.asc)) {
@@ -576,7 +581,7 @@ sub download_missing_versions {
         my $cversion = $config->{channels}{$channel};
         next unless $config->{versions}{$cversion}{incremental_from};
         foreach my $version (@{$config->{versions}{$cversion}{incremental_from}}) {
-            next if -d "$releases_dir/$version";
+            next if -d version_dir($config, $version);
             download_version($config, $version);
         }
     }



More information about the tbb-commits mailing list