From 0cee7c0909be316228c1cb64e1bc578c4a462987 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Tue, 23 Nov 2010 09:05:09 +0000 Subject: [PATCH] hydra: handle case where build to keep set to 0 --- src/script/hydra_update_gc_roots.pl.in | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/script/hydra_update_gc_roots.pl.in b/src/script/hydra_update_gc_roots.pl.in index 890f6138..149c63d3 100755 --- a/src/script/hydra_update_gc_roots.pl.in +++ b/src/script/hydra_update_gc_roots.pl.in @@ -40,12 +40,17 @@ foreach my $project ($db->resultset('Projects')->all) { foreach my $jobset ($project->jobsets->all) { my $keepnr = $jobset->keepnr; - # If the jobset has been disabled for more than one week, than - # don't keep its builds anymore. - if ($jobset->enabled == 0 && (time() - $jobset->lastcheckedtime > (7 * 24 * 3600))) { - print STDERR "*** skipping disabled jobset ", $project->name, ":", $jobset->name, "\n"; - next; - } + # If the jobset has been disabled for more than one week, than + # don't keep its builds anymore. + if ($jobset->enabled == 0 && (time() - $jobset->lastcheckedtime > (7 * 24 * 3600))) { + print STDERR "*** skipping disabled jobset ", $project->name, ":", $jobset->name, "\n"; + next; + } + + if ($keepnr <= 0 ) { + print STDERR "*** jobset ", $project->name, ":", $jobset->name, " set to keep 0 builds\n"; + next; + } # Go over all jobs in this jobset. foreach my $job ($jobset->jobs->all) { @@ -68,8 +73,8 @@ foreach my $project ($db->resultset('Projects')->all) { , rows => $keepnr }); keepBuild $_ foreach @recentBuilds; - } - } + } + } } # Go over all views in this project.