commit c64f614475954951619856f58e06f7890ff9fef2 Author: Nicolas Vigier boklm@torproject.org Date: Mon Oct 23 19:30:40 2017 +0200
Bug 23899: use tmp_dir from rbm.conf in update_responses --- projects/release/update_responses_config.yml | 1 + tools/update-responses/update_responses | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/projects/release/update_responses_config.yml b/projects/release/update_responses_config.yml index 69d8909..8d945dc 100644 --- a/projects/release/update_responses_config.yml +++ b/projects/release/update_responses_config.yml @@ -1,4 +1,5 @@ --- +tmp_dir: '[% c("tmp_dir") %]' appname_marfile: tor-browser appname_bundle_osx: TorBrowser appname_bundle_linux: tor-browser diff --git a/tools/update-responses/update_responses b/tools/update-responses/update_responses index 0ed19c1..9303ed1 100755 --- a/tools/update-responses/update_responses +++ b/tools/update-responses/update_responses @@ -41,6 +41,13 @@ sub exit_error { exit (exists $_[1] ? $_[1] : 1); }
+sub get_tmpdir { + my ($config) = @_; + return File::Temp->newdir($config->{tmp_dir} ? + (DIR => $config->{tmp_dir}) + : ()); +} + sub build_targets_by_os { return ($_[0]) unless $config->{build_targets}{$_[0]}; my $r = $config->{build_targets}{$_[0]}; @@ -197,7 +204,7 @@ sub create_incremental_mar { }; }; return if $pm->start($finished_file); - my $tmpdir = File::Temp->newdir(); + my $tmpdir = get_tmpdir($config); extract_mar(mar_filename($appname, $from_version, $os, $lang), "$tmpdir/A"); extract_mar(mar_filename($appname, $new_version, $os, $lang), "$tmpdir/B"); if ($ENV{CHECK_CODESIGNATURE_EXISTS}) { @@ -254,12 +261,12 @@ sub channel_to_version { sub get_buildinfos { my ($config, $version) = @_; return if exists $config->{versions}{$version}{buildID}; - extract_martools($version); + extract_martools($config, $version); my $files = $config->{versions}{$version}{files}; foreach my $os (keys %$files) { foreach my $lang (keys %{$files->{$os}}) { next unless $files->{$os}{$lang}{complete}; - my $tmpdir = File::Temp->newdir(); + my $tmpdir = get_tmpdir($config); extract_mar( mar_filename($config->{appname_marfile}, $version, $os, $lang), "$tmpdir"); @@ -412,10 +419,10 @@ sub osname {
my $martools_tmpdir; sub extract_martools { - my ($version) = @_; + my ($config, $version) = @_; my $osname = osname; my $marzip = "$releases_dir/$version/mar-tools-$osname.zip"; - $martools_tmpdir = File::Temp->newdir(); + $martools_tmpdir = get_tmpdir($config); my $old_cwd = getcwd; chdir $martools_tmpdir; my (undef, undef, $success) = capture_exec('unzip', $marzip); @@ -513,7 +520,7 @@ sub check_update_responses_channel {
sub download_version { my ($config, $version) = @_; - my $tmpdir = File::Temp->newdir(); + my $tmpdir = get_tmpdir($config); my $destdir = "$releases_dir/$version"; my $urldir = "$config->{download}{archive_url}/$version"; print "Downloading version $version\n"; @@ -548,7 +555,7 @@ sub download_version { unless $sums{$martools} eq sha256_hex(read_file("$tmpdir/$martools")); move "$tmpdir/$martools", "$destdir/$martools"; move "$tmpdir/$martools.asc", "$destdir/$martools.asc"; - extract_martools($version); + extract_martools($config, $version);
foreach my $file (sort grep { $_ =~ m/.mar$/ } keys %sums) { print "Downloading $file\n"; @@ -619,7 +626,7 @@ my %actions = ( gen_incrementals => sub { my ($config) = @_; foreach my $version (channel_to_version($config, @ARGV)) { - extract_martools($version); + extract_martools($config, $version); get_version_files($config, $version); create_incremental_mars_for_version($config, $version); }
tor-commits@lists.torproject.org