/[soft]/build_system/web/autobuild/results.php
ViewVC logotype

Contents of /build_system/web/autobuild/results.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6729 - (show annotations) (download)
Tue Dec 11 23:03:12 2012 UTC (5 years, 11 months ago) by pterjan
Original Path: build_system/web/autobuild/index.php
File size: 3366 byte(s)
Display new failures compared to previous run
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 $run = $_GET['run'];
16 if (!$run) {
17 $run = readlink("cauldron/x86_64/core/latest");
18 }
19
20 foreach ($runs as $r) {
21 if ($r==$run) {
22 break;
23 }
24 $prev = $r;
25 }
26 $packages = Array();
27 if ($handle = opendir('/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/')) {
28 while (false !== ($entry = readdir($handle))) {
29 if (preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $entry, $matches)) {
30 $packages[$matches[1]] = $matches[2];
31 }
32 }
33 closedir($handle);
34 }
35
36 $prev_failure = Array();
37 if ($prev) {
38 $base_dir = "cauldron/x86_64/core/$prev";
39 $status_name = "$base_dir/status.core.log";
40 $status_file = fopen($status_name, "r");
41 while (!feof($status_file)) {
42 $line = fgets($status_file);
43 if (preg_match("/^(.*): (.*)$/", $line, $matches)) {
44 $rpm = $matches[1];
45 $status = $matches[2];
46 if ($status != "ok" && $status != "unknown" && $status != "not_on_this_arch") {
47 $prev_failure[$rpm] = 1;
48 }
49 }
50 }
51 fclose($status_file);
52 }
53
54 $success = Array();
55 $failure = Array();
56 $fixed = Array();
57 $removed = Array();
58
59 $base_dir = "cauldron/x86_64/core/$run";
60
61
62 $status_name = "$base_dir/status.core.log";
63 if (!file_exists($status_name)) {
64 echo "Invalid run";
65 exit;
66 }
67 $status_file = fopen($status_name, "r");
68
69 while (!feof($status_file)) {
70 $line = fgets($status_file);
71 if (preg_match("/^(.*): (.*)$/", $line, $matches)) {
72 $rpm = $matches[1];
73 $status = $matches[2];
74 if ($status == "ok") {
75 array_push($success, $rpm);
76 } elseif ($status != "unknown" && $status != "not_on_this_arch"){
77 array_push($failure, $rpm);
78 preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $rpm, $matches);
79 if(!$packages[$matches[1]]) {
80 $removed[$rpm] = 1;
81 } elseif ($packages[$matches[1]] != $matches[2]) {
82 $fixed[$rpm] = 1;
83 }
84 }
85 }
86 }
87 fclose($status_file);
88
89 sort($success);
90 sort($failure);
91
92 $nb_failed = count($failure);
93 $nb_success = count($success);
94 $nb_fixed = count($fixed);
95 $nb_removed = count($removed);
96 $nb_tried = $nb_failed + $nb_success;
97 $succes_percent = round($nb_success*1000/$nb_tried)/10;
98 $estimated_percent = round(($nb_success+$nb_fixed)*1000/($nb_tried-$nb_removed))/10;
99
100 echo "<title>$succes_percent% Success</title>\n";
101 echo "</head><body>\n";
102
103 echo "<h1>$succes_percent% Success</h1>\n";
104 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";
105 echo "<div style='float:left'><h1>Failed builds ($nb_failed/$nb_tried):</h1><ul>";
106
107 foreach ($failure as $rpm) {
108 $status = "";
109 if ($fixed[$rpm]) {
110 $status = " <span style='color:green;'><b>Fixed!</b></span>";
111 } elseif ($removed[$rpm]) {
112 $status = " <span style='color:yellow;'><b>Removed</b></span>";
113 } elseif ($prev && !$prev_failure[$rpm]) {
114 $status = " <span style='color:red;'><b>New!</b></span>";
115 }
116 echo "<li><a href='$base_dir/$rpm/'>$rpm</a>$status</li>\n";
117 }
118
119 echo "</ul></div><div style='float:right'><h1>Successful builds ($nb_success/$nb_tried):</h1><ul>";
120
121 foreach ($success as $rpm) {
122 echo "<li><a href='$base_dir/$rpm/'>$rpm</a></li>\n";
123 }
124
125 ?>
126 </ul></div>
127 </body>
128 </html>

  ViewVC Help
Powered by ViewVC 1.1.26