зеркало из https://github.com/mozilla/pjs.git
Bug 168191 - Checksetup needs to force template recompilation. Patch by bbaetz; r=gerv. Should fix tindebox bustage.
This commit is contained in:
Родитель
c03cb01f08
Коммит
bbfc878c55
|
@ -920,8 +920,6 @@ 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
|
||||
|
@ -936,18 +934,14 @@ END
|
|||
}
|
||||
finddepth(\&remove, 'data/template');
|
||||
}
|
||||
}
|
||||
|
||||
# Precompile stuff. This speeds up initial access (so the template isn't
|
||||
# compiled multiple times simulataneously by different servers), and helps
|
||||
# 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 ...
|
||||
|
|
|
@ -69,7 +69,7 @@ foreach my $file(@Support::Templates::referenced_files) {
|
|||
}
|
||||
|
||||
# Processes all the templates to make sure they have good syntax
|
||||
my $template = Template->new(
|
||||
my $provider = Template::Provider->new(
|
||||
{
|
||||
INCLUDE_PATH => $include_path ,
|
||||
# Need to define filters used in the codebase, they don't
|
||||
|
@ -86,29 +86,23 @@ my $template = Template->new(
|
|||
}
|
||||
);
|
||||
|
||||
open SAVEOUT, ">&STDOUT"; # stash the original output stream
|
||||
open SAVEERR, ">&STDERR";
|
||||
open STDOUT, "> /dev/null"; # discard all output
|
||||
open STDERR, "> /dev/null";
|
||||
foreach my $file(@Support::Templates::actual_files) {
|
||||
my $path = File::Spec->catfile($include_path, $file);
|
||||
if (-e $path) {
|
||||
if ($template->process($file)) {
|
||||
my ($data, $err) = $provider->fetch($file);
|
||||
|
||||
if (!$err) {
|
||||
ok(1, "$file syntax ok");
|
||||
}
|
||||
else {
|
||||
ok(0, "$file has bad syntax --ERROR");
|
||||
print $fh $template->error() . "\n";
|
||||
print $fh $data . "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
ok(1, "$path doesn't exist, skipping test");
|
||||
}
|
||||
}
|
||||
open STDOUT, ">&SAVEOUT"; # redirect back to original stream
|
||||
open STDERR, ">&SAVEERR";
|
||||
close SAVEOUT;
|
||||
close SAVEERR;
|
||||
|
||||
# check to see that all templates have a version string:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче