[tbb-commits] [tor-browser-bundle/hardened-builds] Bug 19854: fix URLs in downloads.json file

gk at torproject.org gk at torproject.org
Fri Aug 12 07:20:12 UTC 2016


commit ce5edcb55cee57b56ea3577474232e85464ff78e
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Mon Aug 8 12:14:23 2016 +0200

    Bug 19854: fix URLs in downloads.json file
---
 tools/update-responses/config.yml       |  4 ++--
 tools/update-responses/update_responses | 15 +++++++++------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/update-responses/config.yml b/tools/update-responses/config.yml
index 191c246..77c8b46 100644
--- a/tools/update-responses/config.yml
+++ b/tools/update-responses/config.yml
@@ -3,6 +3,8 @@ releases_dir: ../../gitian
 download:
     archive_url: https://archive.torproject.org/tor-package-archive/torbrowser
     gpg_keyring: ../../gitian/gpg/torbrowser.gpg
+    bundles_url: https://dist.torproject.org/torbrowser
+    mars_url: https://cdn.torproject.org/aus1/torbrowser
 build_targets:
     linux32: Linux_x86-gcc3
     linux64: Linux_x86_64-gcc3
@@ -19,7 +21,6 @@ versions:
     6.0.1:
         platformVersion: 45.2.0
         detailsURL: https://blog.torproject.org/blog/tor-browser-601-released
-        download_url: https://cdn.torproject.org/aus1/torbrowser/6.0.1
         incremental_from:
           - 4.5.3
         migrate_archs:
@@ -30,7 +31,6 @@ versions:
     6.5a2-hardened:
         platformVersion: 45.3.0
         detailsURL: https://blog.torproject.org/blog/tor-browser-65a2-hardened-released
-        download_url: https://cdn.torproject.org/aus1/torbrowser/6.5a2-hardened
         incremental_from:
           - 6.5a1-hardened
         migrate_archs:
diff --git a/tools/update-responses/update_responses b/tools/update-responses/update_responses
index cf307da..faa1037 100755
--- a/tools/update-responses/update_responses
+++ b/tools/update-responses/update_responses
@@ -84,6 +84,7 @@ sub get_version_files {
     return if $config->{versions}{$version}{files};
     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";
@@ -91,7 +92,7 @@ sub get_version_files {
             my ($os, $lang) = ($1, $2);
             $files->{$os}{$lang}{complete} = {
                 type => 'complete',
-                URL => "$config->{versions}{$version}{download_url}/$file",
+                URL => "$download_url/$file",
                 size => -s "$vdir/$file",
                 hashFunction => 'SHA512',
                 hashValue => get_sha512_hex_of_file("$vdir/$file"),
@@ -102,7 +103,7 @@ sub get_version_files {
             my ($os, $from_version, $lang) = ($1, $2, $3);
             $files->{$os}{$lang}{partial}{$from_version} = {
                 type => 'partial',
-                URL => "$config->{versions}{$version}{download_url}/$file",
+                URL => "$download_url/$file",
                 size => -s "$vdir/$file",
                 hashFunction => 'SHA512',
                 hashValue => get_sha512_hex_of_file("$vdir/$file"),
@@ -117,6 +118,7 @@ sub get_version_downloads {
     my ($config, $version) = @_;
     my $downloads = {};
     my $vdir = "$releases_dir/$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) {
         next unless -f "$vdir/$file";
@@ -131,8 +133,8 @@ sub get_version_downloads {
             next;
         }
         $downloads->{$os}{$lang} = {
-            binary => "$config->{versions}{$version}{download_url}/$file",
-            sig => "$config->{versions}{$version}{download_url}/$file.asc",
+            binary => "$download_url/$file",
+            sig => "$download_url/$file.asc",
         };
     }
     closedir $d;
@@ -175,12 +177,13 @@ sub create_incremental_mar {
     my $mar_file = "tor-browser-$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";
     my $finished_file = sub {
         exit_error "Error creating $mar_file" unless $_[1] == 0;
         print "Finished $mar_file\n";
         $config->{versions}{$new_version}{files}{$os}{$lang}{partial}{$from_version} = {
             type => 'partial',
-            URL => "$config->{versions}{$new_version}{download_url}/$mar_file",
+            URL => "$download_url/$mar_file",
             size => -s $mar_file_path,
             hashFunction => 'SHA512',
             hashValue => get_sha512_hex_of_file($mar_file_path),
@@ -205,7 +208,7 @@ sub create_incremental_mars_for_version {
     $pm->run_on_finish(sub { $_[2]->(@_) });
     my $v = $config->{versions}{$version};
     foreach my $from_version (@{$v->{incremental_from}}) {
-        $config->{versions}{$from_version} //= { download_url => '' };
+        $config->{versions}{$from_version} //= {};
         get_version_files($config, $from_version);
         my $from_v = $config->{versions}{$from_version};
         foreach my $os (keys %{$v->{files}}) {



More information about the tbb-commits mailing list