[tbb-commits] [builders/tor-browser-build] branch main updated: Bug 40254: Add per-platform download json files

gitolite role git at cupani.torproject.org
Mon Nov 28 18:30:42 UTC 2022


This is an automated email from the git hooks/post-receive script.

boklm pushed a commit to branch main
in repository builders/tor-browser-build.

The following commit(s) were added to refs/heads/main by this push:
     new 983f9860 Bug 40254: Add per-platform download json files
983f9860 is described below

commit 983f9860892b094e391e2b166cbc5c09106aa65b
Author: Nicolas Vigier <boklm at torproject.org>
AuthorDate: Wed Nov 2 17:54:31 2022 +0100

    Bug 40254: Add per-platform download json files
    
    We also add android download json files (#40110).
---
 projects/release/update_responses_config.yml |  1 +
 tools/update-responses/update_responses      | 38 ++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/projects/release/update_responses_config.yml b/projects/release/update_responses_config.yml
index d27afd84..9c9b6693 100644
--- a/projects/release/update_responses_config.yml
+++ b/projects/release/update_responses_config.yml
@@ -2,6 +2,7 @@
 tmp_dir: '[% c("tmp_dir") %]'
 create_downloads_json: 1
 appname_marfile: tor-browser
+appname_bundle_android: tor-browser
 appname_bundle_macos: TorBrowser
 appname_bundle_linux: tor-browser
 appname_bundle_win32: torbrowser-install
diff --git a/tools/update-responses/update_responses b/tools/update-responses/update_responses
index 265994a5..5725edbb 100755
--- a/tools/update-responses/update_responses
+++ b/tools/update-responses/update_responses
@@ -153,6 +153,39 @@ sub get_version_downloads {
     $config->{versions}{$version}{downloads} = $downloads;
 }
 
+sub get_perplatform_downloads {
+    my ($config, $version, $gittag) = @_;
+    my $downloads = {};
+    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) {
+        next unless -f "$vdir/$file";
+        my $os;
+        if ($file =~ m/^$config->{appname_bundle_macos}-$version-macos_(.+).dmg$/) {
+          $os = 'macos';
+        } elsif ($file =~ m/^$config->{appname_bundle_linux}-(linux32|linux64)-${version}_(.+).tar.xz$/) {
+          $os = $1 eq 'linux64' ? 'linux-x86_64' : 'linux-i686';
+        } elsif ($file =~ m/^$config->{appname_bundle_win64}-${version}_(.+).exe$/) {
+          $os = 'windows-x86_64';
+        } elsif ($file =~ m/^$config->{appname_bundle_win32}-${version}_(.+).exe$/) {
+          $os = 'windows-i686';
+        } elsif ($file =~ m/^$config->{appname_bundle_android}-${version}-(android-armv7|android-x86|android-x86_64|android-aarch64)-multi.apk/) {
+          $os = $1;
+        } else {
+            next;
+        }
+        $downloads->{$os} = {
+            version => $version,
+            git_tag => $gittag,
+            binary => "$download_url/$file",
+            sig => "$download_url/$file.asc",
+        };
+    }
+    closedir $d;
+    $config->{versions}{$version}{pp_downloads} = $downloads;
+}
+
 sub extract_mar {
     my ($mar_file, $dest_dir, $compression) = @_;
     my $old_cwd = getcwd;
@@ -432,6 +465,11 @@ sub write_downloads_json {
         };
         write_htdocs($channel, 'downloads.json',
             JSON->new->utf8->canonical->encode($data));
+        my $pp_downloads = get_perplatform_downloads($config, $version, $tag);
+        foreach my $os (keys %{$pp_downloads}) {
+          write_htdocs($channel, "download-$os.json",
+            JSON->new->utf8->canonical->encode($pp_downloads->{$os}));
+        }
     }
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list