@@ -112,6 +112,27 @@ sub cache_read_existing ($) {
close H;
}
+sub cache_write_entry ($$) {
+ my ($fh, $jr) = @_;
+ print $fh "<!-- osstest-report-reuseable";
+ my $whash = sub {
+ my ($h) = @_;
+ foreach my $k (sort keys %$h) {
+ next if $k =~ m/^\%/;
+ $_ = $h->{$k};
+ s{[^-+=/~:;_.,\w]}{ sprintf "%%%02x", ord $& }ge;
+ printf $fh " %s=%s", $k, $_;
+ }
+ };
+ $whash->($jr);
+ foreach my $hk (sort keys %$jr) {
+ next unless $hk =~ m/^\%/;
+ print $fh " $'";
+ $whash->($jr->{$hk});
+ }
+ print $fh " -->\n";
+}
+
sub computeflightsrange () {
if ($flightlimit) {
my $minflightsq = db_prepare(<<END);
@@ -285,27 +306,6 @@ END
print DEBUG "CACHE $hostname $cachehits / ".(scalar @rows)
." of ".(scalar %cache)."\n";
- my $write_cache_entry = sub {
- my ($jr) = @_;
- print H "<!-- osstest-report-reuseable";
- my $whash = sub {
- my ($h) = @_;
- foreach my $k (sort keys %$h) {
- next if $k =~ m/^\%/;
- $_ = $h->{$k};
- s{[^-+=/~:;_.,\w]}{ sprintf "%%%02x", ord $& }ge;
- printf H " %s=%s", $k, $_;
- }
- };
- $whash->($jr);
- foreach my $hk (sort keys %$jr) {
- next unless $hk =~ m/^\%/;
- print H " $'";
- $whash->($jr->{$hk});
- }
- print H " -->\n";
- };
-
@rows = sort { $b->{finished} <=> $a->{finished} } @rows;
print DEBUG "SORTED\n";
@@ -317,7 +317,7 @@ END
foreach my $jr (@rows) {
if ($wrote++ >= $limit) {
- $write_cache_entry->($jr);
+ cache_write_entry(\*H, $jr);
next;
}
@@ -417,7 +417,7 @@ END
print H "<td>" if !$any_power;
print H "</td>\n";
- $write_cache_entry->($jr);
+ cache_write_entry(\*H, $jr);
print H "</tr>\n\n";
$alternate ^= 1;
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> --- sg-report-host-history | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-)