1 |
<html> |
2 |
<head> |
3 |
<?php |
4 |
|
5 |
$success = Array(); |
6 |
$failure = Array(); |
7 |
$fixed = Array(); |
8 |
$removed = Array(); |
9 |
$packages = Array(); |
10 |
|
11 |
$run = $_GET['run']; |
12 |
if (!$run) { |
13 |
$run = "latest"; |
14 |
} |
15 |
$base_dir = "cauldron/x86_64/core/$run"; |
16 |
|
17 |
$status_name = "$base_dir/status.core.log"; |
18 |
$status_file = fopen($status_name, "r"); |
19 |
|
20 |
if ($handle = opendir('/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/')) { |
21 |
while (false !== ($entry = readdir($handle))) { |
22 |
if (preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $entry, $matches)) { |
23 |
$packages[$matches[1]] = $matches[2]; |
24 |
} |
25 |
} |
26 |
closedir($handle); |
27 |
} |
28 |
|
29 |
while (!feof($status_file)) { |
30 |
$line = fgets($status_file); |
31 |
if (preg_match("/^(.*): (.*)$/", $line, $matches)) { |
32 |
$rpm = $matches[1]; |
33 |
$status = $matches[2]; |
34 |
if ($status == "ok") { |
35 |
array_push($success, $rpm); |
36 |
} elseif ($status != "unknown" && $status != "not_on_this_arch"){ |
37 |
array_push($failure, $rpm); |
38 |
preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $rpm, $matches); |
39 |
if(!$packages[$matches[1]]) { |
40 |
$removed[$rpm] = 1; |
41 |
} elseif ($packages[$matches[1]] != $matches[2]) { |
42 |
$fixed[$rpm] = 1; |
43 |
} |
44 |
} |
45 |
} |
46 |
} |
47 |
fclose($status_file); |
48 |
|
49 |
$nb_failed = count($failure); |
50 |
$nb_success = count($success); |
51 |
$nb_fixed = count($fixed); |
52 |
$nb_removed = count($removed); |
53 |
$nb_tried = $nb_failed + $nb_success; |
54 |
$succes_percent = round($nb_success*1000/$nb_tried)/10; |
55 |
$estimated_percent = round(($nb_success+$nb_fixed)*1000/($nb_tried-$nb_removed))/10; |
56 |
|
57 |
echo "<title>$succes_percent% Success</title>\n"; |
58 |
echo "</head><body>\n"; |
59 |
|
60 |
echo "<h1>$succes_percent% Success</h1>\n"; |
61 |
echo "$nb_fixed packages have been fixed since this run and $nb_removed have been removed.<br/> If no new package was broken, success rate next time should be $estimated_percent%.<br/>\n"; |
62 |
echo "<div style='float:left'><h1>Failed builds ($nb_failed/$nb_tried):</h1><ul>"; |
63 |
|
64 |
foreach ($failure as $rpm) { |
65 |
$status = ""; |
66 |
if ($fixed[$rpm]) { |
67 |
$status = " <span style='color:green;'><b>Fixed!</b></span>"; |
68 |
} elseif ($removed[$rpm]) { |
69 |
$status = " <span style='color:yellow;'><b>Removed</b></span>"; |
70 |
} |
71 |
echo "<li><a href='$base_dir/$rpm/'>$rpm</a>$status</li>\n"; |
72 |
} |
73 |
|
74 |
echo "</ul></div><div style='float:right'><h1>Successful builds ($nb_success/$nb_tried):</h1><ul>"; |
75 |
|
76 |
foreach ($success as $rpm) { |
77 |
echo "<li><a href='$base_dir/$rpm/'>$rpm</a></li>\n"; |
78 |
} |
79 |
|
80 |
?> |
81 |
</ul></div> |
82 |
</body> |
83 |
</html> |