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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26