| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 08/13] sg-report-host-history: Write cache entries
 Write the %$jr contents out in a fairly terse format.  We stuff it
into a parseable SGML/XML comment in the output HTML.
Nothing makes use of this yet - parsing it back in will come later.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 sg-report-host-history | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff --git a/sg-report-host-history b/sg-report-host-history
index 8767b25d..335efa1c 100755
--- a/sg-report-host-history
+++ b/sg-report-host-history
@@ -246,6 +246,27 @@ END
        push @rows, { %$jr, %$endedrow };
     }
 
+    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;
     $#rows = $limit-1 if @rows > $limit;
 
@@ -338,6 +359,8 @@ END
         print H "<td>" if !$any_power;
        print H "</td>\n";
 
+       $write_cache_entry->($jr);
+
        print H "</tr>\n\n";
        $alternate ^= 1;
     }
-- 
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |