diff --git a/webtools/tinderbox/clean.pl b/webtools/tinderbox/clean.pl index 8399f80a51e..a4fba5a358f 100755 --- a/webtools/tinderbox/clean.pl +++ b/webtools/tinderbox/clean.pl @@ -21,7 +21,6 @@ # Contributor(s): use lib "@TINDERBOX_DIR@"; -require 'tbglobals.pl'; # for $gzip use strict; use Getopt::Std; @@ -29,6 +28,10 @@ my $verbose = 0; my $tinderboxdir = "@TINDERBOX_DIR@"; chdir $tinderboxdir or die "Couldn't chdir to $tinderboxdir"; +# tbglobals.pl must be included after chdir +# so that $::tree_dir is set correctly +require 'tbglobals.pl'; # for $gzip + our ($opt_h, $opt_v); getopts('hv'); usage() if (defined($opt_h)); diff --git a/webtools/tinderbox/tbglobals.pl b/webtools/tinderbox/tbglobals.pl index 63a3bda23f8..e4fc243b714 100755 --- a/webtools/tinderbox/tbglobals.pl +++ b/webtools/tinderbox/tbglobals.pl @@ -786,6 +786,12 @@ sub tb_trim_logs($$$$) { return if (!defined($days) || !defined($tree) || !defined($verbose) || !defined($do_html)); + # warn if the directory cannot be found and return + if (! -d "$::tree_dir/$tree") { + warn("Cannot find directory: " . shell_escape("$::tree_dir/$tree")); + return; + } + my $min_date = time - (60*60*24 * $days); #