Richard Pospesel pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits: a22a592f by Nicolas Vigier at 2023-02-17T15:59:09+01:00 Bug 40790: Fix dmg2mar after dmg changes from #28124
- - - - - cf22cd26 by Nicolas Vigier at 2023-02-17T17:13:37+01:00 Bug 40791: Make sure dmg2mar exits with an error when something failed
If the child process failed, make sure we exit with an error in the parent process too.
- - - - -
1 changed file:
- tools/dmg2mar
Changes:
===================================== tools/dmg2mar ===================================== @@ -106,7 +106,11 @@ sub get_dmg_files_from_sha256sums { sub convert_files { my ($channel) = @_; my $pm = Parallel::ForkManager->new(get_nbprocs); - $pm->run_on_finish(sub { print "Finished $_[2]\n" }); + $pm->run_on_finish( + sub { + exit_error "Failed while running $_[2]" unless $_[1] == 0; + print "Finished $_[2]\n"; + }); foreach my $file (get_dmg_files_from_sha256sums) { # The 'ja' locale is a special case: it is called 'ja-JP-mac' # internally on OSX, but the dmg file still uses 'ja' to avoid @@ -128,9 +132,11 @@ sub convert_files { my $oldmar = getcwd . '/' . $output; exit_error "Error extracting $output" unless system('mar', '-C', $tmpdir_oldmar, '-x', $oldmar) == 0; + my $appdir = "$tmpdir/$appname/$appname.app"; + exit_error "Missing directory $appdir" unless -d $appdir; my $wanted = sub { my $file = $File::Find::name; - $file =~ s{^$tmpdir/$appname.app/}{}; + $file =~ s{^$appdir/}{}; if (-f "$tmpdir_oldmar/$file") { my (undef, undef, $mode) = stat("$tmpdir_oldmar/$file"); chmod $mode, $File::Find::name; @@ -139,14 +145,14 @@ sub convert_files { chmod 0644, $File::Find::name if -f $File::Find::name; chmod 0755, $File::Find::name if -d $File::Find::name; }; - find($wanted, "$tmpdir/$appname.app"); + find($wanted, $appdir);
unlink $output; local $ENV{MOZ_PRODUCT_VERSION} = $file->{version}; local $ENV{MAR_CHANNEL_ID} = "torbrowser-torproject-$channel"; local $ENV{TMPDIR} = $tmpdir; (undef, $err, $success) = capture_exec('make_full_update.sh', '-q', - $output, "$tmpdir/$appname.app"); + $output, $appdir); exit_error "Error updating $output: $err" unless $success; exit_error "make_full_update.sh failed. $output does not exist." unless -f $output;
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/d...