+
+open (INDEX, '>','index.html');
+
+print INDEX <<EOF;
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <link rel="stylesheet" href="build.css">
+</head>
+<body>
+EOF
+
+print INDEX "<h1>Build ", $vars{"build_number"}, ": $result</h1>\n";
+
+print INDEX "<h2>Build Properties</h2>\n";
+print INDEX "<table>\n";
+print INDEX "<tr><th>Name</th><th>Value</th></tr>\n";
+foreach my $key (sort (keys (%vars))) {
+ print INDEX "<tr>";
+ print INDEX "<td>", encode_entities ($key), "</td>";
+ print INDEX "<td>", encode_entities ($vars{$key}), "</td>";
+ print INDEX "</tr>\n";
+}
+print INDEX "</table>\n";
+
+print INDEX "<h2>Build Products</h2>\n";
+print INDEX "<ul>\n";
+foreach my $p (@products) {
+ print INDEX "<li>";
+ print INDEX encode_entities ($p->{NAME}), ": " if defined ($p->{NAME});
+ print INDEX "<a href=\"", encode_entities ($p->{HREF}), "\">";
+ print INDEX encode_entities ($p->{PRODUCT});
+ print INDEX "</a>\n";
+ if ($p->{PRODUCT} =~ /\.tar\.gz$/) {
+ my $sha = Digest::SHA->new(1);
+ $sha->addfile($p->{PRODUCT});
+ print INDEX "<br>sha1: ", $sha->hexdigest, "\n";
+
+ $sha = Digest::SHA->new(256);
+ $sha->addfile($p->{PRODUCT});
+ print INDEX "<br>sha256: ", $sha->hexdigest, "\n";
+ }
+ print INDEX "</li>\n";
+}
+print INDEX "</ul>\n";
+
+sub log_link {
+ my ($ln) = @_;
+ return "<small><a href=\"log.html#$ln\">(log)</a></small>";
+}
+
+print INDEX "<h2>Build Summary</h2>\n";
+print INDEX "<ol>\n";
+foreach my $s (@steps) {
+ print INDEX "<li>", encode_entities ($s->{TITLE});
+ print INDEX " ", log_link ($s->{LN});
+ foreach my $c (@{$s->{CHILDREN}}) {
+ if (defined ($c->{DIAGNOSTIC})) {
+ print INDEX "<p class=\"$c->{DIAGNOSTIC}\">";
+ if (defined ($c->{MATCH})) {
+ my $href = $gitweb_url;
+ $href =~ s/\[FILE\]/uri_escape ($c->{FILE})/ge;
+ $href =~ s/\[LINE\]/$c->{LINE}/g;
+ $href =~ s/\[BRANCH\]/uri_escape ($vars{'dist_commit'})/e;
+
+ print INDEX '<a href="', encode_entities ($href), '">';
+ print INDEX encode_entities (substr ($c->{MESSAGE},
+ 0, $c->{MATCH}));
+ print INDEX '</a>';
+ print INDEX encode_entities (substr ($c->{MESSAGE},
+ $c->{MATCH}));
+ } else {
+ print INDEX encode_entities ($c->{MESSAGE});
+ }
+ print INDEX " ", log_link ($c->{LN});
+ print INDEX "</p>\n";
+ } else {
+ print INDEX "<p>→ <a href=\"", encode_entities ($c->{HREF}), "\">";
+ print INDEX encode_entities ($c->{PRODUCT});
+ print INDEX "</a> ";
+ print INDEX log_link ($c->{LN});
+ print INDEX "</p>\n";
+ }
+ }
+ print INDEX "</li>\n";
+}
+print INDEX "</ol>\n";
+