summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authorgerv%gerv.net <>2002-10-29 18:09:30 +0100
committergerv%gerv.net <>2002-10-29 18:09:30 +0100
commit7aede7bc1d9e270e2a1b817fe40750bedf56a270 (patch)
tree7256164f8fef7ae9c6253956e8af0410a7c8851a /checksetup.pl
parentdad297316ae335ccc20e5d0546525d1c117131c0 (diff)
downloadbugzilla-7aede7bc1d9e270e2a1b817fe40750bedf56a270.tar.gz
bugzilla-7aede7bc1d9e270e2a1b817fe40750bedf56a270.tar.xz
Bug 168191 - Checksetup needs to force template recompilation. Patch by bbaetz; r=gerv. Should fix tindebox bustage.
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl42
1 files changed, 17 insertions, 25 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 58c2c130f..a1662192e 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -920,22 +920,19 @@ END
# YYYY-MM-DD
my $lastTemplateParamChange = str2time("2002-04-27", "UTC");
if (-e 'data/template') {
- unless (-d 'data/template' && -e 'data/template/.lastRebuild' &&
- (stat('data/template/.lastRebuild'))[9] >= $lastTemplateParamChange) {
- print "Removing existing compiled templates ...\n";
-
- # If File::Path::rmtree reported errors, then I'd use that
- use File::Find;
- sub remove {
- return if $_ eq ".";
- if (-d $_) {
- rmdir $_ || die "Couldn't rmdir $_: $!\n";
- } else {
- unlink $_ || die "Couldn't unlink $_: $!\n";
- }
+ print "Removing existing compiled templates ...\n";
+
+ # If File::Path::rmtree reported errors, then I'd use that
+ use File::Find;
+ sub remove {
+ return if $_ eq ".";
+ if (-d $_) {
+ rmdir $_ || die "Couldn't rmdir $_: $!\n";
+ } else {
+ unlink $_ || die "Couldn't unlink $_: $!\n";
}
- finddepth(\&remove, 'data/template');
}
+ finddepth(\&remove, 'data/template');
}
# Precompile stuff. This speeds up initial access (so the template isn't
@@ -943,11 +940,8 @@ END
# to get the permissions right.
eval("use Template");
my $redir = ($^O =~ /MSWin32/i) ? "NUL" : "/dev/null";
- my $template = Template->new(
+ my $provider = Template::Provider->new(
{
- # Output to /dev/null here
- OUTPUT => $redir,
-
# Colon-separated list of directories containing templates.
INCLUDE_PATH => "template/en/custom:template/en/default",
@@ -965,7 +959,8 @@ END
url_quote => sub { return $_; },
csv => sub { return $_; },
},
- }) || die ("Could not create Template: " . Template->error() . "\n");
+ }) || die ("Could not create Template Provider: "
+ . Template::Provider->error() . "\n");
sub compile {
# no_chdir doesn't work on perl 5.005
@@ -980,8 +975,9 @@ END
chdir($::baseDir);
- $template->process($name, {})
- || die "Could not compile $name:" . $template->error() . "\n";
+ # Do this to avoid actually processing the templates
+ my ($data, $err) = $provider->fetch($name);
+ die "Could not compile $name: " . $data . "\n" if $err;
chdir($origDir);
}
@@ -1012,10 +1008,6 @@ END
find(\&compile, "template/en/default");
}
-
- # update the time on the stamp file
- open FILE, '>data/template/.lastRebuild'; close FILE;
- utime $lastTemplateParamChange, $lastTemplateParamChange, ('data/template/.lastRebuild');
}
# Just to be sure ...