Unverified Commit 2d5508bf authored by boklm's avatar boklm
Browse files

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.
parent 434a7d9e
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -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";
+1 −1
Original line number Diff line number Diff line
@@ -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
+4 −2
Original line number Diff line number Diff line
@@ -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,
    });