boklm pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: 610da963 by Nicolas Vigier at 2025-10-13T16:29:54+02:00 Bug 41373: Remove `_ALL` from mar filenames - - - - - 98191f15 by Nicolas Vigier at 2025-10-13T16:29:55+02:00 Bug 41373: Add support for old from mar filenames (with `_ALL`) We need to keep supporting old mar filenames for: - generating incrementals from releases with the old filenames - generating update responses for releases with the old filenames, for the legacy channel We should revert this commit when support for the legacy channel (13.5) has ended. - - - - - 4 changed files: - projects/browser/build - tools/count-mar-downloads - tools/dmg2mar - tools/update-responses/update_responses Changes: ===================================== projects/browser/build ===================================== @@ -372,7 +372,7 @@ cd $distdir [% IF c("var/build_mar") && c("var/updater_enabled") -%] # Create full MAR file and compressed package. - [% SET mar_file = c("var/project-name") _ '-' _ c("var/mar_osname") _ '-' _ c("var/torbrowser_version") _ '_ALL.mar' %] + [% SET mar_file = c("var/project-name") _ '-' _ c("var/mar_osname") _ '-' _ c("var/torbrowser_version") _ '.mar' %] MAR=$MARTOOLS/mar \ MOZ_PRODUCT_VERSION=[% c("var/torbrowser_version") %] \ MAR_CHANNEL_ID=[% c("var/mar_channel_id") %] \ ===================================== tools/count-mar-downloads ===================================== @@ -63,7 +63,7 @@ sub parse_log_file { my ($stdout, undef, $success) = capture_exec('xzcat', $File::Find::name); foreach my $line (split /\n/, $stdout) { my ($version, $os) = - ($line =~ m|^[^\s]+ - - \[.+\] "GET /aus1/torbrowser/([^/]+)/tor-browser-(.*)-\d.*_ALL\.mar HTTP/|); + ($line =~ m|^[^\s]+ - - \[.+\] "GET /aus1/torbrowser/([^/]+)/tor-browser-(.*)-\d.*(_ALL)?\.mar HTTP/|); if ($version) { $downloads{$version}{total} += 1; $downloads{$version}{full_update} += 1; @@ -72,7 +72,7 @@ sub parse_log_file { } my $incremental_from; ($version, $os, $incremental_from) = - ($line =~ m|^[^\s]+ - - \[.+\] "GET /aus1/torbrowser/([^/]+)/tor-browser-(.*)--(\d[^-]+)-.*_ALL\.incremental\.mar HTTP/|); + ($line =~ m|^[^\s]+ - - \[.+\] "GET /aus1/torbrowser/([^/]+)/tor-browser-(.*)--(\d[^-]+)-.*(_ALL)?\.incremental\.mar HTTP/|); if ($incremental_from) { $downloads{$version}{total} += 1; $downloads{$version}{OS}{$os} += 1; ===================================== tools/dmg2mar ===================================== @@ -117,7 +117,7 @@ sub convert_files { print "Finished $_[2]\n"; }); foreach my $file (get_dmg_files_from_sha256sums) { - my $output = "$appname_mar-macos-$file->{version}_ALL.mar"; + my $output = "$appname_mar-macos-$file->{version}.mar"; my $step_name = "$file->{filename} -> $output"; print "Starting $step_name\n"; $pm->start($step_name) and next; ===================================== tools/update-responses/update_responses ===================================== @@ -87,6 +87,33 @@ sub get_sha512_hex_of_file { return $sha->hexdigest; } +# With release 15.0 _ALL is being removed from mar file names. +# However we need to be able to generate incrementals from versions +# using the old filenames. As a workaround, if the old filename is +# found we create a symlink to the new file name. +# The symlinks are used in `create_incremental_mar` and `get_buildinfos`, +# where supporting both file names would complexify things. The symlinks +# are ignored in `get_version_files` where the regexp used support both +# old and new filenames. +# We can remove this once we don't need to generate incrementals from +# versions with the old file names. +sub symlink_ALL { + my ($config, $version) = @_; + my $vdir = version_dir($config, $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/^(.+)_ALL\.mar$/) { + next if -f "$vdir/$1.mar"; + symlink $file, "$vdir/$1.mar"; + } + if ($file =~ m/^(.+)_ALL\.incremental\.mar$/) { + next if -f "$vdir/$1.incremental.mar"; + symlink $file, "$vdir/$1.incremental.mar"; + } + } +} + sub get_version_files { my ($config, $version) = @_; return if $config->{versions}{$version}{files}; @@ -97,8 +124,13 @@ sub get_version_files { opendir(my $d, $vdir) or exit_error "Error opening directory $vdir"; foreach my $file (readdir $d) { next unless -f "$vdir/$file"; + # Ignore the symlinks created by `symlink_ALL` to avoid adding the files + # twice. + # We can remove this line once we don't need to support the legacy channel with + # with the old file names. + next if -l "$vdir/$file"; if ($file !~ m/incremental\.mar$/ && - $file =~ m/^$appname-(.+)-${version}_ALL\.mar$/) { + $file =~ m/^$appname-(.+)-${version}(_ALL)?\.mar$/) { my $os = $1; $files->{$os}{complete} = { type => 'complete', @@ -111,7 +143,7 @@ sub get_version_files { }; next; } - if ($file =~ m/^$appname-(.+)--(.+)-${version}_ALL\.incremental\.mar$/) { + if ($file =~ m/^$appname-(.+)--(.+)-${version}(_ALL)?\.incremental\.mar$/) { my ($os, $from_version) = ($1, $2); $files->{$os}{partial}{$from_version} = { type => 'partial', @@ -221,13 +253,13 @@ sub extract_mar { sub mar_filename { my ($config, $appname, $version, $os) = @_; - version_dir($config, $version) . "/$appname-$os-${version}_ALL.mar"; + version_dir($config, $version) . "/$appname-$os-${version}.mar"; } sub create_incremental_mar { my ($config, $pm, $from_version, $new_version, $os, $channel) = @_; my $appname = $config->{appname_marfile}; - my $mar_file = "$appname-$os--${from_version}-${new_version}_ALL.incremental.mar"; + my $mar_file = "$appname-$os--${from_version}-${new_version}.incremental.mar"; 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"; @@ -288,6 +320,7 @@ sub create_incremental_mars_for_version { my $v = $config->{versions}{$version}; foreach my $from_version (@{$v->{incremental_from}}) { $config->{versions}{$from_version} //= {}; + symlink_ALL($config, $from_version); get_version_files($config, $from_version); my $from_v = $config->{versions}{$from_version}; foreach my $os (keys %{$v->{files}}) { @@ -396,6 +429,7 @@ sub write_responses { my (%oses, %from_versions); foreach my $version (@$versions) { get_version_files($config, $version); + symlink_ALL($config, $version); get_buildinfos($config, $version); my $files = $config->{versions}{$version}{files}; foreach my $os (keys %$files) { View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/e... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/e... You're receiving this email because of your account on gitlab.torproject.org.