[tbb-commits] [tor-browser-bundle/hardened-builds] Bug 20582: move tor-browser specific strings to config.yml

gk at torproject.org gk at torproject.org
Tue Nov 8 11:15:48 UTC 2016


commit 4fb93b748090ae3e13201f76dac033a0350116e9
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Sat Nov 5 20:23:02 2016 +0100

    Bug 20582: move tor-browser specific strings to config.yml
---
 tools/update-responses/config.yml       |  5 +++++
 tools/update-responses/update_responses | 26 +++++++++++++++-----------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/tools/update-responses/config.yml b/tools/update-responses/config.yml
index f7edb24..022cea2 100644
--- a/tools/update-responses/config.yml
+++ b/tools/update-responses/config.yml
@@ -1,4 +1,9 @@
 ---
+appname_marfile: tor-browser
+appname_bundle_osx: TorBrowser
+appname_bundle_linux: tor-browser
+appname_bundle_win: torbrowser-install
+appdir_osx: TorBrowser.app
 releases_dir: ../../gitian
 download:
     archive_url: https://archive.torproject.org/tor-package-archive/torbrowser
diff --git a/tools/update-responses/update_responses b/tools/update-responses/update_responses
index 69535c9..bef5615 100755
--- a/tools/update-responses/update_responses
+++ b/tools/update-responses/update_responses
@@ -82,13 +82,14 @@ sub get_sha512_hex_of_file {
 sub get_version_files {
     my ($config, $version) = @_;
     return if $config->{versions}{$version}{files};
+    my $appname = $config->{appname_marfile};
     my $files = {};
     my $vdir = "$releases_dir/$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) {
         next unless -f "$vdir/$file";
-        if ($file =~ m/^tor-browser-([^-]+)-${version}_(.+)\.mar$/) {
+        if ($file =~ m/^$appname-([^-]+)-${version}_(.+)\.mar$/) {
             my ($os, $lang) = ($1, $2);
             $files->{$os}{$lang}{complete} = {
                 type => 'complete',
@@ -99,7 +100,7 @@ sub get_version_files {
             };
             next;
         }
-        if ($file =~ m/^tor-browser-([^-]+)-(.+)-${version}_(.+)\.incremental\.mar$/) {
+        if ($file =~ m/^$appname-([^-]+)-(.+)-${version}_(.+)\.incremental\.mar$/) {
             my ($os, $from_version, $lang) = ($1, $2, $3);
             $files->{$os}{$lang}{partial}{$from_version} = {
                 type => 'partial',
@@ -123,11 +124,11 @@ sub get_version_downloads {
     foreach my $file (readdir $d) {
         next unless -f "$vdir/$file";
         my ($os, $lang);
-        if ($file =~ m/^TorBrowser-$version-osx64_(.+).dmg$/) {
+        if ($file =~ m/^$config->{appname_bundle_osx}-$version-osx64_(.+).dmg$/) {
             ($os, $lang) = ('osx64', $1);
-        } elsif ($file =~ m/^tor-browser-(linux32|linux64)-${version}_(.+).tar.xz$/) {
+        } elsif ($file =~ m/^$config->{appname_bundle_linux}-(linux32|linux64)-${version}_(.+).tar.xz$/) {
             ($os, $lang) = ($1, $2);
-        } elsif ($file =~ m/^torbrowser-install-${version}_(.+).exe$/) {
+        } elsif ($file =~ m/^$config->{appname_bundle_win}-${version}_(.+).exe$/) {
             ($os, $lang) = ('win32', $1);
         } else {
             next;
@@ -168,13 +169,14 @@ sub extract_mar {
 }
 
 sub mar_filename {
-    my ($version, $os, $lang) = @_;
-    "$releases_dir/$version/tor-browser-$os-${version}_$lang.mar";
+    my ($appname, $version, $os, $lang) = @_;
+    "$releases_dir/$version/$appname-$os-${version}_$lang.mar";
 }
 
 sub create_incremental_mar {
     my ($config, $pm, $from_version, $new_version, $os, $lang) = @_;
-    my $mar_file = "tor-browser-$os-${from_version}-${new_version}_$lang.incremental.mar";
+    my $appname = $config->{appname_marfile};
+    my $mar_file = "$appname-$os-${from_version}-${new_version}_$lang.incremental.mar";
     print "Starting $mar_file\n";
     my $mar_file_path = "$releases_dir/$new_version/$mar_file";
     my $download_url = "$config->{download}{mars_url}/$new_version";
@@ -191,8 +193,8 @@ sub create_incremental_mar {
     };
     return if $pm->start($finished_file);
     my $tmpdir = File::Temp->newdir();
-    extract_mar(mar_filename($from_version, $os, $lang), "$tmpdir/A");
-    extract_mar(mar_filename($new_version, $os, $lang), "$tmpdir/B");
+    extract_mar(mar_filename($appname, $from_version, $os, $lang), "$tmpdir/A");
+    extract_mar(mar_filename($appname, $new_version, $os, $lang), "$tmpdir/B");
     my ($out, $err, $success) = capture_exec('make_incremental_update.sh',
                                    $mar_file_path, "$tmpdir/A", "$tmpdir/B");
     if (!$success) {
@@ -246,7 +248,9 @@ sub get_buildinfos {
         foreach my $lang (keys %{$files->{$os}}) {
             next unless $files->{$os}{$lang}{complete};
             my $tmpdir = File::Temp->newdir();
-            extract_mar(mar_filename($version, $os, $lang), "$tmpdir");
+            extract_mar(
+                mar_filename($config->{appname_marfile}, $version, $os, $lang),
+                "$tmpdir");
             my $appfile = "$tmpdir/application.ini" if -f "$tmpdir/application.ini";
             $appfile = "$tmpdir/Contents/Resources/application.ini"
                                 if -f "$tmpdir/Contents/Resources/application.ini";



More information about the tbb-commits mailing list