1 |
<html> |
2 |
<head> |
3 |
<?php |
4 |
|
5 |
$runs = Array(); |
6 |
$handle = opendir('cauldron/x86_64/core/'); |
7 |
while (false !== ($entry = readdir($handle))) { |
8 |
if (preg_match("/^....-..-..$/", $entry, $matches)) { |
9 |
array_push($runs, $matches[0]); |
10 |
} |
11 |
} |
12 |
closedir($handle); |
13 |
sort($runs); |
14 |
|
15 |
$latest = readlink("cauldron/x86_64/core/latest"); |
16 |
$run = $_GET['run']; |
17 |
if (!$run) { |
18 |
$run = $latest; |
19 |
} |
20 |
|
21 |
foreach ($runs as $r) { |
22 |
if ($r==$run) { |
23 |
break; |
24 |
} |
25 |
$prev = $r; |
26 |
} |
27 |
|
28 |
$packages = Array(); |
29 |
if ($handle = opendir('/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/')) { |
30 |
while (false !== ($entry = readdir($handle))) { |
31 |
if (preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $entry, $matches)) { |
32 |
$packages[$matches[1]] = $entry; |
33 |
} |
34 |
} |
35 |
closedir($handle); |
36 |
} |
37 |
|
38 |
$prev_failure = Array(); |
39 |
if ($prev) { |
40 |
$base_dir = "cauldron/x86_64/core/$prev"; |
41 |
$status_name = "$base_dir/status.core.log"; |
42 |
$status_file = fopen($status_name, "r"); |
43 |
while (!feof($status_file)) { |
44 |
$line = fgets($status_file); |
45 |
if (preg_match("/^(.*): (.*)$/", $line, $matches)) { |
46 |
$rpm = $matches[1]; |
47 |
$status = $matches[2]; |
48 |
if ($status != "ok" && $status != "unknown" && $status != "not_on_this_arch") { |
49 |
$prev_failure[$rpm] = 1; |
50 |
} |
51 |
} |
52 |
} |
53 |
fclose($status_file); |
54 |
} |
55 |
|
56 |
$success = Array(); |
57 |
$failure = Array(); |
58 |
$fixed = Array(); |
59 |
$removed = Array(); |
60 |
$broken = Array(); |
61 |
|
62 |
$base_dir = "cauldron/x86_64/core/$run"; |
63 |
|
64 |
|
65 |
$status_name = "$base_dir/status.core.log"; |
66 |
if (!file_exists($status_name)) { |
67 |
echo "Invalid run"; |
68 |
exit; |
69 |
} |
70 |
|
71 |
$status_file = fopen($status_name, "r"); |
72 |
while (!feof($status_file)) { |
73 |
$line = fgets($status_file); |
74 |
if (preg_match("/^(.*): (.*)$/", $line, $matches)) { |
75 |
$rpm = $matches[1]; |
76 |
$status = $matches[2]; |
77 |
if ($status == "ok") { |
78 |
array_push($success, $rpm); |
79 |
} elseif ($status != "unknown" && $status != "not_on_this_arch"){ |
80 |
$failure[$rpm] = $status; |
81 |
preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $rpm, $matches); |
82 |
$package = $matches[1]; |
83 |
$version = $matches[2]; |
84 |
if(!$packages[$package]) { |
85 |
$removed[$rpm] = 1; |
86 |
} else { |
87 |
$build_stat = stat("$base_dir/$rpm"); |
88 |
$pkg_stat = stat('/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/'.$packages[$package]); |
89 |
if ($pkg_stat['mtime'] > $build_stat['mtime']) { |
90 |
$fixed[$rpm] = 1; |
91 |
} |
92 |
} |
93 |
} |
94 |
} |
95 |
} |
96 |
fclose($status_file); |
97 |
|
98 |
sort($success); |
99 |
ksort($failure); |
100 |
|
101 |
$nb_failed = count($failure); |
102 |
$nb_success = count($success); |
103 |
$nb_fixed = count($fixed); |
104 |
$nb_removed = count($removed); |
105 |
$nb_tried = $nb_failed + $nb_success; |
106 |
$succes_percent = round($nb_success*1000/$nb_tried)/10; |
107 |
$estimated_percent = round(($nb_success+$nb_fixed)*1000/($nb_tried-$nb_removed))/10; |
108 |
|
109 |
echo "<title>$succes_percent% Success</title>\n"; |
110 |
echo "</head><body>\n"; |
111 |
|
112 |
echo "<div style='position:absolute;right:0;top:0;'>"; |
113 |
foreach ($runs as $r) { |
114 |
$text = $r . (($r > $latest) ? ' (in progress)' : ''); |
115 |
|
116 |
if ($r==$run) { |
117 |
echo $text; |
118 |
} else { |
119 |
echo '<a href="'.$_SERVER["PHP_SELF"].'?run='.$r.'">'.$text.'</a>'; |
120 |
} |
121 |
echo ' '; |
122 |
} |
123 |
|
124 |
echo "</div>\n"; |
125 |
echo "<h1>$succes_percent% Success</h1>\n"; |
126 |
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"; |
127 |
echo "<div style='float:left'><h1>Failed builds ($nb_failed/$nb_tried):</h1><ul style='list-style:none;'>"; |
128 |
|
129 |
foreach ($failure as $rpm => $error) { |
130 |
$status_html = ""; |
131 |
if ($fixed[$rpm]) { |
132 |
$status_html = " <img src='icons/state-fixed.png' title='Fixed!' />"; |
133 |
} elseif ($removed[$rpm]) { |
134 |
$status_html = " <img src='icons/state-removed.png' title='Removed' />"; |
135 |
} elseif ($broken[$rpm]) { |
136 |
$status_html = " <img src='icons/state-new.png' title='New!' />"; |
137 |
} |
138 |
$error_html = $error; |
139 |
if (file_exists("icons/error-$error.png")) { |
140 |
$error_html = "<img src='icons/error-$error.png' title='$error'/>"; |
141 |
} |
142 |
if (file_exists("$base_dir/$rpm/")) { |
143 |
echo "<li>$error_html <a href='$base_dir/$rpm/'>$rpm</a> $status_html</li>\n"; |
144 |
} else { |
145 |
echo "<li>$error_html $rpm $status_html</li>\n"; |
146 |
} |
147 |
} |
148 |
|
149 |
echo "</ul></div><div style='float:right'><h1>Successful builds ($nb_success/$nb_tried):</h1><ul>"; |
150 |
|
151 |
foreach ($success as $rpm) { |
152 |
if (file_exists("$base_dir/$rpm/")) { |
153 |
echo "<li><a href='$base_dir/$rpm/'>$rpm</a></li>\n"; |
154 |
} else { |
155 |
echo "<li>$rpm</li>\n"; |
156 |
} |
157 |
} |
158 |
|
159 |
?> |
160 |
</ul></div> |
161 |
</body> |
162 |
</html> |