[tbb-commits] [tor-browser-build/master] Bug 25101: Change nightly builds directory to be the version
gk at torproject.org
gk at torproject.org
Wed Dec 18 14:09:22 UTC 2019
commit 2d5508bfea59900b8d5952d895ac0e9610c70503
Author: Nicolas Vigier <boklm at torproject.org>
Date: Wed Dec 11 00:10:56 2019 +0100
Bug 25101: Change nightly builds directory to be the version
To make generation of incremental mars easier, we use the version as the
directory name (instead of just the date).
We also define the tbb_version option, which is used to set the
TORBROWSER_NIGHTLY_VERSION environment variable.
---
.../roles/tbb-nightly-build/files/prune-old-builds | 17 +++++++++++------
.../roles/tbb-nightly-build/templates/start-tbb-nightly | 2 +-
.../roles/tbb-nightly-build/templates/testsuite-config | 6 ++++--
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/tools/ansible/roles/tbb-nightly-build/files/prune-old-builds b/tools/ansible/roles/tbb-nightly-build/files/prune-old-builds
index 1b4e30b..852a9da 100755
--- a/tools/ansible/roles/tbb-nightly-build/files/prune-old-builds
+++ b/tools/ansible/roles/tbb-nightly-build/files/prune-old-builds
@@ -44,7 +44,11 @@
# Don't delete anything, but say what would be deleted.
#
# --prefix <prefix>
-# Prefix of the directories to be removed. Default is 'tbb-nightly-'.
+# Prefix of the directories to be removed. Default is 'tbb-nightly.'.
+#
+# --separator <c>
+# Separator character to separate the year, month, day in the directory
+# names. Default is '.'.
#
# --days <n>
# Number of days that we should keep. Default is 6.
@@ -66,7 +70,8 @@ my %options = (
days => 6,
weeks => 3,
months => 3,
- prefix => 'tbb-nightly-',
+ prefix => 'tbb-nightly.',
+ separator => '.',
);
sub keep_builds {
@@ -79,7 +84,7 @@ sub keep_builds {
my $n = $options{days};
my $dt = DateTime->now;
while ($n) {
- $res{ $options{prefix} . $dt->ymd } = 1;
+ $res{ $options{prefix} . $dt->ymd($options{separator}) } = 1;
$dt = $dt - $day;
$n--;
}
@@ -89,7 +94,7 @@ sub keep_builds {
$dt = $dt - $day;
}
while ($w) {
- $res{ $options{prefix} . $dt->ymd } = 1;
+ $res{ $options{prefix} . $dt->ymd($options{separator}) } = 1;
$dt = $dt - $week;
$w--;
}
@@ -100,7 +105,7 @@ sub keep_builds {
$dt = $dt - $day;
}
while ($m) {
- $res{ $options{prefix} . $dt->ymd } = 1;
+ $res{ $options{prefix} . $dt->ymd($options{separator}) } = 1;
$dt = $dt - $month;
$m--;
}
@@ -113,7 +118,7 @@ sub clean_directory {
my $k = keep_builds;
chdir $directory || die "Error entering $directory";
foreach my $file (glob "$options{prefix}*") {
- next unless $file =~ m/^$options{prefix}\d{4}-\d{2}-\d{2}$/;
+ next unless $file =~ m/^$options{prefix}\d{4}$options{separator}\d{2}$options{separator}\d{2}$/;
next if $k->{$file};
if ($options{'dry-run'}) {
print "Would remove $file\n";
diff --git a/tools/ansible/roles/tbb-nightly-build/templates/start-tbb-nightly b/tools/ansible/roles/tbb-nightly-build/templates/start-tbb-nightly
index c93bc94..fafc1d9 100644
--- a/tools/ansible/roles/tbb-nightly-build/templates/start-tbb-nightly
+++ b/tools/ansible/roles/tbb-nightly-build/templates/start-tbb-nightly
@@ -2,4 +2,4 @@
cd {{ testsuite_dir }}
export RBM_NO_DEBUG=1
./tbb-testsuite --config=tbb-nightly "$@"
-/home/{{ nightly_build_user }}/prune-old-builds --prefix '' --days {{ nightly_build_keep_builds }} ./tor-browser-builds
+/home/{{ nightly_build_user }}/prune-old-builds --days {{ nightly_build_keep_builds }} ./tor-browser-builds
diff --git a/tools/ansible/roles/tbb-nightly-build/templates/testsuite-config b/tools/ansible/roles/tbb-nightly-build/templates/testsuite-config
index c07c52c..90b08ac 100644
--- a/tools/ansible/roles/tbb-nightly-build/templates/testsuite-config
+++ b/tools/ansible/roles/tbb-nightly-build/templates/testsuite-config
@@ -5,6 +5,7 @@ use DateTime;
use TBBTestSuite::TestSuite::TorBrowserBuild;
my $date = DateTime->now->ymd;
+my $tbb_version = 'tbb-nightly.' . DateTime->now->ymd('.');
my $name = "tor-browser-$date";
if (-d "$options->{'reports-dir'}/r/$name") {
@@ -13,8 +14,9 @@ if (-d "$options->{'reports-dir'}/r/$name") {
}
my $testsuite = TBBTestSuite::TestSuite::TorBrowserBuild->new({
- publish_dir => "$FindBin::Bin/tor-browser-builds/$date",
- publish_url => "{{ nightly_build_url }}/tor-browser-builds/$date",
+ tbb_version => $tbb_version,
+ publish_dir => "$FindBin::Bin/tor-browser-builds/$tbb_version",
+ publish_url => "{{ nightly_build_url }}/tor-browser-builds/$tbb_version",
rbm_local_conf => "$FindBin::Bin/rbm-config/tbb-nightly.rbm.local.conf",
make_clean => 1,
});
More information about the tbb-commits
mailing list