[tbb-commits] [tor-browser-bundle/maint-4.0] Separate MAR file/htdocs generation.
gk at torproject.org
gk at torproject.org
Fri Jan 9 21:18:53 UTC 2015
commit dca3ac0e09d1feda5d4f370960f824c0124f6492
Author: Georg Koppen <gk at torproject.org>
Date: Fri Jan 9 21:44:36 2015 +0000
Separate MAR file/htdocs generation.
This is part of d852329ac0979d8005e9e8bdd9b3f8a049fc2db4 which we need
in order to be able to backport #13857 cleanly.
The related part of the commit message is:
Change update_responses to select the action to be done based on the
program name, thereby separating the incremental MAR file generation (done
via a new 'gen_incrementals' symlink) from the htdocs generation. Also added
an 'update_responses' make target. Thanks to boklm for help with this.
---
gitian/Makefile | 3 +++
tools/update-responses/gen_incrementals | 1 +
tools/update-responses/update_responses | 34 ++++++++++++++++++++++++-------
3 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/gitian/Makefile b/gitian/Makefile
index 2c17656..b2e3224 100644
--- a/gitian/Makefile
+++ b/gitian/Makefile
@@ -33,6 +33,9 @@ build-beta:
./hash-bundles.sh versions.beta
incrementals:
+ ../tools/update-responses/gen_incrementals
+
+update_responses:
../tools/update-responses/update_responses
hash:
diff --git a/tools/update-responses/gen_incrementals b/tools/update-responses/gen_incrementals
new file mode 120000
index 0000000..3766925
--- /dev/null
+++ b/tools/update-responses/gen_incrementals
@@ -0,0 +1 @@
+update_responses
\ No newline at end of file
diff --git a/tools/update-responses/update_responses b/tools/update-responses/update_responses
index b28b575..5b85037 100755
--- a/tools/update-responses/update_responses
+++ b/tools/update-responses/update_responses
@@ -1,6 +1,7 @@
#!/usr/bin/perl -w
use strict;
+use English;
use FindBin;
use YAML qw(LoadFile);
use File::Slurp;
@@ -13,6 +14,7 @@ use File::Which;
use POSIX qw(setlocale LC_ALL);
use IO::CaptureOutput qw(capture_exec);
use Parallel::ForkManager;
+use File::Basename;
# Set umask and locale to provide a consistent environment for MAR file
# generation, etc.
@@ -158,7 +160,7 @@ sub create_incremental_mar {
$pm->finish;
}
-sub create_missing_incremental_mars {
+sub create_missing_incremental_mars_for_version {
my ($config, $version) = @_;
my $pm = Parallel::ForkManager->new(get_nbprocs);
$pm->run_on_finish(sub { $_[2]->(@_) });
@@ -178,6 +180,14 @@ sub create_missing_incremental_mars {
$pm->wait_all_children;
}
+sub create_all_missing_incremental_mars {
+ my ($config) = @_;
+ foreach my $version (values %{$config->{channels}}) {
+ get_version_files($config, $version);
+ create_missing_incremental_mars_for_version($config, $version);
+ }
+}
+
sub get_config {
my ($config, $version, $os, $name) = @_;
return $config->{versions}{$version}{$os}{$name}
@@ -224,7 +234,6 @@ sub write_responses {
my ($config) = @_;
foreach my $version (values %{$config->{channels}}) {
get_version_files($config, $version);
- create_missing_incremental_mars($config, $version);
my $files = $config->{versions}{$version}{files};
my $migrate_archs = $config->{versions}{$version}{migrate_archs} // {};
foreach my $old_os (keys %$migrate_archs) {
@@ -309,8 +318,19 @@ sub extract_martools {
$ENV{PATH} .= ":$martools_tmpdir/mar-tools";
}
-extract_martools;
-check_deps;
-write_responses($config);
-write_htaccess($config);
-clean_htdocs;
+my %actions = (
+ update_responses => sub {
+ write_responses(@_);
+ write_htaccess(@_);
+ clean_htdocs;
+ },
+ gen_incrementals => sub {
+ extract_martools;
+ check_deps;
+ create_all_missing_incremental_mars(@_);
+ },
+);
+
+my $action = fileparse($PROGRAM_NAME);
+exit_error "Unknown action $action" unless $actions{$action};
+$actions{$action}->($config);
More information about the tbb-commits
mailing list